[PATCH 1 of 5] resolve: when pats do not match, hint about path: [RFC]

Augie Fackler raf at durin42.com
Tue Jan 5 16:47:27 UTC 2016


On Thu, Dec 24, 2015 at 03:03:04PM -0600, timeless wrote:
> # HG changeset patch
> # User timeless <timeless at mozdev.org>
> # Date 1450931494 0
> #      Thu Dec 24 04:31:34 2015 +0000
> # Node ID 99bb0f0a91660f1ec6aa355221c64e6349a1836a
> # Parent  e2aa9c4030c4109e5efa50462ffc6048ca30106f
> resolve: when pats do not match, hint about path: [RFC]

patches 2-5 are queued, thanks. I'm not really thrilled with the hint
using 'resolve ... path:...'. I feel like it could be a little clearer
as something like 'resolve [flags] path:[pathset]' or something might
be clearer.

>
> --tear here--
> I don't really like resolve's output at all...
>
> 1. If none of the arguments match, it seems to me that the exit
> code should be non-zero to hint to users that things didn't
> go as expected.
>
> That's a behavior change, and I'm not sure people
> would really benefit from it.
>
> 2. It's not very helpful. This commit would at least
> have it suggest what command the user could use to
> try again.
>
> 3. When you're done resolving, it really should tell you
> what command to do next, e.g. "use `hg commit` to finalize
> your merge", or "`hg graft/rebase/histedit --cont` to continue"
>
> This commit covers #2
> The remainder of this series covers #3
>
> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -5979,7 +5979,17 @@
>          ms.recordactions()
>
>          if not didwork and pats:
> +            hint = None
> +            if not any([p for p in pats if p.find(':') >= 0]):
> +                pats = ['path:%s' % p for p in pats]
> +                m = scmutil.match(wctx, pats, opts)
> +                for f in ms:
> +                    if not m(f):
> +                        continue
> +                    hint = _("try: hg resolve ... path:...'\n")
>              ui.warn(_("arguments do not match paths that need resolving\n"))
> +            if hint:
> +                ui.warn(hint)
>          elif ms.mergedriver and ms.mdstate() != 's':
>              # run conclude step when either a driver-resolved file is requested
>              # or there are no driver-resolved files
> diff --git a/tests/test-resolve.t b/tests/test-resolve.t
> --- a/tests/test-resolve.t
> +++ b/tests/test-resolve.t
> @@ -53,6 +53,16 @@
>    arguments do not match paths that need resolving
>    $ hg resolve -l does-not-exist
>
> +tell users how they could have used resolve
> +
> +  $ mkdir nested
> +  $ cd nested
> +  $ hg resolve -m file1
> +  arguments do not match paths that need resolving
> +  try: hg resolve ... path:...'
> +  $ cd ..
> +  $ rmdir nested
> +
>  don't allow marking or unmarking driver-resolved files
>
>    $ cat > $TESTTMP/markdriver.py << EOF
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list