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

login
register
mail settings
Submitter Jordi Gutiérrez Hermoso
Date May 21, 2015, 8:30 p.m.
Message ID <0fb37fa049f0eb3a2e02.1432240222@Iris>
Download mbox | patch
Permalink /patch/9220/
State Accepted
Delegated to: Augie Fackler
Headers show

Comments

Jordi Gutiérrez Hermoso - May 21, 2015, 8:30 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 0fb37fa049f0eb3a2e0284cb10a20bcf711cd26f
# Parent  94b79351d9569b65c3c111cbfe88a03112d617a9
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.

Patch

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1344,7 +1344,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)