comparison hgext/convert/hg.py @ 13746:d80b768545cb

convert: add bookmark support to the hg sink
author Edouard Gomez <ed.gomez@free.fr>
date Wed, 07 Jul 2010 00:06:59 +0200
parents a2f11188e2d2
children 043238abda94
comparison
equal deleted inserted replaced
13745:9ff22f600c6c 13746:d80b768545cb
19 19
20 20
21 import os, time, cStringIO 21 import os, time, cStringIO
22 from mercurial.i18n import _ 22 from mercurial.i18n import _
23 from mercurial.node import bin, hex, nullid 23 from mercurial.node import bin, hex, nullid
24 from mercurial import hg, util, context, error 24 from mercurial import hg, util, context, bookmarks, error
25 25
26 from common import NoRepo, commit, converter_source, converter_sink 26 from common import NoRepo, commit, converter_source, converter_sink
27 27
28 class mercurial_sink(converter_sink): 28 class mercurial_sink(converter_sink):
29 def __init__(self, ui, path): 29 def __init__(self, ui, path):
211 self.repo.commitctx(ctx) 211 self.repo.commitctx(ctx)
212 return hex(self.repo.changelog.tip()), hex(tagparent) 212 return hex(self.repo.changelog.tip()), hex(tagparent)
213 213
214 def setfilemapmode(self, active): 214 def setfilemapmode(self, active):
215 self.filemapmode = active 215 self.filemapmode = active
216
217 def putbookmarks(self, updatedbookmark):
218 if not len(updatedbookmark):
219 return
220
221 self.ui.status(_("updating bookmarks\n"))
222 for bookmark in updatedbookmark:
223 self.repo._bookmarks[bookmark] = bin(updatedbookmark[bookmark])
224 bookmarks.write(self.repo)
225
216 226
217 class mercurial_source(converter_source): 227 class mercurial_source(converter_source):
218 def __init__(self, ui, path, rev=None): 228 def __init__(self, ui, path, rev=None):
219 converter_source.__init__(self, ui, path, rev) 229 converter_source.__init__(self, ui, path, rev)
220 self.ignoreerrors = ui.configbool('convert', 'hg.ignoreerrors', False) 230 self.ignoreerrors = ui.configbool('convert', 'hg.ignoreerrors', False)