##// END OF EJS Templates
discovery: move code to create outgoing from roots and heads...
Gregory Szorc -
r29690:5684bc42 default
parent child Browse files
Show More
@@ -946,17 +946,7 b' def changegroupsubset(repo, roots, heads'
946 Another wrinkle is doing the reverse, figuring out which changeset in
946 Another wrinkle is doing the reverse, figuring out which changeset in
947 the changegroup a particular filenode or manifestnode belongs to.
947 the changegroup a particular filenode or manifestnode belongs to.
948 """
948 """
949 cl = repo.changelog
949 outgoing = discovery.outgoingbetween(repo, roots, heads)
950 if not roots:
951 roots = [nullid]
952 discbases = []
953 for n in roots:
954 discbases.extend([p for p in cl.parents(n) if p != nullid])
955 # TODO: remove call to nodesbetween.
956 csets, roots, heads = cl.nodesbetween(roots, heads)
957 included = set(csets)
958 discbases = [n for n in discbases if n not in included]
959 outgoing = discovery.outgoing(cl, discbases, heads)
960 bundler = getbundler(version, repo)
950 bundler = getbundler(version, repo)
961 return getsubset(repo, outgoing, bundler, source)
951 return getsubset(repo, outgoing, bundler, source)
962
952
@@ -101,6 +101,27 b' class outgoing(object):'
101 self._computecommonmissing()
101 self._computecommonmissing()
102 return self._missing
102 return self._missing
103
103
104 def outgoingbetween(repo, roots, heads):
105 """create an ``outgoing`` consisting of nodes between roots and heads
106
107 The ``missing`` nodes will be descendants of any of the ``roots`` and
108 ancestors of any of the ``heads``, both are which are defined as a list
109 of binary nodes.
110 """
111 cl = repo.changelog
112 if not roots:
113 roots = [nullid]
114 discbases = []
115 for n in roots:
116 discbases.extend([p for p in cl.parents(n) if p != nullid])
117 # TODO remove call to nodesbetween.
118 # TODO populate attributes on outgoing instance instead of setting
119 # discbases.
120 csets, roots, heads = cl.nodesbetween(roots, heads)
121 included = set(csets)
122 discbases = [n for n in discbases if n not in included]
123 return outgoing(cl, discbases, heads)
124
104 def findcommonoutgoing(repo, other, onlyheads=None, force=False,
125 def findcommonoutgoing(repo, other, onlyheads=None, force=False,
105 commoninc=None, portable=False):
126 commoninc=None, portable=False):
106 '''Return an outgoing instance to identify the nodes present in repo but
127 '''Return an outgoing instance to identify the nodes present in repo but
General Comments 0
You need to be logged in to leave comments. Login now