diff mercurial/wireproto.py @ 17205:97eff00046de

repo: move visibleheads and visiblebranchmap logic in discovery They were previously inside the mercurial.phases module, but obsolete logic will need them to exclude `extinct` changesets from pull and push. The proper and planned way to implement such filtering is still to apply a changelog level filtering. But we are far to late in the cycle to implement and push such a critical piece of code (changelog filtering). With Matt Mackall approval I'm extending this quick and dirty mechanism for obsolete purpose. Changelog level filtering should come during the next release cycle.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Tue, 17 Jul 2012 01:22:31 +0200
parents 1ac628cd7113
children d3f84ccc5495
line wrap: on
line diff
--- a/mercurial/wireproto.py	Tue Jul 17 01:04:45 2012 +0200
+++ b/mercurial/wireproto.py	Tue Jul 17 01:22:31 2012 +0200
@@ -10,7 +10,7 @@
 from node import bin, hex
 import changegroup as changegroupmod
 import peer, error, encoding, util, store
-import phases
+import discovery, phases
 
 # abstract batching support
 
@@ -397,7 +397,7 @@
     return "".join(r)
 
 def branchmap(repo, proto):
-    branchmap = phases.visiblebranchmap(repo)
+    branchmap = discovery.visiblebranchmap(repo)
     heads = []
     for branch, nodes in branchmap.iteritems():
         branchname = urllib.quote(encoding.fromlocal(branch))
@@ -453,7 +453,7 @@
     return streamres(proto.groupchunks(cg))
 
 def heads(repo, proto):
-    h = phases.visibleheads(repo)
+    h = discovery.visibleheads(repo)
     return encodelist(h) + "\n"
 
 def hello(repo, proto):
@@ -556,7 +556,7 @@
     their_heads = decodelist(heads)
 
     def check_heads():
-        heads = phases.visibleheads(repo)
+        heads = discovery.visibleheads(repo)
         heads_hash = util.sha1(''.join(sorted(heads))).digest()
         return (their_heads == ['force'] or their_heads == heads or
                 their_heads == ['hashed', heads_hash])