##// END OF EJS Templates
bookmark: add a 'check:bookmarks' bundle2 part...
Boris Feld -
r35259:dbf86862 default
parent child Browse files
Show More
@@ -156,6 +156,7 b' import sys'
156
156
157 from .i18n import _
157 from .i18n import _
158 from . import (
158 from . import (
159 bookmarks,
159 changegroup,
160 changegroup,
160 error,
161 error,
161 node as nodemod,
162 node as nodemod,
@@ -1787,6 +1788,34 b' def handlereplychangegroup(op, inpart):'
1787 replyto = int(inpart.params['in-reply-to'])
1788 replyto = int(inpart.params['in-reply-to'])
1788 op.records.add('changegroup', {'return': ret}, replyto)
1789 op.records.add('changegroup', {'return': ret}, replyto)
1789
1790
1791 @parthandler('check:bookmarks')
1792 def handlecheckbookmarks(op, inpart):
1793 """check location of bookmarks
1794
1795 This part is to be used to detect push race regarding bookmark, it
1796 contains binary encoded (bookmark, node) tuple. If the local state does
1797 not marks the one in the part, a PushRaced exception is raised
1798 """
1799 bookdata = bookmarks.binarydecode(inpart)
1800
1801 msgstandard = ('repository changed while pushing - please try again '
1802 '(bookmark "%s" move from %s to %s)')
1803 msgmissing = ('repository changed while pushing - please try again '
1804 '(bookmark "%s" is missing, expected %s)')
1805 msgexist = ('repository changed while pushing - please try again '
1806 '(bookmark "%s" set on %s, expected missing)')
1807 for book, node in bookdata:
1808 currentnode = op.repo._bookmarks.get(book)
1809 if currentnode != node:
1810 if node is None:
1811 finalmsg = msgexist % (book, nodemod.short(currentnode))
1812 elif currentnode is None:
1813 finalmsg = msgmissing % (book, nodemod.short(node))
1814 else:
1815 finalmsg = msgstandard % (book, nodemod.short(node),
1816 nodemod.short(currentnode))
1817 raise error.PushRaced(finalmsg)
1818
1790 @parthandler('check:heads')
1819 @parthandler('check:heads')
1791 def handlecheckheads(op, inpart):
1820 def handlecheckheads(op, inpart):
1792 """check that head of the repo did not change
1821 """check that head of the repo did not change
General Comments 0
You need to be logged in to leave comments. Login now