Show More
@@ -85,6 +85,39 class pushoperation(object): | |||||
85 | """future remote heads if the changeset push succeeds""" |
|
85 | """future remote heads if the changeset push succeeds""" | |
86 | return self.outgoing.missingheads |
|
86 | return self.outgoing.missingheads | |
87 |
|
87 | |||
|
88 | @util.propertycache | |||
|
89 | def fallbackheads(self): | |||
|
90 | """future remote heads if the changeset push fails""" | |||
|
91 | if self.revs is None: | |||
|
92 | # not target to push, all common are relevant | |||
|
93 | return self.outgoing.commonheads | |||
|
94 | unfi = self.repo.unfiltered() | |||
|
95 | # I want cheads = heads(::missingheads and ::commonheads) | |||
|
96 | # (missingheads is revs with secret changeset filtered out) | |||
|
97 | # | |||
|
98 | # This can be expressed as: | |||
|
99 | # cheads = ( (missingheads and ::commonheads) | |||
|
100 | # + (commonheads and ::missingheads))" | |||
|
101 | # ) | |||
|
102 | # | |||
|
103 | # while trying to push we already computed the following: | |||
|
104 | # common = (::commonheads) | |||
|
105 | # missing = ((commonheads::missingheads) - commonheads) | |||
|
106 | # | |||
|
107 | # We can pick: | |||
|
108 | # * missingheads part of common (::commonheads) | |||
|
109 | common = set(self.outgoing.common) | |||
|
110 | nm = self.repo.changelog.nodemap | |||
|
111 | cheads = [node for node in self.revs if nm[node] in common] | |||
|
112 | # and | |||
|
113 | # * commonheads parents on missing | |||
|
114 | revset = unfi.set('%ln and parents(roots(%ln))', | |||
|
115 | self.outgoing.commonheads, | |||
|
116 | self.outgoing.missing) | |||
|
117 | cheads.extend(c.node() for c in revset) | |||
|
118 | return cheads | |||
|
119 | ||||
|
120 | ||||
88 | def push(repo, remote, force=False, revs=None, newbranch=False): |
|
121 | def push(repo, remote, force=False, revs=None, newbranch=False): | |
89 | '''Push outgoing changesets (limited by revs) from a local |
|
122 | '''Push outgoing changesets (limited by revs) from a local | |
90 | repository to remote. Return an integer: |
|
123 | repository to remote. Return an integer: | |
@@ -313,36 +346,10 def _pushchangeset(pushop): | |||||
313 | pushop.ret = pushop.remote.addchangegroup(cg, 'push', pushop.repo.url()) |
|
346 | pushop.ret = pushop.remote.addchangegroup(cg, 'push', pushop.repo.url()) | |
314 |
|
347 | |||
315 | def _pushcomputecommonheads(pushop): |
|
348 | def _pushcomputecommonheads(pushop): | |
316 | unfi = pushop.repo.unfiltered() |
|
|||
317 | if pushop.ret: |
|
349 | if pushop.ret: | |
318 | cheads = pushop.futureheads |
|
350 | cheads = pushop.futureheads | |
319 | elif pushop.revs is None: |
|
|||
320 | # All out push fails. synchronize all common |
|
|||
321 | cheads = pushop.outgoing.commonheads |
|
|||
322 | else: |
|
351 | else: | |
323 | # I want cheads = heads(::missingheads and ::commonheads) |
|
352 | cheads = pushop.fallbackheads | |
324 | # (missingheads is revs with secret changeset filtered out) |
|
|||
325 | # |
|
|||
326 | # This can be expressed as: |
|
|||
327 | # cheads = ( (missingheads and ::commonheads) |
|
|||
328 | # + (commonheads and ::missingheads))" |
|
|||
329 | # ) |
|
|||
330 | # |
|
|||
331 | # while trying to push we already computed the following: |
|
|||
332 | # common = (::commonheads) |
|
|||
333 | # missing = ((commonheads::missingheads) - commonheads) |
|
|||
334 | # |
|
|||
335 | # We can pick: |
|
|||
336 | # * missingheads part of common (::commonheads) |
|
|||
337 | common = set(pushop.outgoing.common) |
|
|||
338 | nm = pushop.repo.changelog.nodemap |
|
|||
339 | cheads = [node for node in pushop.revs if nm[node] in common] |
|
|||
340 | # and |
|
|||
341 | # * commonheads parents on missing |
|
|||
342 | revset = unfi.set('%ln and parents(roots(%ln))', |
|
|||
343 | pushop.outgoing.commonheads, |
|
|||
344 | pushop.outgoing.missing) |
|
|||
345 | cheads.extend(c.node() for c in revset) |
|
|||
346 | pushop.commonheads = cheads |
|
353 | pushop.commonheads = cheads | |
347 |
|
354 | |||
348 | def _pushsyncphase(pushop): |
|
355 | def _pushsyncphase(pushop): |
General Comments 0
You need to be logged in to leave comments.
Login now