##// END OF EJS Templates
push: ease access to current ui object...
Pierre-Yves David -
r20347:3ec5f833 default
parent child Browse files
Show More
@@ -24,6 +24,7 b' class pushoperation(object):'
24 def __init__(self, repo):
24 def __init__(self, repo):
25 # repo we push from
25 # repo we push from
26 self.repo = repo
26 self.repo = repo
27 self.ui = repo.ui
27
28
28 def push(repo, remote, force=False, revs=None, newbranch=False):
29 def push(repo, remote, force=False, revs=None, newbranch=False):
29 '''Push outgoing changesets (limited by revs) from a local
30 '''Push outgoing changesets (limited by revs) from a local
@@ -65,8 +66,8 b' def push(repo, remote, force=False, revs'
65 actualmoves = [n for n in nodes if phase < pushop.repo[n].phase()]
66 actualmoves = [n for n in nodes if phase < pushop.repo[n].phase()]
66 phasestr = phases.phasenames[phase]
67 phasestr = phases.phasenames[phase]
67 if actualmoves:
68 if actualmoves:
68 pushop.repo.ui.status(_('cannot lock source repo, skipping '
69 pushop.ui.status(_('cannot lock source repo, skipping '
69 'local %s phase update\n') % phasestr)
70 'local %s phase update\n') % phasestr)
70 # get local lock as we might write phase data
71 # get local lock as we might write phase data
71 locallock = None
72 locallock = None
72 try:
73 try:
@@ -78,7 +79,7 b' def push(repo, remote, force=False, revs'
78 # We do not abort the push, but just disable the local phase
79 # We do not abort the push, but just disable the local phase
79 # synchronisation.
80 # synchronisation.
80 msg = 'cannot lock source repository: %s\n' % err
81 msg = 'cannot lock source repository: %s\n' % err
81 pushop.repo.ui.debug(msg)
82 pushop.ui.debug(msg)
82 try:
83 try:
83 pushop.repo.checkpush(force, revs)
84 pushop.repo.checkpush(force, revs)
84 lock = None
85 lock = None
@@ -124,7 +125,7 b' def push(repo, remote, force=False, revs'
124 raise util.Abort(_(mst)
125 raise util.Abort(_(mst)
125 % (ctx.troubles()[0],
126 % (ctx.troubles()[0],
126 ctx))
127 ctx))
127 newbm = pushop.repo.ui.configlist('bookmarks', 'pushing')
128 newbm = pushop.ui.configlist('bookmarks', 'pushing')
128 discovery.checkheads(unfi, remote, outgoing,
129 discovery.checkheads(unfi, remote, outgoing,
129 remoteheads, newbranch,
130 remoteheads, newbranch,
130 bool(inc), newbm)
131 bool(inc), newbm)
@@ -193,7 +194,7 b' def push(repo, remote, force=False, revs'
193 cheads.extend(c.node() for c in revset)
194 cheads.extend(c.node() for c in revset)
194 # even when we don't push, exchanging phase data is useful
195 # even when we don't push, exchanging phase data is useful
195 remotephases = remote.listkeys('phases')
196 remotephases = remote.listkeys('phases')
196 if (pushop.repo.ui.configbool('ui', '_usedassubrepo', False)
197 if (pushop.ui.configbool('ui', '_usedassubrepo', False)
197 and remotephases # server supports phases
198 and remotephases # server supports phases
198 and ret is None # nothing was pushed
199 and ret is None # nothing was pushed
199 and remotephases.get('publishing', False)):
200 and remotephases.get('publishing', False)):
@@ -233,9 +234,9 b' def push(repo, remote, force=False, revs'
233 str(phases.draft),
234 str(phases.draft),
234 str(phases.public))
235 str(phases.public))
235 if not r:
236 if not r:
236 pushop.repo.ui.warn(_('updating %s to public failed!\n')
237 pushop.ui.warn(_('updating %s to public failed!\n')
237 % newremotehead)
238 % newremotehead)
238 pushop.repo.ui.debug('try to push obsolete markers to remote\n')
239 pushop.ui.debug('try to push obsolete markers to remote\n')
239 obsolete.syncpush(pushop.repo, remote)
240 obsolete.syncpush(pushop.repo, remote)
240 finally:
241 finally:
241 if lock is not None:
242 if lock is not None:
@@ -244,5 +245,5 b' def push(repo, remote, force=False, revs'
244 if locallock is not None:
245 if locallock is not None:
245 locallock.release()
246 locallock.release()
246
247
247 bookmarks.updateremote(pushop.repo.ui, unfi, remote, revs)
248 bookmarks.updateremote(pushop.ui, unfi, remote, revs)
248 return ret
249 return ret
General Comments 0
You need to be logged in to leave comments. Login now