changeset 24882:995003a324da stable

bundlerepo: disable filtering of changelog while constructing revision text This avoids the following error that happened if base revision of bundle file was hidden. bundlerevlog needs it to construct revision texts from bundle content as revlog.revision() does. File "mercurial/context.py", line 485, in _changeset return self._repo.changelog.read(self.rev()) File "mercurial/changelog.py", line 319, in read text = self.revision(node) File "mercurial/bundlerepo.py", line 124, in revision text = self.baserevision(iterrev) File "mercurial/bundlerepo.py", line 160, in baserevision return changelog.changelog.revision(self, nodeorrev) File "mercurial/revlog.py", line 1041, in revision node = self.node(rev) File "mercurial/changelog.py", line 211, in node raise error.FilteredIndexError(rev) mercurial.error.FilteredIndexError: 1
author Yuya Nishihara <yuya@tcha.org>
date Wed, 29 Apr 2015 19:47:37 +0900
parents 51844b8b5017
children 09049042ab99
files mercurial/bundlerepo.py tests/test-obsolete.t
diffstat 2 files changed, 65 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/bundlerepo.py	Wed Apr 29 15:52:31 2015 -0400
+++ b/mercurial/bundlerepo.py	Wed Apr 29 19:47:37 2015 +0900
@@ -157,7 +157,15 @@
         # Although changelog doesn't override 'revision' method, some extensions
         # may replace this class with another that does. Same story with
         # manifest and filelog classes.
-        return changelog.changelog.revision(self, nodeorrev)
+
+        # This bypasses filtering on changelog.node() and rev() because we need
+        # revision text of the bundle base even if it is hidden.
+        oldfilter = self.filteredrevs
+        try:
+            self.filteredrevs = ()
+            return changelog.changelog.revision(self, nodeorrev)
+        finally:
+            self.filteredrevs = oldfilter
 
 class bundlemanifest(bundlerevlog, manifest.manifest):
     def __init__(self, opener, bundle, linkmapper):
--- a/tests/test-obsolete.t	Wed Apr 29 15:52:31 2015 -0400
+++ b/tests/test-obsolete.t	Wed Apr 29 19:47:37 2015 +0900
@@ -789,6 +789,62 @@
   visible                            0:193e9254ce7e
   tip                                0:193e9254ce7e
 
+Test bundle overlay onto hidden revision
+
+  $ cd ..
+  $ hg init repo-bundleoverlay
+  $ cd repo-bundleoverlay
+  $ echo "A" > foo
+  $ hg ci -Am "A"
+  adding foo
+  $ echo "B" >> foo
+  $ hg ci -m "B"
+  $ hg up 0
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ echo "C" >> foo
+  $ hg ci -m "C"
+  created new head
+  $ hg log -G
+  @  2:c186d7714947 (draft) [tip ] C
+  |
+  | o  1:44526ebb0f98 (draft) [ ] B
+  |/
+  o  0:4b34ecfb0d56 (draft) [ ] A
+  
+
+  $ hg clone -r1 . ../other-bundleoverlay
+  adding changesets
+  adding manifests
+  adding file changes
+  added 2 changesets with 2 changes to 1 files
+  updating to branch default
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cd ../other-bundleoverlay
+  $ echo "B+" >> foo
+  $ hg ci --amend -m "B+"
+  $ hg log -G --hidden
+  @  3:b7d587542d40 (draft) [tip ] B+
+  |
+  | x  2:eb95e9297e18 (draft) [ ] temporary amend commit for 44526ebb0f98
+  | |
+  | x  1:44526ebb0f98 (draft) [ ] B
+  |/
+  o  0:4b34ecfb0d56 (draft) [ ] A
+  
+
+  $ hg incoming ../repo-bundleoverlay --bundle ../bundleoverlay.hg
+  comparing with ../repo-bundleoverlay
+  searching for changes
+  1:44526ebb0f98 (draft) [ ] B
+  2:c186d7714947 (draft) [tip ] C
+  $ hg log -G -R ../bundleoverlay.hg
+  o  4:c186d7714947 (draft) [tip ] C
+  |
+  | @  3:b7d587542d40 (draft) [ ] B+
+  |/
+  o  0:4b34ecfb0d56 (draft) [ ] A
+  
+
 #if serve
 
 Test issue 4506