mercurial/changegroup.py
changeset 21260 aa3e56607675
parent 21153 53ee02b54e53
child 22041 97f86ce79abe
--- a/mercurial/changegroup.py	Wed May 07 17:24:19 2014 -0700
+++ b/mercurial/changegroup.py	Wed May 07 17:22:34 2014 -0700
@@ -493,6 +493,25 @@
     bundler = bundle10(repo, bundlecaps)
     return getsubset(repo, outgoing, bundler, source)
 
+def _computeoutgoing(repo, heads, common):
+    """Computes which revs are outgoing given a set of common
+    and a set of heads.
+
+    This is a separate function so extensions can have access to
+    the logic.
+
+    Returns a discovery.outgoing object.
+    """
+    cl = repo.changelog
+    if common:
+        hasnode = cl.hasnode
+        common = [n for n in common if hasnode(n)]
+    else:
+        common = [nullid]
+    if not heads:
+        heads = cl.heads()
+    return discovery.outgoing(cl, common, heads)
+
 def getbundle(repo, source, heads=None, common=None, bundlecaps=None):
     """Like changegroupsubset, but returns the set difference between the
     ancestors of heads and the ancestors common.
@@ -502,15 +521,7 @@
     The nodes in common might not all be known locally due to the way the
     current discovery protocol works.
     """
-    cl = repo.changelog
-    if common:
-        hasnode = cl.hasnode
-        common = [n for n in common if hasnode(n)]
-    else:
-        common = [nullid]
-    if not heads:
-        heads = cl.heads()
-    outgoing = discovery.outgoing(cl, common, heads)
+    outgoing = _computeoutgoing(repo, heads, common)
     return getlocalbundle(repo, source, outgoing, bundlecaps=bundlecaps)
 
 def changegroup(repo, basenodes, source):