##// END OF EJS Templates
push: make locking of source optional (issue3684)...
Pierre-Yves David -
r19097:3f5e75c2 stable
parent child Browse files
Show More
@@ -1764,9 +1764,29 b' class localrepository(object):'
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
@@ -1918,7 +1938,8 b' class localrepository(object):'
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')
@@ -1062,5 +1062,43 b' 2. cloning publishing repository'
1062 |
1062 |
1063 o 0 public a-A - 054250a37db4
1063 o 0 public a-A - 054250a37db4
1064
1064
1065
1066 Pushing From an unlockable repo
1067 --------------------------------
1068 (issue3684)
1069
1070 Unability to lock the source repo should not prevent the push. It will prevent
1071 the retrieval of remote phase during push. For example, pushing to a publishing
1072 server won't turn changeset public.
1073
1074 1. Test that push is not prevented
1075
1076 $ hg init Phi
1077 $ cd Upsilon
1078 $ chmod -R -w .hg
1079 $ hg push ../Phi
1080 pushing to ../Phi
1081 searching for changes
1082 adding changesets
1083 adding manifests
1084 adding file changes
1085 added 14 changesets with 14 changes to 14 files (+3 heads)
1086 $ chmod -R +w .hg
1087
1088 2. Test that failed phases movement are reported
1089
1090 $ hg phase --force --draft 3
1091 $ chmod -R -w .hg
1092 $ hg push ../Phi
1093 pushing to ../Phi
1094 searching for changes
1095 no changes found
1096 cannot lock source repo, skipping local public phase update
1097 [1]
1098 $ chmod -R +w .hg
1099 $ hgph Upsilon
1100
1101 $ cd ..
1102
1065 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
1103 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
1066
1104
General Comments 0
You need to be logged in to leave comments. Login now