##// END OF EJS Templates
push: move push return value in the push object...
Pierre-Yves David -
r20439:0d3ccf28 default
parent child Browse files
Show More
@@ -35,6 +35,13 b' class pushoperation(object):'
35 self.newbranch = newbranch
35 self.newbranch = newbranch
36 # did a local lock get acquired?
36 # did a local lock get acquired?
37 self.locallocked = None
37 self.locallocked = None
38 # Integer version of the push result
39 # - None means nothing to push
40 # - 0 means HTTP error
41 # - 1 means we pushed and remote head count is unchanged *or*
42 # we have outgoing changesets but refused to push
43 # - other values as described by addchangegroup()
44 self.ret = None
38
45
39 def push(repo, remote, force=False, revs=None, newbranch=False):
46 def push(repo, remote, force=False, revs=None, newbranch=False):
40 '''Push outgoing changesets (limited by revs) from a local
47 '''Push outgoing changesets (limited by revs) from a local
@@ -99,7 +106,6 b' def push(repo, remote, force=False, revs'
99 if not outgoing.missing:
106 if not outgoing.missing:
100 # nothing to push
107 # nothing to push
101 scmutil.nochangesfound(unfi.ui, unfi, outgoing.excluded)
108 scmutil.nochangesfound(unfi.ui, unfi, outgoing.excluded)
102 ret = None
103 else:
109 else:
104 # something to push
110 # something to push
105 if not pushop.force:
111 if not pushop.force:
@@ -156,14 +162,15 b' def push(repo, remote, force=False, revs'
156 remoteheads = ['force']
162 remoteheads = ['force']
157 # ssh: return remote's addchangegroup()
163 # ssh: return remote's addchangegroup()
158 # http: return remote's addchangegroup() or 0 for error
164 # http: return remote's addchangegroup() or 0 for error
159 ret = pushop.remote.unbundle(cg, remoteheads, 'push')
165 pushop.ret = pushop.remote.unbundle(cg, remoteheads,
166 'push')
160 else:
167 else:
161 # we return an integer indicating remote head count
168 # we return an integer indicating remote head count
162 # change
169 # change
163 ret = pushop.remote.addchangegroup(cg, 'push',
170 pushop.ret = pushop.remote.addchangegroup(cg, 'push',
164 pushop.repo.url())
171 pushop.repo.url())
165
172
166 if ret:
173 if pushop.ret:
167 # push succeed, synchronize target of the push
174 # push succeed, synchronize target of the push
168 cheads = outgoing.missingheads
175 cheads = outgoing.missingheads
169 elif pushop.revs is None:
176 elif pushop.revs is None:
@@ -197,7 +204,7 b' def push(repo, remote, force=False, revs'
197 remotephases = pushop.remote.listkeys('phases')
204 remotephases = pushop.remote.listkeys('phases')
198 if (pushop.ui.configbool('ui', '_usedassubrepo', False)
205 if (pushop.ui.configbool('ui', '_usedassubrepo', False)
199 and remotephases # server supports phases
206 and remotephases # server supports phases
200 and ret is None # nothing was pushed
207 and pushop.ret is None # nothing was pushed
201 and remotephases.get('publishing', False)):
208 and remotephases.get('publishing', False)):
202 # When:
209 # When:
203 # - this is a subrepo push
210 # - this is a subrepo push
@@ -246,7 +253,7 b' def push(repo, remote, force=False, revs'
246 locallock.release()
253 locallock.release()
247
254
248 _pushbookmark(pushop)
255 _pushbookmark(pushop)
249 return ret
256 return pushop.ret
250
257
251 def _localphasemove(pushop, nodes, phase=phases.public):
258 def _localphasemove(pushop, nodes, phase=phases.public):
252 """move <nodes> to <phase> in the local source repo"""
259 """move <nodes> to <phase> in the local source repo"""
General Comments 0
You need to be logged in to leave comments. Login now