[PATCH] merge: report all files in _checkunknown
Idan Kamara
idankk86 at gmail.com
Wed Jan 11 16:27:54 CST 2012
On Wed, Jan 11, 2012 at 11:00 PM, Jordi Gutiérrez Hermoso <
jordigh at octave.org> wrote:
> # HG changeset patch
> # User Jordi Gutiérrez Hermoso <jordigh at octave.org>
> # Date 1326315222 18000
> # Node ID 9fe70ec6cb418daa14fed5f09f94c4f482d4d052
> # Parent c47d69ce5208d5b5cfd2fb2f0f1d7a2b4795fbf5
> merge: report all files in _checkunknown
>
Some suggestions below (without really digging how to kill this function
like Matt said).
>
> When doing hg up, if there is a file conflict with untracked files,
> currently only the first such conflict is reported. With this patch,
> all of them are listed.
>
> Since this requires a list, makes sense to put this list as another
> kwarg to the Abort exception. The hint kwarg is the wrong place for
> it, since it doesn't get displayed correctly for this purpose. I
> displayed this list along with the error in the relevant locations in
> dispatch.py
>
Why not just do the formatting at _checkunknown? It's less intrusive
than adding an error list to util.Abort, which doesn't sound too useful.
>
> With this patch error message is now reported as
>
> abort: untracked file(s) in working directory differ from file(s)
> in requested revision:
> a
> b
>
> instead of
>
> abort: untracked file in working directory differs from file in
> requested revision: 'a'
>
What about:
abort: untracked file in working directory differs from file in
requested revision: 'a', 'b', 'c'
It might be more consistent with the rest of the abort messages.
>
> This is a follow up to an old attempt to do this here:
>
> http://selenic.com/pipermail/mercurial-devel/2011-August/033625.html
>
> diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
> --- a/mercurial/dispatch.py
> +++ b/mercurial/dispatch.py
> @@ -52,6 +52,8 @@
> ferr.write(_("abort: %s\n") % inst)
> if inst.hint:
> ferr.write(_("(%s)\n") % inst.hint)
> + if inst.errlist:
> + ui.warn(" " + "\n ".join(inst.errlist) + "\n")
> return -1
> except error.ParseError, inst:
> if len(inst.args) > 1:
> @@ -154,6 +156,8 @@
> ui.warn(_("abort: %s\n") % inst)
> if inst.hint:
> ui.warn(_("(%s)\n") % inst.hint)
> + if inst.errlist:
> + ui.warn(" " + "\n ".join(inst.errlist) + "\n")
> except ImportError, inst:
> ui.warn(_("abort: %s!\n") % inst)
> m = str(inst).split()[-1]
> diff --git a/mercurial/error.py b/mercurial/error.py
> --- a/mercurial/error.py
> +++ b/mercurial/error.py
> @@ -35,6 +35,7 @@
> def __init__(self, *args, **kw):
> Exception.__init__(self, *args)
> self.hint = kw.get('hint')
> + self.errlist = kw.get('errlist')
>
> class ConfigError(Abort):
> 'Exception raised when parsing config files'
> diff --git a/mercurial/merge.py b/mercurial/merge.py
> --- a/mercurial/merge.py
> +++ b/mercurial/merge.py
> @@ -90,11 +90,16 @@
> folded = {}
> for fn in mctx:
> folded[foldf(fn)] = fn
> +
> + errlist = list()
> for fn in wctx.unknown():
> f = foldf(fn)
> if f in folded and mctx[folded[f]].cmp(wctx[f]):
> - raise util.Abort(_("untracked file in working directory
> differs"
> - " from file in requested revision: '%s'")
> % fn)
> + errlist.append(fn)
> + if errlist:
> + raise util.Abort(_("untracked file(s) in working directory differ"
> + " from file(s) in requested revision: "),
> + errlist=errlist)
>
> def _checkcollision(mctx, wctx):
> "check for case folding collisions in the destination context"
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20120112/8911a5b2/attachment.html>
More information about the Mercurial-devel
mailing list