Mercurial > public > mercurial-scm > hg
comparison mercurial/merge.py @ 19799:ab3e42225dbc
update: add error message for dirty non-linear update with no rev
Previously, the error message for a dirty non-linear update was the same (and
relatively unhelpful) whether or not a rev was specified. This patch and an
upcoming one will introduce separate, more helpful hints.
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Mon, 23 Sep 2013 20:07:30 -0700 |
parents | 76df01e56e7f |
children | 4894e0d9462d |
comparison
equal
deleted
inserted
replaced
19798:76df01e56e7f | 19799:ab3e42225dbc |
---|---|
654 This logic is tested by test-update-branches.t. | 654 This logic is tested by test-update-branches.t. |
655 | 655 |
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 """ |
675 | 677 |
676 onode = node | 678 onode = node |
724 # amount of call to obsolete.background. | 726 # amount of call to obsolete.background. |
725 foreground = obsolete.foreground(repo, [p1.node()]) | 727 foreground = obsolete.foreground(repo, [p1.node()]) |
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") |
736 raise util.Abort(msg, hint=hint) | 742 raise util.Abort(msg, hint=hint) |
737 else: | 743 else: |