##// END OF EJS Templates
outgoing: add a 'missingroots' argument...
Pierre-Yves David -
r29806:82e8c86c default
parent child Browse files
Show More
@@ -942,7 +942,7 b' def changegroupsubset(repo, roots, heads'
942 942 Another wrinkle is doing the reverse, figuring out which changeset in
943 943 the changegroup a particular filenode or manifestnode belongs to.
944 944 """
945 outgoing = discovery.outgoingbetween(repo, roots, heads)
945 outgoing = discovery.outgoing(repo, missingroots=roots, missingheads=heads)
946 946 bundler = getbundler(version, repo)
947 947 return getsubset(repo, outgoing, bundler, source)
948 948
@@ -76,11 +76,25 b' class outgoing(object):'
76 76 The sets are computed on demand from the heads, unless provided upfront
77 77 by discovery.'''
78 78
79 def __init__(self, repo, commonheads=None, missingheads=None):
79 def __init__(self, repo, commonheads=None, missingheads=None,
80 missingroots=None):
81 # at least one of them must not be set
82 assert None in (commonheads, missingroots)
80 83 cl = repo.changelog
81 84 if not missingheads:
82 85 missingheads = cl.heads()
83 if not commonheads:
86 if missingroots:
87 discbases = []
88 for n in missingroots:
89 discbases.extend([p for p in cl.parents(n) if p != nullid])
90 # TODO remove call to nodesbetween.
91 # TODO populate attributes on outgoing instance instead of setting
92 # discbases.
93 csets, roots, heads = cl.nodesbetween(missingroots, missingheads)
94 included = set(csets)
95 missingheads = heads
96 commonheads = [n for n in discbases if n not in included]
97 elif not commonheads:
84 98 commonheads = [nullid]
85 99 self.commonheads = commonheads
86 100 self.missingheads = missingheads
@@ -106,27 +120,6 b' class outgoing(object):'
106 120 self._computecommonmissing()
107 121 return self._missing
108 122
109 def outgoingbetween(repo, roots, heads):
110 """create an ``outgoing`` consisting of nodes between roots and heads
111
112 The ``missing`` nodes will be descendants of any of the ``roots`` and
113 ancestors of any of the ``heads``, both are which are defined as a list
114 of binary nodes.
115 """
116 cl = repo.changelog
117 if not roots:
118 roots = [nullid]
119 discbases = []
120 for n in roots:
121 discbases.extend([p for p in cl.parents(n) if p != nullid])
122 # TODO remove call to nodesbetween.
123 # TODO populate attributes on outgoing instance instead of setting
124 # discbases.
125 csets, roots, heads = cl.nodesbetween(roots, heads)
126 included = set(csets)
127 discbases = [n for n in discbases if n not in included]
128 return outgoing(repo, discbases, heads)
129
130 123 def findcommonoutgoing(repo, other, onlyheads=None, force=False,
131 124 commoninc=None, portable=False):
132 125 '''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