[PATCH v2] resolve: when pats do not match, hint about path:

Yuya Nishihara yuya at tcha.org
Sat Mar 5 03:44:54 EST 2016


On Wed, 02 Mar 2016 17:24:00 -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 ca46c80b3a467484a951ee6c0bf9ae3063e91d8a
> # Parent  c7f89ad87baef87f00c507545dfd4cc824bc3131
> resolve: when pats do not match, hint about path:
> 
> Suggest a command that would probably work.
> 
> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -5939,8 +5939,9 @@
>      Returns 0 on success, 1 if any files fail a resolve attempt.
>      """
>  
> +    flaglist = 'all mark unmark list no_status'.split()
>      all, mark, unmark, show, nostatus = \
> -        [opts.get(o) for o in 'all mark unmark list no_status'.split()]
> +        [opts.get(o) for o in flaglist]
>  
>      if (show and (mark or unmark)) or (mark and unmark):
>          raise error.Abort(_("too many options specified"))
> @@ -6069,7 +6070,22 @@
>          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
> +                    flags = ''.join(['-%s ' % o[0] for o in flaglist
> +                                                   if opts.get(o)])
> +                    hint = _("(try: hg resolve %s%s)\n") % (
> +                             flags,
> +                             ' '.join(pats))
> +                    break
>              ui.warn(_("arguments do not match paths that need resolving\n"))
> +            if hint:
> +                ui.warn(hint)

I don't get the point. "hg resolve" does nothing special on paths handling.
Is it common to specify a repository path in place of a relative path?


More information about the Mercurial-devel mailing list