diff mercurial/localrepo.py @ 13723:e615765fdcc7

wireproto: add known([id]) function known([Node]) -> [1/0] Returns 1/0 for each node, indicating whether it's known by the server. Needed for new discovery protocols introduced in later patches.
author Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
date Tue, 22 Mar 2011 09:22:21 +0100
parents 9c4e04fe267e
children b51bf961b3cb
line wrap: on
line diff
--- a/mercurial/localrepo.py	Tue Mar 22 07:40:02 2011 +0100
+++ b/mercurial/localrepo.py	Tue Mar 22 09:22:21 2011 +0100
@@ -20,7 +20,8 @@
 propertycache = util.propertycache
 
 class localrepository(repo.repository):
-    capabilities = set(('lookup', 'changegroupsubset', 'branchmap', 'pushkey'))
+    capabilities = set(('lookup', 'changegroupsubset', 'branchmap', 'pushkey',
+                        'known'))
     supportedformats = set(('revlogv1', 'parentdelta'))
     supported = supportedformats | set(('store', 'fncache', 'shared',
                                         'dotencode'))
@@ -558,6 +559,10 @@
         repo = (remote and remote.local()) and remote or self
         return repo[key].branch()
 
+    def known(self, nodes):
+        nm = self.changelog.nodemap
+        return [(n in nm) for n in nodes]
+
     def local(self):
         return True