--all to guard 'hg resolve' from mis-operation
Giorgos Keramidas
keramida at ceid.upatras.gr
Wed Dec 17 05:43:23 CST 2008
On Wed, 17 Dec 2008 08:54:34 +0100, "Dirkjan Ochtman" <dirkjan at ochtman.nl> wrote:
> On Wed, Dec 17, 2008 at 07:20, FUJIWARA Katsunori <fujiwara at ascade.co.jp> wrote:
>> I think that '--all' should be introduced into 'hg resolve' like as
>> 'hg revert' to guard from mis-operation, at least for '-m'/'-u' and
>> re-merge(no-opt).
>
> I think this is a good idea. Is this recent enough that we can change
> it like this?
I like the idea too, but a bit of extra thought may be nice, to avoid
changing this yet again after a short time.
Right now the default behavior of `hg merge' is to resolve all the files
if there are conflicts. How would the new --all option interact with
the case of merges that currently spawn a resolve run automatically?
Should `hg merge' be changed to inhibit auto-resolution when we add the
--all option? I think it would make sense to do that, and change the
default behavior of "hg merge" to do something like:
[1] Try to auto-merge
[2] If a resolve would be needed, keep resolving files but mark the
merge as 'incomplete'
[3] When all files from the two heads have been merged, check if the
merge is 'incomplete'
[4] If yes, then display a message like:
> hg up -C head1
> hg merge
9 files updated, 0 files merged, 0 files removed, 5 files unresolved
(run "hg resolve --all" or "hg resolve FILE" to complete the merge)
Maybe something like the following patch?
%%%
diff -r 4acf5f24912b mercurial/commands.py
--- a/mercurial/commands.py Mon Dec 15 12:03:28 2008 -0800
+++ b/mercurial/commands.py Wed Dec 17 13:42:28 2008 +0200
@@ -2341,8 +2341,15 @@
The codes used to show the status of files are:
U = unresolved
R = resolved
+
+ If names are given, all files matching the names are reverted.
+ If no arguments are given, no files are reverted.
"""
+ if not pats and not opts.get('all') and not opts.get('list'):
+ raise util.Abort(_('no files or directories specified; '
+ 'use --all to resolve all remaining files'))
+
if len([x for x in opts if opts[x]]) > 1:
raise util.Abort(_("too many options specified"))
@@ -3315,7 +3322,8 @@
_('[OPTION]... SOURCE... DEST')),
"resolve":
(resolve,
- [('l', 'list', None, _('list state of files needing merge')),
+ [('a', 'all', None, _('resolve all remaining files')),
+ ('l', 'list', None, _('list state of files needing merge')),
('m', 'mark', None, _('mark files as resolved')),
('u', 'unmark', None, _('unmark files as resolved'))],
_('[OPTION]... [FILE]...')),
diff -r 4acf5f24912b mercurial/hg.py
--- a/mercurial/hg.py Mon Dec 15 12:03:28 2008 -0800
+++ b/mercurial/hg.py Wed Dec 17 13:42:28 2008 +0200
@@ -273,7 +273,7 @@
stats = _merge.update(repo, node, True, force, False)
_showstats(repo, stats)
if stats[3]:
- repo.ui.status(_("use 'hg resolve' to retry unresolved file merges\n"))
+ repo.ui.status(_("use 'hg resolve --all' or 'hg resolve FILE' to retry unresolved file merges\n"))
elif remind:
repo.ui.status(_("(branch merge, don't forget to commit)\n"))
return stats[3] > 0
%%%
More information about the Mercurial-devel
mailing list