# HG changeset patch # User Jun Wu # Date 2017-04-07 00:45:47 # Node ID 4598e8f43e20a2893020252fba02d3e0d8ebd2d8 # Parent 4bafc80f827ee61c43b6a6ea1a7990477384b283 bundlerepo: fix raw handling in revision() Similar to fixes in revlog.py, this patch uses "rawtext" to explicitly label contents expected to be raw, and makes sure content stored in _cache is raw text. Now test-flagprocessor.t points us to another issue. diff --git a/mercurial/bundlerepo.py b/mercurial/bundlerepo.py --- a/mercurial/bundlerepo.py +++ b/mercurial/bundlerepo.py @@ -131,28 +131,28 @@ class bundlerevlog(revlog.revlog): if node == nullid: return "" - text = None + rawtext = None chain = [] iterrev = rev # reconstruct the revision if it is from a changegroup while iterrev > self.repotiprev: if self._cache and self._cache[1] == iterrev: - text = self._cache[2] + rawtext = self._cache[2] break chain.append(iterrev) iterrev = self.index[iterrev][3] - if text is None: - text = self.baserevision(iterrev) + if rawtext is None: + rawtext = self.baserevision(iterrev) while chain: delta = self._chunk(chain.pop()) - text = mdiff.patches(text, [delta]) + rawtext = mdiff.patches(rawtext, [delta]) - text, validatehash = self._processflags(text, self.flags(rev), + text, validatehash = self._processflags(rawtext, self.flags(rev), 'read', raw=raw) if validatehash: self.checkhash(text, node, rev=rev) - self._cache = (node, rev, text) + self._cache = (node, rev, rawtext) return text def baserevision(self, nodeorrev): diff --git a/tests/test-flagprocessor.t b/tests/test-flagprocessor.t --- a/tests/test-flagprocessor.t +++ b/tests/test-flagprocessor.t @@ -188,11 +188,33 @@ 4 changesets found $ hg --config extensions.strip= strip -r 2 --no-backup --force -q $ hg -R bundle.hg log --stat -T '{rev} {desc}\n' base64 2>&1 | egrep -v '^(\*\*| )' - Traceback (most recent call last): - mercurial.mpatch.mpatchError: invalid patch + 5 branching + base64 | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + + 4 base64-4 + base64 | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + + 3 base64-three + base64 | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + + 2 base64-two + base64 | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + + 1 base64-single + base64 | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + + 0 base64-0 + base64 | 1 + + 1 files changed, 1 insertions(+), 0 deletions(-) + $ hg bundle -R bundle.hg --base 1 bundle-again.hg -q 2>&1 | egrep -v '^(\*\*| )' + [1] + $ hg -R bundle-again.hg log --stat -T '{rev} {desc}\n' base64 2>&1 | egrep -v '^(\*\*| )' Traceback (most recent call last): - mercurial.mpatch.mpatchError: invalid patch - $ hg -R bundle-again.hg log --stat -T '{rev} {desc}\n' base64 2>&1 | egrep -v '^(\*\*| )' - abort: repository bundle-again.hg not found! + TypeError: Incorrect padding