Fossil SCM
Bug fixes in "fossil patch apply".
Commit
f5629790cc791164e57363e2d6f5d7fa2c7ef0cd1ad14cf93c940f112b1b36bc
Parent
5865739195db366…
1 file changed
+9
-5
+9
-5
| --- src/patch.c | ||
| +++ src/patch.c | ||
| @@ -304,23 +304,27 @@ | ||
| 304 | 304 | "SELECT type, mhash, upper(type) FROM patch.patchmerge" |
| 305 | 305 | " WHERE type IN ('merge','cherrypick','backout','integrate')" |
| 306 | 306 | " AND mhash NOT GLOB '*[^a-fA-F0-9]*';" |
| 307 | 307 | ); |
| 308 | 308 | while( db_step(&q)==SQLITE_ROW ){ |
| 309 | + const char *zType = db_column_text(&q,0); | |
| 309 | 310 | 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 | + } | |
| 312 | 316 | if( mFlags & PATCH_VERBOSE ){ |
| 313 | 317 | fossil_print("%-10s %s\n", db_column_text(&q,2), |
| 314 | 318 | db_column_text(&q,0)); |
| 315 | 319 | } |
| 316 | 320 | } |
| 317 | 321 | db_finalize(&q); |
| 318 | 322 | if( mFlags & PATCH_DRYRUN ){ |
| 319 | 323 | fossil_print("%s", blob_str(&cmd)); |
| 320 | 324 | }else{ |
| 321 | - int rc = fossil_system(blob_str(&cmd)); | |
| 325 | + int rc = fossil_unsafe_system(blob_str(&cmd)); | |
| 322 | 326 | if( rc ){ |
| 323 | 327 | fossil_fatal("unable to do merges:\n%s", |
| 324 | 328 | blob_str(&cmd)); |
| 325 | 329 | } |
| 326 | 330 | } |
| @@ -340,11 +344,11 @@ | ||
| 340 | 344 | db_finalize(&q); |
| 341 | 345 | if( blob_size(&cmd)>0 ){ |
| 342 | 346 | if( mFlags & PATCH_DRYRUN ){ |
| 343 | 347 | fossil_print("%s", blob_str(&cmd)); |
| 344 | 348 | }else{ |
| 345 | - int rc = fossil_system(blob_str(&cmd)); | |
| 349 | + int rc = fossil_unsafe_system(blob_str(&cmd)); | |
| 346 | 350 | if( rc ){ |
| 347 | 351 | fossil_fatal("unable to do merges:\n%s", |
| 348 | 352 | blob_str(&cmd)); |
| 349 | 353 | } |
| 350 | 354 | } |
| @@ -369,11 +373,11 @@ | ||
| 369 | 373 | db_finalize(&q); |
| 370 | 374 | if( blob_size(&cmd)>0 ){ |
| 371 | 375 | if( mFlags & PATCH_DRYRUN ){ |
| 372 | 376 | fossil_print("%s", blob_str(&cmd)); |
| 373 | 377 | }else{ |
| 374 | - int rc = fossil_system(blob_str(&cmd)); | |
| 378 | + int rc = fossil_unsafe_system(blob_str(&cmd)); | |
| 375 | 379 | if( rc ){ |
| 376 | 380 | fossil_fatal("unable to rename files:\n%s", |
| 377 | 381 | blob_str(&cmd)); |
| 378 | 382 | } |
| 379 | 383 | } |
| 380 | 384 |
| --- 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 |