Show More
@@ -18,6 +18,7 b' from . import (' | |||
|
18 | 18 | bookmarks, |
|
19 | 19 | branchmap, |
|
20 | 20 | error, |
|
21 | node as nodemod, | |
|
21 | 22 | obsolete, |
|
22 | 23 | phases, |
|
23 | 24 | pycompat, |
@@ -98,29 +99,50 b' class outgoing:' | |||
|
98 | 99 | def __init__( |
|
99 | 100 | self, repo, commonheads=None, ancestorsof=None, missingroots=None |
|
100 | 101 | ): |
|
101 |
# at |
|
|
102 | assert None in (commonheads, missingroots) | |
|
102 | # at most one of them must not be set | |
|
103 | if commonheads is not None and missingroots is not None: | |
|
104 | m = 'commonheads and missingroots arguments are mutually exclusive' | |
|
105 | raise error.ProgrammingError(m) | |
|
103 | 106 | cl = repo.changelog |
|
107 | missing = None | |
|
108 | common = None | |
|
104 | 109 | if ancestorsof is None: |
|
105 | 110 | ancestorsof = cl.heads() |
|
106 | 111 | if missingroots: |
|
107 | 112 | # TODO remove call to nodesbetween. |
|
108 | # TODO populate attributes on outgoing instance instead of setting | |
|
109 | # discbases. | |
|
110 | csets, roots, heads = cl.nodesbetween(missingroots, ancestorsof) | |
|
111 |
|
|
|
112 | discbases = [] | |
|
113 | for n in csets: | |
|
114 | discbases.extend([p for p in cl.parents(n) if p != repo.nullid]) | |
|
115 | ancestorsof = heads | |
|
116 | commonheads = [n for n in discbases if n not in included] | |
|
113 | missing_rev = repo.revs('%ln::%ln', missingroots, ancestorsof) | |
|
114 | unfi = repo.unfiltered() | |
|
115 | ucl = unfi.changelog | |
|
116 | to_node = ucl.node | |
|
117 | ancestorsof = [to_node(r) for r in ucl.headrevs(missing_rev)] | |
|
118 | parent_revs = ucl.parentrevs | |
|
119 | common_legs = set() | |
|
120 | for r in missing_rev: | |
|
121 | p1, p2 = parent_revs(r) | |
|
122 | if p1 not in missing_rev: | |
|
123 | common_legs.add(p1) | |
|
124 | if p2 not in missing_rev: | |
|
125 | common_legs.add(p2) | |
|
126 | common_legs.discard(nodemod.nullrev) | |
|
127 | if not common_legs: | |
|
128 | commonheads = [repo.nullid] | |
|
129 | common = set() | |
|
130 | else: | |
|
131 | commonheads_revs = unfi.revs( | |
|
132 | 'heads(%ld::%ld)', | |
|
133 | common_legs, | |
|
134 | common_legs, | |
|
135 | ) | |
|
136 | commonheads = [to_node(r) for r in commonheads_revs] | |
|
137 | common = ucl.ancestors(commonheads_revs, inclusive=True) | |
|
138 | missing = [to_node(r) for r in missing_rev] | |
|
117 | 139 | elif not commonheads: |
|
118 | 140 | commonheads = [repo.nullid] |
|
119 | 141 | self.commonheads = commonheads |
|
120 | 142 | self.ancestorsof = ancestorsof |
|
121 | 143 | self._revlog = cl |
|
122 |
self._common = |
|
|
123 |
self._missing = |
|
|
144 | self._common = common | |
|
145 | self._missing = missing | |
|
124 | 146 | self.excluded = [] |
|
125 | 147 | |
|
126 | 148 | def _computecommonmissing(self): |
General Comments 0
You need to be logged in to leave comments.
Login now