##// END OF EJS Templates
phase: introduce a new 'check:phases' part...
Boris Feld -
r34821:a95067b1 default
parent child Browse files
Show More
@@ -157,6 +157,7 b' from .i18n import _'
157 157 from . import (
158 158 changegroup,
159 159 error,
160 node as nodemod,
160 161 obsolete,
161 162 phases,
162 163 pushkey,
@@ -1749,6 +1750,27 b' def handlecheckupdatedheads(op, inpart):'
1749 1750 raise error.PushRaced('repository changed while pushing - '
1750 1751 'please try again')
1751 1752
1753 @parthandler('check:phases')
1754 def handlecheckphases(op, inpart):
1755 """check that phase boundaries of the repository did not change
1756
1757 This is used to detect a push race.
1758 """
1759 phasetonodes = phases.binarydecode(inpart)
1760 unfi = op.repo.unfiltered()
1761 cl = unfi.changelog
1762 phasecache = unfi._phasecache
1763 msg = ('repository changed while pushing - please try again '
1764 '(%s is %s expected %s)')
1765 for expectedphase, nodes in enumerate(phasetonodes):
1766 for n in nodes:
1767 actualphase = phasecache.phase(unfi, cl.rev(n))
1768 if actualphase != expectedphase:
1769 finalmsg = msg % (nodemod.short(n),
1770 phases.phasenames[actualphase],
1771 phases.phasenames[expectedphase])
1772 raise error.PushRaced(finalmsg)
1773
1752 1774 @parthandler('output')
1753 1775 def handleoutput(op, inpart):
1754 1776 """forward output captured on the server to the client"""
General Comments 0
You need to be logged in to leave comments. Login now