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