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.
--- a/mercurial/bundlerepo.py Thu Apr 06 18:06:42 2017 -0700
+++ b/mercurial/bundlerepo.py Thu Apr 06 17:45:47 2017 -0700
@@ -131,28 +131,28 @@
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):
--- a/tests/test-flagprocessor.t Thu Apr 06 18:06:42 2017 -0700
+++ b/tests/test-flagprocessor.t Thu Apr 06 17:45:47 2017 -0700
@@ -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