Mercurial > public > mercurial-scm > hg
diff 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 |
line wrap: on
line diff
--- a/mercurial/merge.py Thu Nov 05 10:49:28 2009 +0100 +++ b/mercurial/merge.py Thu Nov 05 10:53:36 2009 +0100 @@ -397,9 +397,37 @@ """ Perform a merge between the working directory and the given node + node = the node to update to, or None if unspecified branchmerge = whether to merge between branches force = whether to force branch merging or file overwriting partial = a function to filter file lists (dirstate not updated) + + The table below shows all the behaviors of the update command + given the -c and -C or no options, whether the working directory + is dirty, whether a revision is specified, and the relationship of + the parent rev to the target rev (linear, on the same named + branch, or on another named branch). + + This logic is tested by test-update-branches. + + -c -C dirty rev | linear same cross + n n n n | ok (1) x + n n n y | ok (1) ok + n n y * | merge (2) (3) + n y * * | --- discard --- + y n y * | --- (4) --- + y n n * | --- ok --- + y y * * | --- (5) --- + + x = can't happen + * = don't-care + 1 = abort: crosses branches (use 'hg merge' or 'hg update -C') + 2 = abort: crosses branches (use 'hg merge' or 'hg update -C' + to discard changes) + 3 = abort: crosses named branches (use 'hg update -C' to + discard changes) + 4 = abort: uncommitted local changes + 5 = incompatible options (checked in commands.py) """ wlock = repo.wlock()