mirror of
https://github.com/facebook/sapling.git
synced 2024-10-08 07:49:11 +03:00
bookmark: introduce a 'applychanges' function to gather bookmark movement
We want to track bookmark movement within a transaction. For this we need a more centralized way to update bookmarks. For this purpose we introduce a new 'applychanges' method that apply a list of changes encoded as '(name, node)'. We'll cover all bookmark updating code to this new method in later changesets and add bookmark move in the transaction when all will be migrated.
This commit is contained in:
parent
888ed86eaf
commit
e5368fffb1
@ -109,6 +109,16 @@ class bmstore(dict):
|
||||
self._clean = False
|
||||
return dict.__delitem__(self, key)
|
||||
|
||||
def applychanges(self, repo, tr, changes):
|
||||
"""Apply a list of changes to bookmarks
|
||||
"""
|
||||
for name, node in changes:
|
||||
if node is None:
|
||||
del self[name]
|
||||
else:
|
||||
self[name] = node
|
||||
self.recordchange(tr)
|
||||
|
||||
def recordchange(self, tr):
|
||||
"""record that bookmarks have been changed in a transaction
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user