# HG changeset patch # User Yuya Nishihara # Date 2015-04-29 10:47:37 # Node ID 995003a324da67242e5c4e9afa18fe9d335f9985 # Parent 51844b8b5017658216129c1817af1a816e44b8bf 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 diff --git a/mercurial/bundlerepo.py b/mercurial/bundlerepo.py --- a/mercurial/bundlerepo.py +++ b/mercurial/bundlerepo.py @@ -157,7 +157,15 @@ class bundlechangelog(bundlerevlog, chan # 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): diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t --- a/tests/test-obsolete.t +++ b/tests/test-obsolete.t @@ -789,6 +789,62 @@ Test that removing a local tag does not 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