[PATCH 4 of 4] convert: add bookmark support to the hg sink

Edouard Gomez ed.gomez at free.fr
Wed Mar 23 15:50:17 CDT 2011


# HG changeset patch
# User Edouard Gomez <ed.gomez at free.fr>
# Date 1278454019 -7200
# Branch stable
# Node ID 6e88be9ea413cbbd9175806a37fdeae142bc203c
# Parent  4a80f1cfa260cf5c06230e4fd7175f9d65c7875e
convert: add bookmark support to the hg sink

diff --git a/hgext/convert/hg.py b/hgext/convert/hg.py
--- a/hgext/convert/hg.py
+++ b/hgext/convert/hg.py
@@ -21,7 +21,7 @@
 import os, time, cStringIO
 from mercurial.i18n import _
 from mercurial.node import bin, hex, nullid
-from mercurial import hg, util, context, error
+from mercurial import hg, util, context, bookmarks, error
 
 from common import NoRepo, commit, converter_source, converter_sink
 
@@ -214,6 +214,16 @@
     def setfilemapmode(self, active):
         self.filemapmode = active
 
+    def putbookmarks(self, updatedbookmark):
+        if not len(updatedbookmark):
+            return
+
+        self.ui.status(_("updating bookmarks\n"))
+        for bookmark in updatedbookmark:
+            self.repo._bookmarks[bookmark] = bin(updatedbookmark[bookmark])
+            bookmarks.write(self.repo)
+
+
 class mercurial_source(converter_source):
     def __init__(self, ui, path, rev=None):
         converter_source.__init__(self, ui, path, rev)


More information about the Mercurial-devel mailing list