Show More
@@ -21,10 +21,12 b' class pushoperation(object):' | |||
|
21 | 21 | afterward. |
|
22 | 22 | """ |
|
23 | 23 | |
|
24 | def __init__(self, repo): | |
|
24 | def __init__(self, repo, remote): | |
|
25 | 25 | # repo we push from |
|
26 | 26 | self.repo = repo |
|
27 | 27 | self.ui = repo.ui |
|
28 | # repo we push to | |
|
29 | self.remote = remote | |
|
28 | 30 | |
|
29 | 31 | def push(repo, remote, force=False, revs=None, newbranch=False): |
|
30 | 32 | '''Push outgoing changesets (limited by revs) from a local |
@@ -35,9 +37,10 b' def push(repo, remote, force=False, revs' | |||
|
35 | 37 | we have outgoing changesets but refused to push |
|
36 | 38 | - other values as described by addchangegroup() |
|
37 | 39 | ''' |
|
38 | pushop = pushoperation(repo) | |
|
39 | if remote.local(): | |
|
40 |
missing = set(pushop.repo.requirements) |
|
|
40 | pushop = pushoperation(repo, remote) | |
|
41 | if pushop.remote.local(): | |
|
42 | missing = (set(pushop.repo.requirements) | |
|
43 | - pushop.remote.local().supported) | |
|
41 | 44 | if missing: |
|
42 | 45 | msg = _("required features are not" |
|
43 | 46 | " supported in the destination:" |
@@ -52,7 +55,7 b' def push(repo, remote, force=False, revs' | |||
|
52 | 55 | # unbundle assumes local user cannot lock remote repo (new ssh |
|
53 | 56 | # servers, http servers). |
|
54 | 57 | |
|
55 | if not remote.canpush(): | |
|
58 | if not pushop.remote.canpush(): | |
|
56 | 59 | raise util.Abort(_("destination does not support push")) |
|
57 | 60 | unfi = pushop.repo.unfiltered() |
|
58 | 61 | def localphasemove(nodes, phase=phases.public): |
@@ -83,16 +86,16 b' def push(repo, remote, force=False, revs' | |||
|
83 | 86 | try: |
|
84 | 87 | pushop.repo.checkpush(force, revs) |
|
85 | 88 | lock = None |
|
86 | unbundle = remote.capable('unbundle') | |
|
89 | unbundle = pushop.remote.capable('unbundle') | |
|
87 | 90 | if not unbundle: |
|
88 | lock = remote.lock() | |
|
91 | lock = pushop.remote.lock() | |
|
89 | 92 | try: |
|
90 | 93 | # discovery |
|
91 | 94 | fci = discovery.findcommonincoming |
|
92 | commoninc = fci(unfi, remote, force=force) | |
|
95 | commoninc = fci(unfi, pushop.remote, force=force) | |
|
93 | 96 | common, inc, remoteheads = commoninc |
|
94 | 97 | fco = discovery.findcommonoutgoing |
|
95 | outgoing = fco(unfi, remote, onlyheads=revs, | |
|
98 | outgoing = fco(unfi, pushop.remote, onlyheads=revs, | |
|
96 | 99 | commoninc=commoninc, force=force) |
|
97 | 100 | |
|
98 | 101 | |
@@ -126,7 +129,7 b' def push(repo, remote, force=False, revs' | |||
|
126 | 129 | % (ctx.troubles()[0], |
|
127 | 130 | ctx)) |
|
128 | 131 | newbm = pushop.ui.configlist('bookmarks', 'pushing') |
|
129 | discovery.checkheads(unfi, remote, outgoing, | |
|
132 | discovery.checkheads(unfi, pushop.remote, outgoing, | |
|
130 | 133 | remoteheads, newbranch, |
|
131 | 134 | bool(inc), newbm) |
|
132 | 135 | |
@@ -156,11 +159,12 b' def push(repo, remote, force=False, revs' | |||
|
156 | 159 | remoteheads = ['force'] |
|
157 | 160 | # ssh: return remote's addchangegroup() |
|
158 | 161 | # http: return remote's addchangegroup() or 0 for error |
|
159 | ret = remote.unbundle(cg, remoteheads, 'push') | |
|
162 | ret = pushop.remote.unbundle(cg, remoteheads, 'push') | |
|
160 | 163 | else: |
|
161 | 164 | # we return an integer indicating remote head count |
|
162 | 165 | # change |
|
163 |
ret = remote.addchangegroup(cg, 'push', |
|
|
166 | ret = pushop.remote.addchangegroup(cg, 'push', | |
|
167 | pushop.repo.url()) | |
|
164 | 168 | |
|
165 | 169 | if ret: |
|
166 | 170 | # push succeed, synchronize target of the push |
@@ -193,7 +197,7 b' def push(repo, remote, force=False, revs' | |||
|
193 | 197 | outgoing.missing) |
|
194 | 198 | cheads.extend(c.node() for c in revset) |
|
195 | 199 | # even when we don't push, exchanging phase data is useful |
|
196 | remotephases = remote.listkeys('phases') | |
|
200 | remotephases = pushop.remote.listkeys('phases') | |
|
197 | 201 | if (pushop.ui.configbool('ui', '_usedassubrepo', False) |
|
198 | 202 | and remotephases # server supports phases |
|
199 | 203 | and ret is None # nothing was pushed |
@@ -229,15 +233,15 b' def push(repo, remote, force=False, revs' | |||
|
229 | 233 | outdated = unfi.set('heads((%ln::%ln) and public())', |
|
230 | 234 | droots, cheads) |
|
231 | 235 | for newremotehead in outdated: |
|
232 | r = remote.pushkey('phases', | |
|
233 | newremotehead.hex(), | |
|
234 | str(phases.draft), | |
|
235 | str(phases.public)) | |
|
236 | r = pushop.remote.pushkey('phases', | |
|
237 | newremotehead.hex(), | |
|
238 | str(phases.draft), | |
|
239 | str(phases.public)) | |
|
236 | 240 | if not r: |
|
237 | 241 | pushop.ui.warn(_('updating %s to public failed!\n') |
|
238 | 242 | % newremotehead) |
|
239 | 243 | pushop.ui.debug('try to push obsolete markers to remote\n') |
|
240 | obsolete.syncpush(pushop.repo, remote) | |
|
244 | obsolete.syncpush(pushop.repo, pushop.remote) | |
|
241 | 245 | finally: |
|
242 | 246 | if lock is not None: |
|
243 | 247 | lock.release() |
@@ -245,5 +249,5 b' def push(repo, remote, force=False, revs' | |||
|
245 | 249 | if locallock is not None: |
|
246 | 250 | locallock.release() |
|
247 | 251 | |
|
248 | bookmarks.updateremote(pushop.ui, unfi, remote, revs) | |
|
252 | bookmarks.updateremote(pushop.ui, unfi, pushop.remote, revs) | |
|
249 | 253 | return ret |
General Comments 0
You need to be logged in to leave comments.
Login now