Patchwork [3,of,3,V2] localrepo: better error message when revlog error and file addition (issue4675)

login
register
mail settings
Submitter Jordi Gutiérrez Hermoso
Date May 28, 2015, 8:49 p.m.
Message ID <6374820d9c459b010d8a.1432846140@Iris>
Download mbox | patch
Permalink /patch/9346/
State Accepted
Delegated to: Augie Fackler
Headers show

Comments

Jordi Gutiérrez Hermoso - May 28, 2015, 8:49 p.m.
# HG changeset patch
# User Jordi Gutiérrez Hermoso <jordigh@octave.org>
# Date 1432239912 14400
#      Thu May 21 16:25:12 2015 -0400
# Node ID 6374820d9c459b010d8ada703c22eed5095f8420
# Parent  ae1b7ac00f0edb3fd9c8d7c4f0076c5becfab2d3
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.
Augie Fackler - May 29, 2015, 2:18 p.m.
On Thu, May 28, 2015 at 04:49:00PM -0400, Jordi Gutiérrez Hermoso wrote:
> # HG changeset patch
> # User Jordi Gutiérrez Hermoso <jordigh@octave.org>
> # Date 1432239912 14400
> #      Thu May 21 16:25:12 2015 -0400
> # Node ID 6374820d9c459b010d8ada703c22eed5095f8420
> # Parent  ae1b7ac00f0edb3fd9c8d7c4f0076c5becfab2d3
> localrepo: better error message when revlog error and file addition (issue4675)

I'm not sure about the hint in patch two, but this seems to commute with that, so I've queued patches 1 and three. Thanks!

>
> 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)
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel

Patch

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)