Mercurial > public > mercurial-scm > hg
comparison mercurial/merge.py @ 9716:ea8c207a0f78
update: add comments and test cases for updating across branches
Add comment to merge.py:update() showing various cases of 'hg update': to a
descendant, crossing named branches, and crossing branches within a named
branch; with no option, -c or -C; with or without uncommitted changes; and
with or without a specific revision. Add tests for all of these cases.
author | Stuart W Marks <smarks@smarks.org> |
---|---|
date | Thu, 05 Nov 2009 10:53:36 +0100 |
parents | 4c041f1ee1b4 |
children | 68a1b9d0663e |
comparison
equal
deleted
inserted
replaced
9715:f0e99a2eac76 | 9716:ea8c207a0f78 |
---|---|
395 | 395 |
396 def update(repo, node, branchmerge, force, partial): | 396 def update(repo, node, branchmerge, force, partial): |
397 """ | 397 """ |
398 Perform a merge between the working directory and the given node | 398 Perform a merge between the working directory and the given node |
399 | 399 |
400 node = the node to update to, or None if unspecified | |
400 branchmerge = whether to merge between branches | 401 branchmerge = whether to merge between branches |
401 force = whether to force branch merging or file overwriting | 402 force = whether to force branch merging or file overwriting |
402 partial = a function to filter file lists (dirstate not updated) | 403 partial = a function to filter file lists (dirstate not updated) |
404 | |
405 The table below shows all the behaviors of the update command | |
406 given the -c and -C or no options, whether the working directory | |
407 is dirty, whether a revision is specified, and the relationship of | |
408 the parent rev to the target rev (linear, on the same named | |
409 branch, or on another named branch). | |
410 | |
411 This logic is tested by test-update-branches. | |
412 | |
413 -c -C dirty rev | linear same cross | |
414 n n n n | ok (1) x | |
415 n n n y | ok (1) ok | |
416 n n y * | merge (2) (3) | |
417 n y * * | --- discard --- | |
418 y n y * | --- (4) --- | |
419 y n n * | --- ok --- | |
420 y y * * | --- (5) --- | |
421 | |
422 x = can't happen | |
423 * = don't-care | |
424 1 = abort: crosses branches (use 'hg merge' or 'hg update -C') | |
425 2 = abort: crosses branches (use 'hg merge' or 'hg update -C' | |
426 to discard changes) | |
427 3 = abort: crosses named branches (use 'hg update -C' to | |
428 discard changes) | |
429 4 = abort: uncommitted local changes | |
430 5 = incompatible options (checked in commands.py) | |
403 """ | 431 """ |
404 | 432 |
405 wlock = repo.wlock() | 433 wlock = repo.wlock() |
406 try: | 434 try: |
407 wc = repo[None] | 435 wc = repo[None] |