Fossil

Check-in [f5629790cc]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Bug fixes in "fossil patch apply".
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | patch-cmd
Files: files | file ages | folders
SHA3-256: f5629790cc791164e57363e2d6f5d7fa2c7ef0cd1ad14cf93c940f112b1b36bc
User & Date: drh 2021-06-22 00:12:01.827
Context
2021-06-22
01:32
Allow patches to be sent and received via standard input and standard output. check-in: 9180106327 user: drh tags: patch-cmd
00:12
Bug fixes in "fossil patch apply". check-in: f5629790cc user: drh tags: patch-cmd
00:04
First attempt to get "fossil patch apply" working. There are probably still bugs. Certainly much more testing is needed. check-in: 5865739195 user: drh tags: patch-cmd
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/patch.c.
302
303
304
305
306
307
308

309

310

311

312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
  if( db_table_exists("patch","patchmerge") ){
    db_prepare(&q,
      "SELECT type, mhash, upper(type) FROM patch.patchmerge"
      " WHERE type IN ('merge','cherrypick','backout','integrate')"
      "   AND mhash NOT GLOB '*[^a-fA-F0-9]*';"
    );
    while( db_step(&q)==SQLITE_ROW ){

      blob_append_escaped_arg(&cmd, g.nameOfExe);

      blob_appendf(&cmd, " --%s %s\n", db_column_text(&q,0),

                    db_column_text(&q,1));

      if( mFlags & PATCH_VERBOSE ){
        fossil_print("%-10s %s\n", db_column_text(&q,2), 
                    db_column_text(&q,0));
      }
    }
    db_finalize(&q);
    if( mFlags & PATCH_DRYRUN ){
      fossil_print("%s", blob_str(&cmd));
    }else{
      int rc = fossil_system(blob_str(&cmd));
      if( rc ){
        fossil_fatal("unable to do merges:\n%s",
                     blob_str(&cmd));
      }
    }
    blob_reset(&cmd);
  }







>

>
|
>
|
>









|







302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
  if( db_table_exists("patch","patchmerge") ){
    db_prepare(&q,
      "SELECT type, mhash, upper(type) FROM patch.patchmerge"
      " WHERE type IN ('merge','cherrypick','backout','integrate')"
      "   AND mhash NOT GLOB '*[^a-fA-F0-9]*';"
    );
    while( db_step(&q)==SQLITE_ROW ){
      const char *zType = db_column_text(&q,0);
      blob_append_escaped_arg(&cmd, g.nameOfExe);
      if( strcmp(zType,"merge")==0 ){
        blob_appendf(&cmd, " merge %s\n", db_column_text(&q,1));
      }else{
        blob_appendf(&cmd, " merge --%s %s\n", zType, db_column_text(&q,1));
      }
      if( mFlags & PATCH_VERBOSE ){
        fossil_print("%-10s %s\n", db_column_text(&q,2), 
                    db_column_text(&q,0));
      }
    }
    db_finalize(&q);
    if( mFlags & PATCH_DRYRUN ){
      fossil_print("%s", blob_str(&cmd));
    }else{
      int rc = fossil_unsafe_system(blob_str(&cmd));
      if( rc ){
        fossil_fatal("unable to do merges:\n%s",
                     blob_str(&cmd));
      }
    }
    blob_reset(&cmd);
  }
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
    }
  }
  db_finalize(&q);
  if( blob_size(&cmd)>0 ){
    if( mFlags & PATCH_DRYRUN ){
      fossil_print("%s", blob_str(&cmd));
    }else{
      int rc = fossil_system(blob_str(&cmd));
      if( rc ){
        fossil_fatal("unable to do merges:\n%s",
                     blob_str(&cmd));
      }
    }
    blob_reset(&cmd);
  }







|







342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
    }
  }
  db_finalize(&q);
  if( blob_size(&cmd)>0 ){
    if( mFlags & PATCH_DRYRUN ){
      fossil_print("%s", blob_str(&cmd));
    }else{
      int rc = fossil_unsafe_system(blob_str(&cmd));
      if( rc ){
        fossil_fatal("unable to do merges:\n%s",
                     blob_str(&cmd));
      }
    }
    blob_reset(&cmd);
  }
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
    }
  }
  db_finalize(&q);
  if( blob_size(&cmd)>0 ){
    if( mFlags & PATCH_DRYRUN ){
      fossil_print("%s", blob_str(&cmd));
    }else{
      int rc = fossil_system(blob_str(&cmd));
      if( rc ){
        fossil_fatal("unable to rename files:\n%s",
                     blob_str(&cmd));
      }
    }
    blob_reset(&cmd);
  }







|







371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
    }
  }
  db_finalize(&q);
  if( blob_size(&cmd)>0 ){
    if( mFlags & PATCH_DRYRUN ){
      fossil_print("%s", blob_str(&cmd));
    }else{
      int rc = fossil_unsafe_system(blob_str(&cmd));
      if( rc ){
        fossil_fatal("unable to rename files:\n%s",
                     blob_str(&cmd));
      }
    }
    blob_reset(&cmd);
  }