comparison mercurial/bundle2.py @ 40147:58ebf5083843

push: add "remote" to 'repository changed while pushing' messages (issue5971) Differential Revision: https://phab.mercurial-scm.org/D4933
author Taapas Agrawal <taapas2897@gmail.com>
date Thu, 11 Oct 2018 03:38:23 +0530
parents 1ea80ac13f19
children af62936c2508
comparison
equal deleted inserted replaced
40146:adfe4bb53a47 40147:58ebf5083843
1898 contains binary encoded (bookmark, node) tuple. If the local state does 1898 contains binary encoded (bookmark, node) tuple. If the local state does
1899 not marks the one in the part, a PushRaced exception is raised 1899 not marks the one in the part, a PushRaced exception is raised
1900 """ 1900 """
1901 bookdata = bookmarks.binarydecode(inpart) 1901 bookdata = bookmarks.binarydecode(inpart)
1902 1902
1903 msgstandard = ('repository changed while pushing - please try again ' 1903 msgstandard = ('remote repository changed while pushing - please try again '
1904 '(bookmark "%s" move from %s to %s)') 1904 '(bookmark "%s" move from %s to %s)')
1905 msgmissing = ('repository changed while pushing - please try again ' 1905 msgmissing = ('remote repository changed while pushing - please try again '
1906 '(bookmark "%s" is missing, expected %s)') 1906 '(bookmark "%s" is missing, expected %s)')
1907 msgexist = ('repository changed while pushing - please try again ' 1907 msgexist = ('remote repository changed while pushing - please try again '
1908 '(bookmark "%s" set on %s, expected missing)') 1908 '(bookmark "%s" set on %s, expected missing)')
1909 for book, node in bookdata: 1909 for book, node in bookdata:
1910 currentnode = op.repo._bookmarks.get(book) 1910 currentnode = op.repo._bookmarks.get(book)
1911 if currentnode != node: 1911 if currentnode != node:
1912 if node is None: 1912 if node is None:
1932 assert not h 1932 assert not h
1933 # Trigger a transaction so that we are guaranteed to have the lock now. 1933 # Trigger a transaction so that we are guaranteed to have the lock now.
1934 if op.ui.configbool('experimental', 'bundle2lazylocking'): 1934 if op.ui.configbool('experimental', 'bundle2lazylocking'):
1935 op.gettransaction() 1935 op.gettransaction()
1936 if sorted(heads) != sorted(op.repo.heads()): 1936 if sorted(heads) != sorted(op.repo.heads()):
1937 raise error.PushRaced('repository changed while pushing - ' 1937 raise error.PushRaced('remote repository changed while pushing - '
1938 'please try again') 1938 'please try again')
1939 1939
1940 @parthandler('check:updated-heads') 1940 @parthandler('check:updated-heads')
1941 def handlecheckupdatedheads(op, inpart): 1941 def handlecheckupdatedheads(op, inpart):
1942 """check for race on the heads touched by a push 1942 """check for race on the heads touched by a push
1961 for ls in op.repo.branchmap().itervalues(): 1961 for ls in op.repo.branchmap().itervalues():
1962 currentheads.update(ls) 1962 currentheads.update(ls)
1963 1963
1964 for h in heads: 1964 for h in heads:
1965 if h not in currentheads: 1965 if h not in currentheads:
1966 raise error.PushRaced('repository changed while pushing - ' 1966 raise error.PushRaced('remote repository changed while pushing - '
1967 'please try again') 1967 'please try again')
1968 1968
1969 @parthandler('check:phases') 1969 @parthandler('check:phases')
1970 def handlecheckphases(op, inpart): 1970 def handlecheckphases(op, inpart):
1971 """check that phase boundaries of the repository did not change 1971 """check that phase boundaries of the repository did not change
1974 """ 1974 """
1975 phasetonodes = phases.binarydecode(inpart) 1975 phasetonodes = phases.binarydecode(inpart)
1976 unfi = op.repo.unfiltered() 1976 unfi = op.repo.unfiltered()
1977 cl = unfi.changelog 1977 cl = unfi.changelog
1978 phasecache = unfi._phasecache 1978 phasecache = unfi._phasecache
1979 msg = ('repository changed while pushing - please try again ' 1979 msg = ('remote repository changed while pushing - please try again '
1980 '(%s is %s expected %s)') 1980 '(%s is %s expected %s)')
1981 for expectedphase, nodes in enumerate(phasetonodes): 1981 for expectedphase, nodes in enumerate(phasetonodes):
1982 for n in nodes: 1982 for n in nodes:
1983 actualphase = phasecache.phase(unfi, cl.rev(n)) 1983 actualphase = phasecache.phase(unfi, cl.rev(n))
1984 if actualphase != expectedphase: 1984 if actualphase != expectedphase: