Show More
@@ -4024,6 +4024,14 b' def merge(ui, repo, node=None, **opts):' | |||||
4024 | return hg.merge(repo, node, force=force, mergeforce=force, |
|
4024 | return hg.merge(repo, node, force=force, mergeforce=force, | |
4025 | labels=labels, abort=abort) |
|
4025 | labels=labels, abort=abort) | |
4026 |
|
4026 | |||
|
4027 | statemod.addunfinished( | |||
|
4028 | 'merge', fname=None, clearable=True, allowcommit=True, | |||
|
4029 | cmdmsg=_('outstanding uncommitted merge'), abortfunc=hg.abortmerge, | |||
|
4030 | statushint=_('To continue: hg commit\n' | |||
|
4031 | 'To abort: hg merge --abort'), | |||
|
4032 | cmdhint=_("use 'hg commit' or 'hg merge --abort'") | |||
|
4033 | ) | |||
|
4034 | ||||
4027 | @command('outgoing|out', |
|
4035 | @command('outgoing|out', | |
4028 | [('f', 'force', None, _('run even when the destination is unrelated')), |
|
4036 | [('f', 'force', None, _('run even when the destination is unrelated')), | |
4029 | ('r', 'rev', [], |
|
4037 | ('r', 'rev', [], |
@@ -956,31 +956,35 b' def merge(repo, node, force=None, remind' | |||||
956 | abort=False): |
|
956 | abort=False): | |
957 | """Branch merge with node, resolving changes. Return true if any |
|
957 | """Branch merge with node, resolving changes. Return true if any | |
958 | unresolved conflicts.""" |
|
958 | unresolved conflicts.""" | |
959 |
if |
|
959 | if abort: | |
960 | stats = mergemod.update(repo, node, branchmerge=True, force=force, |
|
960 | return abortmerge(repo.ui, repo, labels=labels) | |
961 | mergeforce=mergeforce, labels=labels) |
|
|||
962 | else: |
|
|||
963 | ms = mergemod.mergestate.read(repo) |
|
|||
964 | if ms.active(): |
|
|||
965 | # there were conflicts |
|
|||
966 | node = ms.localctx.hex() |
|
|||
967 | else: |
|
|||
968 | # there were no conficts, mergestate was not stored |
|
|||
969 | node = repo['.'].hex() |
|
|||
970 |
|
961 | |||
971 | repo.ui.status(_("aborting the merge, updating back to" |
|
962 | stats = mergemod.update(repo, node, branchmerge=True, force=force, | |
972 | " %s\n") % node[:12]) |
|
963 | mergeforce=mergeforce, labels=labels) | |
973 | stats = mergemod.update(repo, node, branchmerge=False, force=True, |
|
|||
974 | labels=labels) |
|
|||
975 |
|
||||
976 | _showstats(repo, stats) |
|
964 | _showstats(repo, stats) | |
977 | if stats.unresolvedcount: |
|
965 | if stats.unresolvedcount: | |
978 | repo.ui.status(_("use 'hg resolve' to retry unresolved file merges " |
|
966 | repo.ui.status(_("use 'hg resolve' to retry unresolved file merges " | |
979 | "or 'hg merge --abort' to abandon\n")) |
|
967 | "or 'hg merge --abort' to abandon\n")) | |
980 |
elif remind |
|
968 | elif remind: | |
981 | repo.ui.status(_("(branch merge, don't forget to commit)\n")) |
|
969 | repo.ui.status(_("(branch merge, don't forget to commit)\n")) | |
982 | return stats.unresolvedcount > 0 |
|
970 | return stats.unresolvedcount > 0 | |
983 |
|
971 | |||
|
972 | def abortmerge(ui, repo, labels=None): | |||
|
973 | ms = mergemod.mergestate.read(repo) | |||
|
974 | if ms.active(): | |||
|
975 | # there were conflicts | |||
|
976 | node = ms.localctx.hex() | |||
|
977 | else: | |||
|
978 | # there were no conficts, mergestate was not stored | |||
|
979 | node = repo['.'].hex() | |||
|
980 | ||||
|
981 | repo.ui.status(_("aborting the merge, updating back to" | |||
|
982 | " %s\n") % node[:12]) | |||
|
983 | stats = mergemod.update(repo, node, branchmerge=False, force=True, | |||
|
984 | labels=labels) | |||
|
985 | _showstats(repo, stats) | |||
|
986 | return stats.unresolvedcount > 0 | |||
|
987 | ||||
984 | def _incoming(displaychlist, subreporecurse, ui, repo, source, |
|
988 | def _incoming(displaychlist, subreporecurse, ui, repo, source, | |
985 | opts, buffered=False): |
|
989 | opts, buffered=False): | |
986 | """ |
|
990 | """ |
@@ -205,13 +205,6 b' addunfinished(' | |||||
205 | 'To mark the changeset bad: hg bisect --bad\n' |
|
205 | 'To mark the changeset bad: hg bisect --bad\n' | |
206 | 'To abort: hg bisect --reset\n') |
|
206 | 'To abort: hg bisect --reset\n') | |
207 | ) |
|
207 | ) | |
208 | addunfinished( |
|
|||
209 | 'merge', fname=None, clearable=True, allowcommit=True, |
|
|||
210 | cmdmsg=_('outstanding uncommitted merge'), |
|
|||
211 | statushint=_('To continue: hg commit\n' |
|
|||
212 | 'To abort: hg merge --abort'), |
|
|||
213 | cmdhint=_("use 'hg commit' or 'hg merge --abort'") |
|
|||
214 | ) |
|
|||
215 |
|
208 | |||
216 | def getrepostate(repo): |
|
209 | def getrepostate(repo): | |
217 | # experimental config: commands.status.skipstates |
|
210 | # experimental config: commands.status.skipstates |
@@ -1,3 +1,11 b'' | |||||
|
1 | #testcases abortcommand abortflag | |||
|
2 | #if abortflag | |||
|
3 | $ cat >> $HGRCPATH <<EOF | |||
|
4 | > [alias] | |||
|
5 | > abort = merge --abort | |||
|
6 | > EOF | |||
|
7 | #endif | |||
|
8 | ||||
1 | $ addcommit () { |
|
9 | $ addcommit () { | |
2 | > echo $1 > $1 |
|
10 | > echo $1 > $1 | |
3 | > hg add $1 |
|
11 | > hg add $1 | |
@@ -36,9 +44,11 b' State before the merge' | |||||
36 |
|
44 | |||
37 | Testing the abort functionality first in case of conflicts |
|
45 | Testing the abort functionality first in case of conflicts | |
38 |
|
46 | |||
39 |
$ hg |
|
47 | $ hg abort | |
40 | abort: no merge in progress |
|
48 | abort: no merge in progress (abortflag !) | |
|
49 | abort: no operation in progress (abortcommand !) | |||
41 | [255] |
|
50 | [255] | |
|
51 | ||||
42 | $ hg merge |
|
52 | $ hg merge | |
43 | merging A |
|
53 | merging A | |
44 | warning: conflicts while merging A! (edit, then use 'hg resolve --mark') |
|
54 | warning: conflicts while merging A! (edit, then use 'hg resolve --mark') | |
@@ -53,7 +63,13 b' Testing the abort functionality first in' | |||||
53 | abort: cannot specify both --rev and --abort |
|
63 | abort: cannot specify both --rev and --abort | |
54 | [255] |
|
64 | [255] | |
55 |
|
65 | |||
56 | $ hg merge --abort |
|
66 | #if abortcommand | |
|
67 | when in dry-run mode | |||
|
68 | $ hg abort --dry-run | |||
|
69 | merge in progress, will be aborted | |||
|
70 | #endif | |||
|
71 | ||||
|
72 | $ hg abort | |||
57 | aborting the merge, updating back to e45016d2b3d3 |
|
73 | aborting the merge, updating back to e45016d2b3d3 | |
58 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
74 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
59 |
|
75 | |||
@@ -131,7 +147,7 b' Testing the abort functionality in case ' | |||||
131 | abort: cannot specify --preview with --abort |
|
147 | abort: cannot specify --preview with --abort | |
132 | [255] |
|
148 | [255] | |
133 |
|
149 | |||
134 |
$ hg |
|
150 | $ hg abort | |
135 | aborting the merge, updating back to 68352a18a7c4 |
|
151 | aborting the merge, updating back to 68352a18a7c4 | |
136 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
152 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
137 |
|
153 |
@@ -718,11 +718,16 b' Unshelve --abort works with a corrupted ' | |||||
718 |
|
718 | |||
719 | Unshelve --abort fails with appropriate message if there's no unshelve in |
|
719 | Unshelve --abort fails with appropriate message if there's no unshelve in | |
720 | progress |
|
720 | progress | |
|
721 | ||||
|
722 | #if abortflag | |||
|
723 | $ hg unshelve --abort | |||
|
724 | abort: no unshelve in progress | |||
|
725 | [255] | |||
|
726 | #else | |||
721 | $ hg abort |
|
727 | $ hg abort | |
722 | abort: no unshelve in progress (abortflag !) |
|
728 | aborting the merge, updating back to 9451eaa6eee3 | |
723 | abort: merge in progress but does not support 'hg abort' (no-abortflag !) |
|
729 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
724 | (use 'hg commit' or 'hg merge --abort') (no-abortflag !) |
|
730 | #endif | |
725 | [255] |
|
|||
726 | $ cd .. |
|
731 | $ cd .. | |
727 |
|
732 | |||
728 | Unshelve respects --keep even if user intervention is needed |
|
733 | Unshelve respects --keep even if user intervention is needed |
General Comments 0
You need to be logged in to leave comments.
Login now