1987 |
1987 |
1988 This behavior is suitable for pushing. Semantic adjustment will be needed |
1988 This behavior is suitable for pushing. Semantic adjustment will be needed |
1989 for pull. |
1989 for pull. |
1990 """ |
1990 """ |
1991 changes = bookmarks.binarydecode(inpart) |
1991 changes = bookmarks.binarydecode(inpart) |
1992 op.repo._bookmarks.applychanges(op.repo, op.gettransaction(), changes) |
1992 |
|
1993 tr = op.gettransaction() |
|
1994 bookstore = op.repo._bookmarks |
|
1995 |
|
1996 pushkeycompat = op.repo.ui.configbool('server', 'bookmarks-pushkey-compat') |
|
1997 if pushkeycompat: |
|
1998 allhooks = [] |
|
1999 for book, node in changes: |
|
2000 hookargs = tr.hookargs.copy() |
|
2001 hookargs['pushkeycompat'] = '1' |
|
2002 hookargs['namespace'] = 'bookmark' |
|
2003 hookargs['key'] = book |
|
2004 hookargs['old'] = nodemod.hex(bookstore.get(book, '')) |
|
2005 hookargs['new'] = nodemod.hex(node if node is not None else '') |
|
2006 allhooks.append(hookargs) |
|
2007 for hookargs in allhooks: |
|
2008 op.repo.hook('prepushkey', throw=True, **hookargs) |
|
2009 |
|
2010 bookstore.applychanges(op.repo, tr, changes) |
|
2011 |
|
2012 if pushkeycompat: |
|
2013 def runhook(): |
|
2014 for hookargs in allhooks: |
|
2015 op.repo.hook('prepushkey', **hookargs) |
|
2016 op.repo._afterlock(runhook) |
1993 |
2017 |
1994 @parthandler('phase-heads') |
2018 @parthandler('phase-heads') |
1995 def handlephases(op, inpart): |
2019 def handlephases(op, inpart): |
1996 """apply phases from bundle part to repo""" |
2020 """apply phases from bundle part to repo""" |
1997 headsbyphase = phases.binarydecode(inpart) |
2021 headsbyphase = phases.binarydecode(inpart) |