comparison mercurial/localrepo.py @ 19096:0e4af72cbd7f stable

push: factorise phase movement in a simple closure Having all phases movement centralised will help to handle special case when the local repo can not be locked as describe in issue 3684.
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Tue, 30 Apr 2013 10:51:25 +0200
parents d5f968f7716f
children 3f5e75c22585
comparison
equal deleted inserted replaced
19095:5cc71484ee9c 19096:0e4af72cbd7f
1760 # servers, http servers). 1760 # servers, http servers).
1761 1761
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):
1766 """move <nodes> to <phase> in the local source repo"""
1767 phases.advanceboundary(self, phase, nodes)
1765 # get local lock as we might write phase data 1768 # get local lock as we might write phase data
1766 locallock = self.lock() 1769 locallock = self.lock()
1767 try: 1770 try:
1768 self.checkpush(force, revs) 1771 self.checkpush(force, revs)
1769 lock = None 1772 lock = None
1881 # We drop the possible phase synchronisation done by 1884 # We drop the possible phase synchronisation done by
1882 # courtesy to publish changesets possibly locally draft 1885 # courtesy to publish changesets possibly locally draft
1883 # on the remote. 1886 # on the remote.
1884 remotephases = {'publishing': 'True'} 1887 remotephases = {'publishing': 'True'}
1885 if not remotephases: # old server or public only repo 1888 if not remotephases: # old server or public only repo
1886 phases.advanceboundary(self, phases.public, cheads) 1889 localphasemove(cheads)
1887 # don't push any phase data as there is nothing to push 1890 # don't push any phase data as there is nothing to push
1888 else: 1891 else:
1889 ana = phases.analyzeremotephases(self, cheads, remotephases) 1892 ana = phases.analyzeremotephases(self, cheads, remotephases)
1890 pheads, droots = ana 1893 pheads, droots = ana
1891 ### Apply remote phase on local 1894 ### Apply remote phase on local
1892 if remotephases.get('publishing', False): 1895 if remotephases.get('publishing', False):
1893 phases.advanceboundary(self, phases.public, cheads) 1896 localphasemove(cheads)
1894 else: # publish = False 1897 else: # publish = False
1895 phases.advanceboundary(self, phases.public, pheads) 1898 localphasemove(pheads)
1896 phases.advanceboundary(self, phases.draft, cheads) 1899 localphasemove(cheads, phases.draft)
1897 ### Apply local phase on remote 1900 ### Apply local phase on remote
1898 1901
1899 # Get the list of all revs draft on remote by public here. 1902 # Get the list of all revs draft on remote by public here.
1900 # XXX Beware that revset break if droots is not strictly 1903 # XXX Beware that revset break if droots is not strictly
1901 # XXX root we may want to ensure it is but it is costly 1904 # XXX root we may want to ensure it is but it is costly