Fossil SCM

Bug fixes in "fossil patch apply".

drh 2021-06-22 00:12 patch-cmd
Commit f5629790cc791164e57363e2d6f5d7fa2c7ef0cd1ad14cf93c940f112b1b36bc
1 file changed +9 -5
+9 -5
--- src/patch.c
+++ src/patch.c
@@ -304,23 +304,27 @@
304304
"SELECT type, mhash, upper(type) FROM patch.patchmerge"
305305
" WHERE type IN ('merge','cherrypick','backout','integrate')"
306306
" AND mhash NOT GLOB '*[^a-fA-F0-9]*';"
307307
);
308308
while( db_step(&q)==SQLITE_ROW ){
309
+ const char *zType = db_column_text(&q,0);
309310
blob_append_escaped_arg(&cmd, g.nameOfExe);
310
- blob_appendf(&cmd, " --%s %s\n", db_column_text(&q,0),
311
- db_column_text(&q,1));
311
+ if( strcmp(zType,"merge")==0 ){
312
+ blob_appendf(&cmd, " merge %s\n", db_column_text(&q,1));
313
+ }else{
314
+ blob_appendf(&cmd, " merge --%s %s\n", zType, db_column_text(&q,1));
315
+ }
312316
if( mFlags & PATCH_VERBOSE ){
313317
fossil_print("%-10s %s\n", db_column_text(&q,2),
314318
db_column_text(&q,0));
315319
}
316320
}
317321
db_finalize(&q);
318322
if( mFlags & PATCH_DRYRUN ){
319323
fossil_print("%s", blob_str(&cmd));
320324
}else{
321
- int rc = fossil_system(blob_str(&cmd));
325
+ int rc = fossil_unsafe_system(blob_str(&cmd));
322326
if( rc ){
323327
fossil_fatal("unable to do merges:\n%s",
324328
blob_str(&cmd));
325329
}
326330
}
@@ -340,11 +344,11 @@
340344
db_finalize(&q);
341345
if( blob_size(&cmd)>0 ){
342346
if( mFlags & PATCH_DRYRUN ){
343347
fossil_print("%s", blob_str(&cmd));
344348
}else{
345
- int rc = fossil_system(blob_str(&cmd));
349
+ int rc = fossil_unsafe_system(blob_str(&cmd));
346350
if( rc ){
347351
fossil_fatal("unable to do merges:\n%s",
348352
blob_str(&cmd));
349353
}
350354
}
@@ -369,11 +373,11 @@
369373
db_finalize(&q);
370374
if( blob_size(&cmd)>0 ){
371375
if( mFlags & PATCH_DRYRUN ){
372376
fossil_print("%s", blob_str(&cmd));
373377
}else{
374
- int rc = fossil_system(blob_str(&cmd));
378
+ int rc = fossil_unsafe_system(blob_str(&cmd));
375379
if( rc ){
376380
fossil_fatal("unable to rename files:\n%s",
377381
blob_str(&cmd));
378382
}
379383
}
380384
--- src/patch.c
+++ src/patch.c
@@ -304,23 +304,27 @@
304 "SELECT type, mhash, upper(type) FROM patch.patchmerge"
305 " WHERE type IN ('merge','cherrypick','backout','integrate')"
306 " AND mhash NOT GLOB '*[^a-fA-F0-9]*';"
307 );
308 while( db_step(&q)==SQLITE_ROW ){
 
309 blob_append_escaped_arg(&cmd, g.nameOfExe);
310 blob_appendf(&cmd, " --%s %s\n", db_column_text(&q,0),
311 db_column_text(&q,1));
 
 
 
312 if( mFlags & PATCH_VERBOSE ){
313 fossil_print("%-10s %s\n", db_column_text(&q,2),
314 db_column_text(&q,0));
315 }
316 }
317 db_finalize(&q);
318 if( mFlags & PATCH_DRYRUN ){
319 fossil_print("%s", blob_str(&cmd));
320 }else{
321 int rc = fossil_system(blob_str(&cmd));
322 if( rc ){
323 fossil_fatal("unable to do merges:\n%s",
324 blob_str(&cmd));
325 }
326 }
@@ -340,11 +344,11 @@
340 db_finalize(&q);
341 if( blob_size(&cmd)>0 ){
342 if( mFlags & PATCH_DRYRUN ){
343 fossil_print("%s", blob_str(&cmd));
344 }else{
345 int rc = fossil_system(blob_str(&cmd));
346 if( rc ){
347 fossil_fatal("unable to do merges:\n%s",
348 blob_str(&cmd));
349 }
350 }
@@ -369,11 +373,11 @@
369 db_finalize(&q);
370 if( blob_size(&cmd)>0 ){
371 if( mFlags & PATCH_DRYRUN ){
372 fossil_print("%s", blob_str(&cmd));
373 }else{
374 int rc = fossil_system(blob_str(&cmd));
375 if( rc ){
376 fossil_fatal("unable to rename files:\n%s",
377 blob_str(&cmd));
378 }
379 }
380
--- src/patch.c
+++ src/patch.c
@@ -304,23 +304,27 @@
304 "SELECT type, mhash, upper(type) FROM patch.patchmerge"
305 " WHERE type IN ('merge','cherrypick','backout','integrate')"
306 " AND mhash NOT GLOB '*[^a-fA-F0-9]*';"
307 );
308 while( db_step(&q)==SQLITE_ROW ){
309 const char *zType = db_column_text(&q,0);
310 blob_append_escaped_arg(&cmd, g.nameOfExe);
311 if( strcmp(zType,"merge")==0 ){
312 blob_appendf(&cmd, " merge %s\n", db_column_text(&q,1));
313 }else{
314 blob_appendf(&cmd, " merge --%s %s\n", zType, db_column_text(&q,1));
315 }
316 if( mFlags & PATCH_VERBOSE ){
317 fossil_print("%-10s %s\n", db_column_text(&q,2),
318 db_column_text(&q,0));
319 }
320 }
321 db_finalize(&q);
322 if( mFlags & PATCH_DRYRUN ){
323 fossil_print("%s", blob_str(&cmd));
324 }else{
325 int rc = fossil_unsafe_system(blob_str(&cmd));
326 if( rc ){
327 fossil_fatal("unable to do merges:\n%s",
328 blob_str(&cmd));
329 }
330 }
@@ -340,11 +344,11 @@
344 db_finalize(&q);
345 if( blob_size(&cmd)>0 ){
346 if( mFlags & PATCH_DRYRUN ){
347 fossil_print("%s", blob_str(&cmd));
348 }else{
349 int rc = fossil_unsafe_system(blob_str(&cmd));
350 if( rc ){
351 fossil_fatal("unable to do merges:\n%s",
352 blob_str(&cmd));
353 }
354 }
@@ -369,11 +373,11 @@
373 db_finalize(&q);
374 if( blob_size(&cmd)>0 ){
375 if( mFlags & PATCH_DRYRUN ){
376 fossil_print("%s", blob_str(&cmd));
377 }else{
378 int rc = fossil_unsafe_system(blob_str(&cmd));
379 if( rc ){
380 fossil_fatal("unable to rename files:\n%s",
381 blob_str(&cmd));
382 }
383 }
384

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button