Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Handle merges with a specified baseline that comes after a commit with renames. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | merge-renames |
Files: | files | file ages | folders |
SHA1: |
8da901bb98dbe06c39cf22c82079a31e |
User & Date: | joel 2016-05-06 20:27:57.118 |
Context
2016-05-09
| ||
23:48 | Call pivot_set_*() before each pivot_find() call. ... (check-in: ec25471c user: joel tags: merge-renames) | |
2016-05-06
| ||
20:27 | Handle merges with a specified baseline that comes after a commit with renames. ... (check-in: 8da901bb user: joel tags: merge-renames) | |
20:00 | find_filename_changes() should report a rename even if the file ends up reverting back to its original name. ... (check-in: 0e9d50b1 user: joel tags: merge-renames) | |
Changes
Changes to src/merge.c.
︙ | ︙ | |||
225 226 227 228 229 230 231 232 233 234 235 236 237 238 | int forceFlag; /* True if the --force or -f option is present */ int forceMissingFlag; /* True if the --force-missing option is present */ const char *zBinGlob; /* The value of --binary */ const char *zPivot; /* The value of --baseline */ int debugFlag; /* True if --debug is present */ int nConflict = 0; /* Number of conflicts seen */ int nOverwrite = 0; /* Number of unmanaged files overwritten */ Stmt q; /* Notation: ** ** V The current checkout ** M The version being merged in | > | 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 | int forceFlag; /* True if the --force or -f option is present */ int forceMissingFlag; /* True if the --force-missing option is present */ const char *zBinGlob; /* The value of --binary */ const char *zPivot; /* The value of --baseline */ int debugFlag; /* True if --debug is present */ int nConflict = 0; /* Number of conflicts seen */ int nOverwrite = 0; /* Number of unmanaged files overwritten */ char vAncestor = 'p'; /* If P is an ancestor of V then 'p', else 'n' */ Stmt q; /* Notation: ** ** V The current checkout ** M The version being merged in |
︙ | ︙ | |||
381 382 383 384 385 386 387 388 389 390 391 392 393 394 | if( !dryRunFlag ) undo_begin(); if( load_vfile_from_rid(mid) && !forceMissingFlag ){ fossil_fatal("missing content, unable to merge"); } if( load_vfile_from_rid(pid) && !forceMissingFlag ){ fossil_fatal("missing content, unable to merge"); } if( debugFlag ){ char *z; z = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", nid); fossil_print("N=%d %z\n", nid, z); z = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", pid); fossil_print("P=%d %z\n", pid, z); z = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", mid); | > > > > > > > > > > > | 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 | if( !dryRunFlag ) undo_begin(); if( load_vfile_from_rid(mid) && !forceMissingFlag ){ fossil_fatal("missing content, unable to merge"); } if( load_vfile_from_rid(pid) && !forceMissingFlag ){ fossil_fatal("missing content, unable to merge"); } if( zPivot ){ vAncestor = db_exists( "WITH RECURSIVE ancestor(id) AS (" " VALUES(%d)" " UNION ALL" " SELECT pid FROM plink, ancestor" " WHERE cid=ancestor.id AND pid!=%d AND cid!=%d)" "SELECT 1 FROM ancestor WHERE id=%d LIMIT 1", vid, nid, pid, pid ) ? 'p' : 'n'; } if( debugFlag ){ char *z; z = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", nid); fossil_print("N=%d %z\n", nid, z); z = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", pid); fossil_print("P=%d %z\n", pid, z); z = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", mid); |
︙ | ︙ | |||
431 432 433 434 435 436 437 | add_renames("fnp", pid, nid, 0, debugFlag ? "N->P" : 0); add_renames("fnm", mid, nid, backoutFlag, debugFlag ? "N->M" : 0); /* ** Add files found in V */ db_multi_exec( | | | | 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 | add_renames("fnp", pid, nid, 0, debugFlag ? "N->P" : 0); add_renames("fnm", mid, nid, backoutFlag, debugFlag ? "N->M" : 0); /* ** Add files found in V */ db_multi_exec( "UPDATE OR IGNORE fv SET fn=coalesce(fn%c,fnn) WHERE fn IS NULL;" "REPLACE INTO fv(fn,fnp,fnm,fnn,idv,ridv,islinkv,isexe,chnged)" " SELECT pathname, fnp, fnm, fnn, id, rid, islink, vf.isexe, vf.chnged" " FROM vfile vf" " LEFT JOIN fv ON fn=coalesce(origname,pathname)" " AND rid>0 AND vf.chnged NOT IN (3,5)" " WHERE vid=%d;", vAncestor, vid ); /* ** Add files found in P */ db_multi_exec( "UPDATE OR IGNORE fv SET fnp=coalesce(fnn," |
︙ | ︙ |
Changes to test/merge_renames.test.
︙ | ︙ | |||
385 386 387 388 389 390 391 392 393 394 395 396 397 398 | UPDATE f1 UPDATE f2 } test_file_contents merge_renames-10-9 f1 "f2.1" test_file_contents merge_renames-10-10 f2 "f1.1" ###################################### # # Tests for troubles not specifically linked with renames but that I'd like to # write: # [c26c63eb1b] - 'merge --backout' does not handle conflicts properly # [953031915f] - Lack of warning when overwriting extra files # [4df5f38f1e] - Troubles merging a file delete with a file change | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 | UPDATE f1 UPDATE f2 } test_file_contents merge_renames-10-9 f1 "f2.1" test_file_contents merge_renames-10-10 f2 "f1.1" ############################################ # Test 11 # # Specifying a baseline # ############################################ test_setup write_file f1 "line" fossil add f1 fossil commit -m "add f1" write_file f1 "line\nline2" fossil commit -b b -m "edit f2" --tag p1 fossil mv --hard f1 f2 fossil commit -m "f1 -> f2" write_file f2 "line\nline2\nline3" fossil commit -m "edit f2" --tag p2 write_file f2 "line\nline2\nline3\nline4" fossil commit -m "edit f2" fossil update trunk fossil merge --baseline p1 b test_status_list merge_renames-11-1 $RESULT { MERGE f1 RENAME f1 -> f2 } test_file_contents merge_renames-11-2 f2 "line\nline3\nline4" fossil revert fossil merge --baseline p2 b test_status_list merge_renames-11-3 $RESULT {MERGE f1} test_file_contents merge_renames-11-4 f1 "line\nline4" ###################################### # # Tests for troubles not specifically linked with renames but that I'd like to # write: # [c26c63eb1b] - 'merge --backout' does not handle conflicts properly # [953031915f] - Lack of warning when overwriting extra files # [4df5f38f1e] - Troubles merging a file delete with a file change |
︙ | ︙ |