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