##// END OF EJS Templates
update: add error message for dirty non-linear update with no rev...
Siddharth Agarwal -
r19799:ab3e4222 default
parent child Browse files
Show More
@@ -656,19 +656,21 def update(repo, node, branchmerge, forc
656 656 -c -C dirty rev | linear same cross
657 657 n n n n | ok (1) x
658 658 n n n y | ok ok ok
659 n n y * | merge (2) (2)
659 n n y n | merge (2) (2)
660 n n y y | merge (3) (3)
660 661 n y * * | --- discard ---
661 y n y * | --- (3) ---
662 y n y * | --- (4) ---
662 663 y n n * | --- ok ---
663 y y * * | --- (4) ---
664 y y * * | --- (5) ---
664 665
665 666 x = can't happen
666 667 * = don't-care
667 668 1 = abort: not a linear update (merge or update --check to force update)
668 669 2 = abort: crosses branches (use 'hg merge' to merge or
669 670 use 'hg update -C' to discard changes)
670 3 = abort: uncommitted local changes
671 4 = incompatible options (checked in commands.py)
671 3 = abort: uncommitted changes (commit or update --clean to discard changes)
672 4 = abort: uncommitted local changes
673 5 = incompatible options (checked in commands.py)
672 674
673 675 Return the same tuple as applyupdates().
674 676 """
@@ -726,10 +728,14 def update(repo, node, branchmerge, forc
726 728 # note: the <node> variable contains a random identifier
727 729 if repo[node].node() in foreground:
728 730 pa = p1 # allow updating to successors
729 elif dirty:
731 elif dirty and onode is None:
730 732 msg = _("crosses branches (merge branches or use"
731 733 " --clean to discard changes)")
732 734 raise util.Abort(msg)
735 elif dirty:
736 msg = _("uncommitted changes")
737 hint = _("commit or update --clean to discard changes")
738 raise util.Abort(msg, hint=hint)
733 739 else: # node is none
734 740 msg = _("not a linear update")
735 741 hint = _("merge or update --check to force update")
@@ -33,7 +33,8 or delete".
33 33 Should abort:
34 34
35 35 $ hg update -y 1
36 abort: crosses branches (merge branches or use --clean to discard changes)
36 abort: uncommitted changes
37 (commit or update --clean to discard changes)
37 38 [255]
38 39 $ mv c a
39 40
@@ -477,7 +477,8 same subrepo should work if the subrepo
477 477 This is surprising, but is also correct based on the current code:
478 478 $ echo "updating should (maybe) fail" > obstruct/other
479 479 $ hg co tip
480 abort: crosses branches (merge branches or use --clean to discard changes)
480 abort: uncommitted changes
481 (commit or update --clean to discard changes)
481 482 [255]
482 483
483 484 Point to a Subversion branch which has since been deleted and recreated
@@ -123,22 +123,26 Cases are run as shown in that table, ro
123 123 M sub/suba
124 124
125 125 $ revtest 'none dirty same' dirty 2 3
126 abort: crosses branches (merge branches or use --clean to discard changes)
126 abort: uncommitted changes
127 (commit or update --clean to discard changes)
127 128 parent=2
128 129 M foo
129 130
130 131 $ revtest 'none dirtysub same' dirtysub 2 3
131 abort: crosses branches (merge branches or use --clean to discard changes)
132 abort: uncommitted changes
133 (commit or update --clean to discard changes)
132 134 parent=2
133 135 M sub/suba
134 136
135 137 $ revtest 'none dirty cross' dirty 3 4
136 abort: crosses branches (merge branches or use --clean to discard changes)
138 abort: uncommitted changes
139 (commit or update --clean to discard changes)
137 140 parent=3
138 141 M foo
139 142
140 143 $ revtest 'none dirtysub cross' dirtysub 3 4
141 abort: crosses branches (merge branches or use --clean to discard changes)
144 abort: uncommitted changes
145 (commit or update --clean to discard changes)
142 146 parent=3
143 147 M sub/suba
144 148
@@ -223,5 +227,6 Test that 5 is not detected as a valid d
223 227 $ hg up --quiet 0
224 228 $ hg up --quiet 2
225 229 $ hg up 5
226 abort: crosses branches (merge branches or use --clean to discard changes)
230 abort: uncommitted changes
231 (commit or update --clean to discard changes)
227 232 [255]
General Comments 0
You need to be logged in to leave comments. Login now