[PATCH 2 of 3 phases] phases: on copy clone, do not copy phases data if repote is publishing

Pierre-Yves David pierre-yves.david at ens-lyon.org
Mon Dec 26 17:47:19 CST 2011


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1324903711 -3600
# Node ID 82a5069b8562ce5b94f4b5433d17b58562261b0f
# Parent  c577fc8bbd66385b9fff47b3a3f0194ead0b97b5
phases: on copy clone, do not copy phases data if repote is publishing

diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -183,7 +183,10 @@
     try:
         hardlink = None
         num = 0
+        srcpublishing = srcrepo.ui.configbool('phases', 'publish', True)
         for f in srcrepo.store.copylist():
+            if srcpublishing and f.endswith('phaseroots'):
+                continue
             src = os.path.join(srcrepo.sharedpath, f)
             dst = os.path.join(destpath, f)
             dstbase = os.path.dirname(dst)
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
@@ -589,3 +589,21 @@
   1 0 a-B - 548a3d25dbf0
   0 0 a-A - 054250a37db4
 
+2. cloning publishing repository
+
+(everything should be public)
+
+  $ hg clone -U alpha Upsilon
+  $ hgph -R Upsilon
+  11 0 A-secret - 435b5d83910c
+  10 0 a-H - 967b449fbc94
+  9 0 a-G - 3e27b6f1eee1
+  8 0 a-F - b740e3e5c05d
+  7 0 a-E - e9f537e46dea
+  6 0 n-B - 145e75495359
+  5 0 n-A - d6bcb4f74035
+  4 0 b-A - f54f1bb90ff3
+  3 0 a-D - b555f63b6063
+  2 0 a-C - 54acac6f23ab
+  1 0 a-B - 548a3d25dbf0
+  0 0 a-A - 054250a37db4


More information about the Mercurial-devel mailing list