changeset 17671:fdd0fc046cf1

clfilter: introduce a `hassecret` function We can only use copy clone if the cloned repo do not have any secret changeset. The current method for that is to run the "secret()" revset on the remote repo. But with proper filtering of hidden or unserved revision by the remote this revset won't return any revision even if some exist remotely. This changeset adds an explicit function to know if a repo have any secret revision or not. The other option would be to disable filtering for the query but I prefer the approach above, lighter both regarding code and performance.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Mon, 03 Sep 2012 14:05:19 +0200
parents 9dbd5fa6d301
children 474047947b8f
files mercurial/hg.py mercurial/phases.py
diffstat 2 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hg.py	Mon Sep 03 14:03:38 2012 +0200
+++ b/mercurial/hg.py	Mon Sep 03 14:05:19 2012 +0200
@@ -10,7 +10,7 @@
 from lock import release
 from node import hex, nullid
 import localrepo, bundlerepo, httppeer, sshpeer, statichttprepo, bookmarks
-import lock, util, extensions, error, node, scmutil
+import lock, util, extensions, error, node, scmutil, phases
 import cmdutil, discovery
 import merge as mergemod
 import verify as verifymod
@@ -303,7 +303,7 @@
 
         copy = False
         if (srcrepo and srcrepo.cancopy() and islocal(dest)
-            and not srcrepo.revs("secret()")):
+            and not phases.hassecret(srcrepo)):
             copy = not pull and not rev
 
         if copy:
--- a/mercurial/phases.py	Mon Sep 03 14:03:38 2012 +0200
+++ b/mercurial/phases.py	Mon Sep 03 14:05:19 2012 +0200
@@ -388,3 +388,6 @@
             msg = _("phases.new-commit: not a valid phase name ('%s')")
             raise error.ConfigError(msg % v)
 
+def hassecret(repo):
+    """utility function that check if a repo have any secret changeset."""
+    return bool(repo._phasecache.phaseroots[2])