[PATCH 1 of 5 phases] phases: exclude secret when doing a local clone

Pierre-Yves David pierre-yves.david at ens-lyon.org
Thu Jan 12 19:42:03 CST 2012


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at logilab.fr>
# Date 1326299187 -3600
# Node ID 3f56f39a5135f2253bdd8c14afe1e52a08b96ffc
# Parent  c47d69ce5208d5b5cfd2fb2f0f1d7a2b4795fbf5
phases: exclude secret when doing a local clone

This is achieved by denying copy clone when any secret changeset exist.

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -626,6 +626,10 @@
     def local(self):
         return self
 
+    def cancopy(self):
+        return (repo.repository.cancopy(self)
+                and not self._phaseroots[phases.secret])
+
     def join(self, f):
         return os.path.join(self.path, f)
 
diff --git a/tests/test-phases.t b/tests/test-phases.t
--- a/tests/test-phases.t
+++ b/tests/test-phases.t
@@ -164,6 +164,17 @@
   4 changesets found
   $ cd ..
 
+Test secret changeset are not cloned
+(during local clone)
+
+  $ hg clone -qU initialrepo clone-dest
+  $ hglog -R clone-dest
+  4 0 B'
+  3 0 D
+  2 0 C
+  1 0 B
+  0 0 A
+
 Test revset
 
   $ cd initialrepo


More information about the Mercurial-devel mailing list