Mercurial > hg > mercurial-source
comparison mercurial/bundle2.py @ 36043:af5507203d01
bookmark: introduce a 'bookmarks' part
This part can carry and apply bookmarks information. We start with adding the
core behavior of the part. In its current form, the part is only suitable for
push since it plain update the bookmark without consideration for the local
state. Support of the behavior needed for pulling will be added in later
changesets.
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Sun, 15 Oct 2017 18:02:11 +0200 |
parents | ad5f2b923b0d |
children | f392066d127c |
comparison
equal
deleted
inserted
replaced
36042:ad5f2b923b0d | 36043:af5507203d01 |
---|---|
1974 for key in ('namespace', 'key', 'new', 'old', 'ret'): | 1974 for key in ('namespace', 'key', 'new', 'old', 'ret'): |
1975 if key in inpart.params: | 1975 if key in inpart.params: |
1976 kwargs[key] = inpart.params[key] | 1976 kwargs[key] = inpart.params[key] |
1977 raise error.PushkeyFailed(partid=str(inpart.id), **kwargs) | 1977 raise error.PushkeyFailed(partid=str(inpart.id), **kwargs) |
1978 | 1978 |
1979 @parthandler('bookmarks') | |
1980 def handlebookmark(op, inpart): | |
1981 """transmit bookmark information | |
1982 | |
1983 The part contains binary encoded bookmark information. The bookmark | |
1984 information is applied as is to the unbundling repository. Make sure a | |
1985 'check:bookmarks' part is issued earlier to check for race condition in | |
1986 such update. | |
1987 | |
1988 This behavior is suitable for pushing. Semantic adjustment will be needed | |
1989 for pull. | |
1990 """ | |
1991 changes = bookmarks.binarydecode(inpart) | |
1992 op.repo._bookmarks.applychanges(op.repo, op.gettransaction(), changes) | |
1993 | |
1979 @parthandler('phase-heads') | 1994 @parthandler('phase-heads') |
1980 def handlephases(op, inpart): | 1995 def handlephases(op, inpart): |
1981 """apply phases from bundle part to repo""" | 1996 """apply phases from bundle part to repo""" |
1982 headsbyphase = phases.binarydecode(inpart) | 1997 headsbyphase = phases.binarydecode(inpart) |
1983 phases.updatephases(op.repo.unfiltered(), op.gettransaction, headsbyphase) | 1998 phases.updatephases(op.repo.unfiltered(), op.gettransaction, headsbyphase) |