Mercurial > public > mercurial-scm > hg
comparison mercurial/localrepo.py @ 19097:3f5e75c22585 stable
push: make locking of source optional (issue3684)
Having the permission to lock the source repo on push is now optional. When the
repo cannot be locked, phase are not changed locally. A status message is issue
when some actual phase movement are skipped:
cannot lock source repo, skipping local public phase update
A debug message with the exact reason of the locking failure is issued in all
case.
author | Pierre-Yves David <pierre-yves.david@logilab.fr> |
---|---|
date | Tue, 30 Apr 2013 21:19:56 +0200 |
parents | 0e4af72cbd7f |
children | e579687cb5d8 |
comparison
equal
deleted
inserted
replaced
19096:0e4af72cbd7f | 19097:3f5e75c22585 |
---|---|
1762 if not remote.canpush(): | 1762 if not remote.canpush(): |
1763 raise util.Abort(_("destination does not support push")) | 1763 raise util.Abort(_("destination does not support push")) |
1764 unfi = self.unfiltered() | 1764 unfi = self.unfiltered() |
1765 def localphasemove(nodes, phase=phases.public): | 1765 def localphasemove(nodes, phase=phases.public): |
1766 """move <nodes> to <phase> in the local source repo""" | 1766 """move <nodes> to <phase> in the local source repo""" |
1767 phases.advanceboundary(self, phase, nodes) | 1767 if locallock is not None: |
1768 phases.advanceboundary(self, phase, nodes) | |
1769 else: | |
1770 # repo is not locked, do not change any phases! | |
1771 # Informs the user that phases should have been moved when | |
1772 # applicable. | |
1773 actualmoves = [n for n in nodes if phase < self[n].phase()] | |
1774 phasestr = phases.phasenames[phase] | |
1775 if actualmoves: | |
1776 self.ui.status(_('cannot lock source repo, skipping local' | |
1777 ' %s phase update\n') % phasestr) | |
1768 # get local lock as we might write phase data | 1778 # get local lock as we might write phase data |
1769 locallock = self.lock() | 1779 locallock = None |
1780 try: | |
1781 locallock = self.lock() | |
1782 except IOError, err: | |
1783 if err.errno != errno.EACCES: | |
1784 raise | |
1785 # source repo cannot be locked. | |
1786 # We do not abort the push, but just disable the local phase | |
1787 # synchronisation. | |
1788 msg = 'cannot lock source repository: %s\n' % err | |
1789 self.ui.debug(msg) | |
1770 try: | 1790 try: |
1771 self.checkpush(force, revs) | 1791 self.checkpush(force, revs) |
1772 lock = None | 1792 lock = None |
1773 unbundle = remote.capable('unbundle') | 1793 unbundle = remote.capable('unbundle') |
1774 if not unbundle: | 1794 if not unbundle: |
1916 obsolete.syncpush(self, remote) | 1936 obsolete.syncpush(self, remote) |
1917 finally: | 1937 finally: |
1918 if lock is not None: | 1938 if lock is not None: |
1919 lock.release() | 1939 lock.release() |
1920 finally: | 1940 finally: |
1921 locallock.release() | 1941 if locallock is not None: |
1942 locallock.release() | |
1922 | 1943 |
1923 self.ui.debug("checking for updated bookmarks\n") | 1944 self.ui.debug("checking for updated bookmarks\n") |
1924 rb = remote.listkeys('bookmarks') | 1945 rb = remote.listkeys('bookmarks') |
1925 for k in rb.keys(): | 1946 for k in rb.keys(): |
1926 if k in unfi._bookmarks: | 1947 if k in unfi._bookmarks: |