Show More
@@ -21,7 +21,7 b' class pushoperation(object):' | |||
|
21 | 21 | afterward. |
|
22 | 22 | """ |
|
23 | 23 | |
|
24 | def __init__(self, repo, remote, force=False): | |
|
24 | def __init__(self, repo, remote, force=False, revs=None): | |
|
25 | 25 | # repo we push from |
|
26 | 26 | self.repo = repo |
|
27 | 27 | self.ui = repo.ui |
@@ -29,6 +29,8 b' class pushoperation(object):' | |||
|
29 | 29 | self.remote = remote |
|
30 | 30 | # force option provided |
|
31 | 31 | self.force = force |
|
32 | # revs to be pushed (None is "all") | |
|
33 | self.revs = revs | |
|
32 | 34 | |
|
33 | 35 | def push(repo, remote, force=False, revs=None, newbranch=False): |
|
34 | 36 | '''Push outgoing changesets (limited by revs) from a local |
@@ -39,7 +41,7 b' def push(repo, remote, force=False, revs' | |||
|
39 | 41 | we have outgoing changesets but refused to push |
|
40 | 42 | - other values as described by addchangegroup() |
|
41 | 43 | ''' |
|
42 | pushop = pushoperation(repo, remote, force) | |
|
44 | pushop = pushoperation(repo, remote, force, revs) | |
|
43 | 45 | if pushop.remote.local(): |
|
44 | 46 | missing = (set(pushop.repo.requirements) |
|
45 | 47 | - pushop.remote.local().supported) |
@@ -86,7 +88,7 b' def push(repo, remote, force=False, revs' | |||
|
86 | 88 | msg = 'cannot lock source repository: %s\n' % err |
|
87 | 89 | pushop.ui.debug(msg) |
|
88 | 90 | try: |
|
89 | pushop.repo.checkpush(pushop.force, revs) | |
|
91 | pushop.repo.checkpush(pushop.force, pushop.revs) | |
|
90 | 92 | lock = None |
|
91 | 93 | unbundle = pushop.remote.capable('unbundle') |
|
92 | 94 | if not unbundle: |
@@ -97,7 +99,7 b' def push(repo, remote, force=False, revs' | |||
|
97 | 99 | commoninc = fci(unfi, pushop.remote, force=pushop.force) |
|
98 | 100 | common, inc, remoteheads = commoninc |
|
99 | 101 | fco = discovery.findcommonoutgoing |
|
100 | outgoing = fco(unfi, pushop.remote, onlyheads=revs, | |
|
102 | outgoing = fco(unfi, pushop.remote, onlyheads=pushop.revs, | |
|
101 | 103 | commoninc=commoninc, force=pushop.force) |
|
102 | 104 | |
|
103 | 105 | |
@@ -138,7 +140,7 b' def push(repo, remote, force=False, revs' | |||
|
138 | 140 | # TODO: get bundlecaps from remote |
|
139 | 141 | bundlecaps = None |
|
140 | 142 | # create a changegroup from local |
|
141 | if revs is None and not (outgoing.excluded | |
|
143 | if pushop.revs is None and not (outgoing.excluded | |
|
142 | 144 | or pushop.repo.changelog.filteredrevs): |
|
143 | 145 | # push everything, |
|
144 | 146 | # use the fast path, no race possible on push |
@@ -171,7 +173,7 b' def push(repo, remote, force=False, revs' | |||
|
171 | 173 | if ret: |
|
172 | 174 | # push succeed, synchronize target of the push |
|
173 | 175 | cheads = outgoing.missingheads |
|
174 | elif revs is None: | |
|
176 | elif pushop.revs is None: | |
|
175 | 177 | # All out push fails. synchronize all common |
|
176 | 178 | cheads = outgoing.commonheads |
|
177 | 179 | else: |
@@ -191,7 +193,7 b' def push(repo, remote, force=False, revs' | |||
|
191 | 193 | # * missingheads part of common (::commonheads) |
|
192 | 194 | common = set(outgoing.common) |
|
193 | 195 | nm = pushop.repo.changelog.nodemap |
|
194 | cheads = [node for node in revs if nm[node] in common] | |
|
196 | cheads = [node for node in pushop.revs if nm[node] in common] | |
|
195 | 197 | # and |
|
196 | 198 | # * commonheads parents on missing |
|
197 | 199 | revset = unfi.set('%ln and parents(roots(%ln))', |
@@ -251,5 +253,5 b' def push(repo, remote, force=False, revs' | |||
|
251 | 253 | if locallock is not None: |
|
252 | 254 | locallock.release() |
|
253 | 255 | |
|
254 | bookmarks.updateremote(pushop.ui, unfi, pushop.remote, revs) | |
|
256 | bookmarks.updateremote(pushop.ui, unfi, pushop.remote, pushop.revs) | |
|
255 | 257 | return ret |
General Comments 0
You need to be logged in to leave comments.
Login now