equal
deleted
inserted
replaced
31 self.force = force |
31 self.force = force |
32 # revs to be pushed (None is "all") |
32 # revs to be pushed (None is "all") |
33 self.revs = revs |
33 self.revs = revs |
34 # allow push of new branch |
34 # allow push of new branch |
35 self.newbranch = newbranch |
35 self.newbranch = newbranch |
|
36 # did a local lock get acquired? |
|
37 self.locallocked = None |
36 |
38 |
37 def push(repo, remote, force=False, revs=None, newbranch=False): |
39 def push(repo, remote, force=False, revs=None, newbranch=False): |
38 '''Push outgoing changesets (limited by revs) from a local |
40 '''Push outgoing changesets (limited by revs) from a local |
39 repository to remote. Return an integer: |
41 repository to remote. Return an integer: |
40 - None means nothing to push |
42 - None means nothing to push |
64 if not pushop.remote.canpush(): |
66 if not pushop.remote.canpush(): |
65 raise util.Abort(_("destination does not support push")) |
67 raise util.Abort(_("destination does not support push")) |
66 unfi = pushop.repo.unfiltered() |
68 unfi = pushop.repo.unfiltered() |
67 def localphasemove(nodes, phase=phases.public): |
69 def localphasemove(nodes, phase=phases.public): |
68 """move <nodes> to <phase> in the local source repo""" |
70 """move <nodes> to <phase> in the local source repo""" |
69 if locallock is not None: |
71 if pushop.locallocked: |
70 phases.advanceboundary(pushop.repo, phase, nodes) |
72 phases.advanceboundary(pushop.repo, phase, nodes) |
71 else: |
73 else: |
72 # repo is not locked, do not change any phases! |
74 # repo is not locked, do not change any phases! |
73 # Informs the user that phases should have been moved when |
75 # Informs the user that phases should have been moved when |
74 # applicable. |
76 # applicable. |
79 'local %s phase update\n') % phasestr) |
81 'local %s phase update\n') % phasestr) |
80 # get local lock as we might write phase data |
82 # get local lock as we might write phase data |
81 locallock = None |
83 locallock = None |
82 try: |
84 try: |
83 locallock = pushop.repo.lock() |
85 locallock = pushop.repo.lock() |
|
86 pushop.locallocked = True |
84 except IOError, err: |
87 except IOError, err: |
|
88 pushop.locallocked = False |
85 if err.errno != errno.EACCES: |
89 if err.errno != errno.EACCES: |
86 raise |
90 raise |
87 # source repo cannot be locked. |
91 # source repo cannot be locked. |
88 # We do not abort the push, but just disable the local phase |
92 # We do not abort the push, but just disable the local phase |
89 # synchronisation. |
93 # synchronisation. |