Patchwork [08,of,10] bundlerepo: use revlog._checkhash

login
register
mail settings
Submitter Mads Kiilerich
Date Jan. 16, 2013, 7:57 p.m.
Message ID <61031b4e9ac4ab381814.1358366252@mk-desktop>
Download mbox | patch
Permalink /patch/668/
State Accepted
Commit 610706715778415bf31976d4e59682e01a62214d
Headers show

Comments

Mads Kiilerich - Jan. 16, 2013, 7:57 p.m.
# HG changeset patch
# User Mads Kiilerich <madski@unity3d.com>
# Date 1358365301 -3600
# Node ID 61031b4e9ac4ab381814398489771f53f0ca9751
# Parent  f58e4e7dc9819af9b0766fc98472435208bdc1b5
bundlerepo: use revlog._checkhash

The error message will mention datafile instead of indexfile.
tonfa - Jan. 16, 2013, 8:29 p.m.
LGTM


On Wed, Jan 16, 2013 at 8:57 PM, Mads Kiilerich <mads@kiilerich.com> wrote:

> # HG changeset patch
> # User Mads Kiilerich <madski@unity3d.com>
> # Date 1358365301 -3600
> # Node ID 61031b4e9ac4ab381814398489771f53f0ca9751
> # Parent  f58e4e7dc9819af9b0766fc98472435208bdc1b5
> bundlerepo: use revlog._checkhash
>
> The error message will mention datafile instead of indexfile.
>
> diff --git a/mercurial/bundlerepo.py b/mercurial/bundlerepo.py
> --- a/mercurial/bundlerepo.py
> +++ b/mercurial/bundlerepo.py
> @@ -129,11 +129,7 @@
>              delta = self._chunk(chain.pop())
>              text = mdiff.patches(text, [delta])
>
> -        p1, p2 = self.parents(node)
> -        if node != revlog.hash(text, p1, p2):
> -            raise error.RevlogError(_("integrity check failed on %s:%d")
> -                                     % (self.datafile, rev))
> -
> +        self._checkhash(text, node, rev)
>          self._cache = (node, rev, text)
>          return text
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
>

Patch

diff --git a/mercurial/bundlerepo.py b/mercurial/bundlerepo.py
--- a/mercurial/bundlerepo.py
+++ b/mercurial/bundlerepo.py
@@ -129,11 +129,7 @@ 
             delta = self._chunk(chain.pop())
             text = mdiff.patches(text, [delta])
 
-        p1, p2 = self.parents(node)
-        if node != revlog.hash(text, p1, p2):
-            raise error.RevlogError(_("integrity check failed on %s:%d")
-                                     % (self.datafile, rev))
-
+        self._checkhash(text, node, rev)
         self._cache = (node, rev, text)
         return text