[PATCH 3 of 3 STABLE] bundlerepo: make secret revisions visible, if bundle bases on current local repo

FUJIWARA Katsunori foozy at lares.dti.ne.jp
Tue May 28 10:02:54 CDT 2013


# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1369753172 -32400
#      Tue May 28 23:59:32 2013 +0900
# Branch stable
# Node ID d4f555c8059a0a514d60a8ad887954e6b2b462b3
# Parent  b36954ea6f53c20a428d3503ee2964457bea21a2
bundlerepo: make secret revisions visible, if bundle bases on current local repo

Before this patch, "hg incoming" may not show the revisions in the
bundle, even though they are restored by "hg unbundle". For example:

    1. there are two secret revision: A and its descendant B

    2. "hg strip B" saves it into backup bundle

    3. "hg incoming" with backup bundle above doesn't show B, because
       parent of it (A) is secret and hidden

    4. "hg unbundle" with backup bundle restores B, though

This patch makes secret revisions visible at "hg incoming" , if
"other" is "bundlepeer" and it bases on current local repository.

diff --git a/mercurial/bundlerepo.py b/mercurial/bundlerepo.py
--- a/mercurial/bundlerepo.py
+++ b/mercurial/bundlerepo.py
@@ -337,7 +337,12 @@
       the changes; it closes both the original "other" and the one returned
       here.
     '''
-    tmp = discovery.findcommonincoming(repo, other, heads=onlyheads,
+    if isinstance(other, bundlepeer) and repo.path == other.local().path:
+        local = repo.unfiltered()
+        other = other.unfiltered()
+    else:
+        local = repo
+    tmp = discovery.findcommonincoming(local, other, heads=onlyheads,
                                        force=force)
     common, incoming, rheads = tmp
     if not incoming:
diff --git a/tests/test-bundle.t b/tests/test-bundle.t
--- a/tests/test-bundle.t
+++ b/tests/test-bundle.t
@@ -44,6 +44,28 @@
   searching for changes
   no changes found (ignored 9 secret changesets)
   [1]
+
+  $ hg -R test --config extensions.mq= -q strip 8
+  $ mv test/.hg/strip-backup/aa35859c02ea-backup.hg ./backup.hg
+
+  $ hg -R test incoming bundle:backup.hg
+  comparing with bundle:backup.hg
+  searching for changes
+  changeset:   8:aa35859c02ea
+  tag:         tip
+  parent:      3:eebf5a27f8ca
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     0.3m
+  
+
+  $ hg -R empty incoming bundle:test+backup.hg
+  comparing with bundle:test+backup.hg
+  no changes found
+  [1]
+
+  $ hg -R test -q unbundle backup.hg
+  $ hg -R test -q update tip
   $ hg -R test phase --draft -r 'head()'
 
 Bundle --all


More information about the Mercurial-devel mailing list