##// END OF EJS Templates
update: improve error message for dirty non-linear update with rev
Siddharth Agarwal -
r19800:4894e0d9 default
parent child Browse files
Show More
@@ -666,8 +666,8 b' def update(repo, node, branchmerge, forc'
666 x = can't happen
666 x = can't happen
667 * = don't-care
667 * = don't-care
668 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)
669 2 = abort: crosses branches (use 'hg merge' to merge or
669 2 = abort: uncommitted changes (commit and merge, or update --clean to
670 use 'hg update -C' to discard changes)
670 discard changes)
671 3 = abort: uncommitted changes (commit or update --clean to discard changes)
671 3 = abort: uncommitted changes (commit or update --clean to discard changes)
672 4 = abort: uncommitted local changes
672 4 = abort: uncommitted local changes
673 5 = incompatible options (checked in commands.py)
673 5 = incompatible options (checked in commands.py)
@@ -728,13 +728,14 b' def update(repo, node, branchmerge, forc'
728 # note: the <node> variable contains a random identifier
728 # note: the <node> variable contains a random identifier
729 if repo[node].node() in foreground:
729 if repo[node].node() in foreground:
730 pa = p1 # allow updating to successors
730 pa = p1 # allow updating to successors
731 elif dirty and onode is None:
732 msg = _("crosses branches (merge branches or use"
733 " --clean to discard changes)")
734 raise util.Abort(msg)
735 elif dirty:
731 elif dirty:
736 msg = _("uncommitted changes")
732 msg = _("uncommitted changes")
737 hint = _("commit or update --clean to discard changes")
733 if onode is None:
734 hint = _("commit and merge, or update --clean to"
735 " discard changes")
736 else:
737 hint = _("commit or update --clean to discard"
738 " changes")
738 raise util.Abort(msg, hint=hint)
739 raise util.Abort(msg, hint=hint)
739 else: # node is none
740 else: # node is none
740 msg = _("not a linear update")
741 msg = _("not a linear update")
@@ -167,7 +167,8 b' create a second head'
167 summary: 2
167 summary: 2
168
168
169 $ hg --debug up
169 $ hg --debug up
170 abort: crosses branches (merge branches or use --clean to discard changes)
170 abort: uncommitted changes
171 (commit and merge, or update --clean to discard changes)
171 [255]
172 [255]
172 $ hg --debug merge
173 $ hg --debug merge
173 abort: outstanding uncommitted changes
174 abort: outstanding uncommitted changes
@@ -140,6 +140,12 b' Cases are run as shown in that table, ro'
140 parent=3
140 parent=3
141 M foo
141 M foo
142
142
143 $ norevtest 'none dirty cross' dirty 2
144 abort: uncommitted changes
145 (commit and merge, or update --clean to discard changes)
146 parent=2
147 M foo
148
143 $ revtest 'none dirtysub cross' dirtysub 3 4
149 $ revtest 'none dirtysub cross' dirtysub 3 4
144 abort: uncommitted changes
150 abort: uncommitted changes
145 (commit or update --clean to discard changes)
151 (commit or update --clean to discard changes)
General Comments 0
You need to be logged in to leave comments. Login now