[PATCH 3 of 3 V3] localrepo: better error message when revlog error and file addition (issue4675)

Matt Mackall mpm at selenic.com
Wed Jun 3 15:20:25 CDT 2015


On Tue, 2015-06-02 at 15:07 -0400, Jordi GutiƩrrez Hermoso wrote:
> # HG changeset patch
> # User Jordi GutiƩrrez Hermoso <jordigh at octave.org>
> # Date 1432239912 14400
> #      Thu May 21 16:25:12 2015 -0400
> # Node ID 6299517509f9a8912ff83fffa46cecf964ba779c
> # Parent  3353bc00fbb14f2930cf0e9b72be312e578d2f6e
> localrepo: better error message when revlog error and file addition (issue4675)
> 
> At this level we have enough context for saying which filename caused
> the revlog error, and we can also add the hint from the revlog
> exception, if any.
> 
> diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
> --- a/mercurial/localrepo.py
> +++ b/mercurial/localrepo.py
> @@ -1348,7 +1348,10 @@ class localrepository(object):
>          text = fctx.data()
>          if fparent2 != nullid or flog.cmp(fparent1, text) or meta:
>              changelist.append(fname)
> -            return flog.add(text, meta, tr, linkrev, fparent1, fparent2)
> +            try:
> +                return flog.add(text, meta, tr, linkrev, fparent1, fparent2)
> +            except error.RevlogError as exc:
> +                raise util.Abort("%s: %s" % (exc, fname), hint=exc.hint)
>          # are just the flags changed during merge?
>          elif fname in manifest1 and manifest1.flags(fname) != fctx.flags():
>              changelist.append(fname)

Looks like the wrong layer for this. Either belongs in
revlog._addrevision (where it'll catch changelog and manifest overflows
too) or filelog.add.

-- 
Mathematics is the supreme nostalgia of our time.



More information about the Mercurial-devel mailing list