phases: exclude secret when doing a local clone
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Wed, 11 Jan 2012 17:26:27 +0100
changeset 15888 2072e4031994
parent 15887 12dea4d998ec
child 15889 816209eaf963
phases: exclude secret when doing a local clone This is achieved by denying copy clone when any secret changeset exist.
mercurial/localrepo.py
tests/test-phases.t
--- a/mercurial/localrepo.py	Fri Jan 13 02:30:43 2012 +0100
+++ b/mercurial/localrepo.py	Wed Jan 11 17:26:27 2012 +0100
@@ -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)
 
--- a/tests/test-phases.t	Fri Jan 13 02:30:43 2012 +0100
+++ b/tests/test-phases.t	Wed Jan 11 17:26:27 2012 +0100
@@ -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