[PATCH] Bundle repo should be non publishing (issue3266)

pierre-yves.david at logilab.fr pierre-yves.david at logilab.fr
Wed Feb 29 13:41:20 UTC 2012


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at logilab.fr>
# Date 1330522871 -3600
# Branch stable
# Node ID effa83c72469c97ca3bdd64fc444377089e8e472
# Parent  7c75924a69266d58fcbe8a912c877daa440f7dc2
Bundle repo should be non publishing (issue3266)

Bundle repo contains both the bundle content and the content of the repository
used as a base. This create bugs with phases exchange because the "remote"
repository claim to contains changeset it does not. The easiest way to fix this
bug is to ensure a bundle repo as non publishing. This way changeset will be
seen in the same phase than locally.

This patch does not alter in which phase bundle revision are seen. For now they
are seen as if an old client had add them on the remote: They inherit their
phase from parent whatever the parent is. This is to be fixed in a later patch

diff --git a/mercurial/bundlerepo.py b/mercurial/bundlerepo.py
--- a/mercurial/bundlerepo.py
+++ b/mercurial/bundlerepo.py
@@ -166,10 +166,11 @@ class bundlerepository(localrepo.localre
             localrepo.localrepository.__init__(self, ui, path)
         except error.RepoError:
             self._tempparent = tempfile.mkdtemp()
             localrepo.instance(ui, self._tempparent, 1)
             localrepo.localrepository.__init__(self, ui, self._tempparent)
+        self.ui.setconfig('phases', 'publish', False)
 
         if path:
             self._url = 'bundle:' + util.expandpath(path) + '+' + bundlename
         else:
             self._url = 'bundle:' + bundlename
diff --git a/tests/test-phases-exchange.t b/tests/test-phases-exchange.t
--- a/tests/test-phases-exchange.t
+++ b/tests/test-phases-exchange.t
@@ -463,10 +463,42 @@ initial setup
   o  1 public a-B - 548a3d25dbf0
   |
   o  0 public a-A - 054250a37db4
   
 
+Pulling from bundle does not alter phases of changeset not present in the bundle
+
+  $ hg bundle  --base 1 -r 6 -r 3 ../partial-bundle.hg
+  5 changesets found
+  $ hg pull ../partial-bundle.hg
+  pulling from ../partial-bundle.hg
+  searching for changes
+  no changes found
+  $ hgph
+  @  10 draft a-H - 967b449fbc94
+  |
+  | o  9 draft a-G - 3e27b6f1eee1
+  | |
+  | o  8 draft a-F - b740e3e5c05d
+  | |
+  | o  7 draft a-E - e9f537e46dea
+  | |
+  +---o  6 public n-B - 145e75495359
+  | |
+  o |  5 public n-A - d6bcb4f74035
+  | |
+  o |  4 public b-A - f54f1bb90ff3
+  | |
+  | o  3 public a-D - b555f63b6063
+  | |
+  | o  2 public a-C - 54acac6f23ab
+  |/
+  o  1 public a-B - 548a3d25dbf0
+  |
+  o  0 public a-A - 054250a37db4
+  
+
 Pushing to Publish=False (unknown changeset)
 
   $ hg push ../mu -r b740e3e5c05d # a-F
   pushing to ../mu
   searching for changes



More information about the Mercurial-devel mailing list