aboutsummaryrefslogtreecommitdiff
path: root/contrib/remote-helpers
diff options
context:
space:
mode:
authorFelipe Contreras <felipe.contreras@gmail.com>2013-05-24 21:29:38 -0500
committerJunio C Hamano <gitster@pobox.com>2013-05-28 07:59:56 -0700
commit731ce6cf75d304bc14c1ee0ad45e5846f5db6834 (patch)
tree6020f93c6d81fad83638147855f68a154754ecc1 /contrib/remote-helpers
parentb082b4f94ff1a82ce42223f7a46c9423e99c48e9 (diff)
downloadgit-731ce6cf75d304bc14c1ee0ad45e5846f5db6834.tar.gz
git-731ce6cf75d304bc14c1ee0ad45e5846f5db6834.tar.xz
remote-hg: update bookmarks when using a remote
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/remote-helpers')
-rwxr-xr-xcontrib/remote-helpers/git-remote-hg17
1 files changed, 17 insertions, 0 deletions
diff --git a/contrib/remote-helpers/git-remote-hg b/contrib/remote-helpers/git-remote-hg
index 7c859b82e..76438a687 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -356,6 +356,21 @@ def fixup_user(user):
return '%s <%s>' % (name, mail)
+def updatebookmarks(repo, peer):
+ remotemarks = peer.listkeys('bookmarks')
+ localmarks = repo._bookmarks
+
+ if not remotemarks:
+ return
+
+ for k, v in remotemarks.iteritems():
+ localmarks[k] = hgbin(v)
+
+ if hasattr(localmarks, 'write'):
+ localmarks.write()
+ else:
+ bookmarks.write(repo)
+
def get_repo(url, alias):
global dirname, peer
@@ -394,6 +409,8 @@ def get_repo(url, alias):
die('Repository error')
repo.pull(peer, heads=None, force=True)
+ updatebookmarks(repo, peer)
+
return repo
def rev_to_mark(rev):