[PATCH 2 of 3 V3] exchange: add hooks before and after bookmark pull

Ryan McElroy rm at fb.com
Tue Dec 2 23:09:21 CST 2014


# HG changeset patch
# User Ryan McElroy <rmcelroy at fb.com>
# Date 1417581231 28800
#      Tue Dec 02 20:33:51 2014 -0800
# Node ID e56cddc7a7f746881c40edf62eabfea6d9a829be
# Parent  8904023bad6c33d487253918437b31ac04d98c9a
exchange: add hooks before and after bookmark pull

The motivation behind these hooks is to enable proper testing of the share
extension's changes that enable sharing bookmarks. However, these could also
be used to ensure that certain bookmarks are never written locally, for example.

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -1080,13 +1080,15 @@ def _pullbookmarks(pullop):
     """process the remote bookmark information to update the local one"""
     if 'bookmarks' in pullop.stepsdone:
         return
+    repo = pullop.repo
+    repo.hook('prepullbookmarks', throw=True)
     pullop.stepsdone.add('bookmarks')
-    repo = pullop.repo
     remotebookmarks = pullop.remotebookmarks
     bookmod.updatefromremote(repo.ui, repo, remotebookmarks,
                              pullop.remote.url(),
                              pullop.gettransaction,
                              explicit=pullop.explicitbookmarks)
+    repo.hook('postpullbookmarks', throw=True)
 
 def _pullobsolete(pullop):
     """utility function to pull obsolete markers from a remote


More information about the Mercurial-devel mailing list