convert: new config variable hg.tagsbranch controls which branch tags are committed to
authorBrendan Cully <brendan@kublai.com>
Mon, 27 Aug 2007 15:39:07 -0700
changeset 5260 be4835ad9a85
parent 5250 585471802a01
child 5261 a4547dfbbf20
convert: new config variable hg.tagsbranch controls which branch tags are committed to
hgext/convert/hg.py
--- a/hgext/convert/hg.py	Mon Aug 27 11:56:53 2007 -0700
+++ b/hgext/convert/hg.py	Mon Aug 27 15:39:07 2007 -0700
@@ -20,6 +20,7 @@
         self.ui = ui
         self.branchnames = ui.configbool('convert', 'hg.usebranchnames', True)
         self.clonebranches = ui.configbool('convert', 'hg.clonebranches', False)
+        self.tagsbranch = ui.config('convert', 'hg.tagsbranch', 'default')
         self.lastbranch = None
         try:
             self.repo = hg.repository(self.ui, path)
@@ -139,8 +140,15 @@
             f.close()
             if not oldlines: self.repo.add([".hgtags"])
             date = "%s 0" % int(time.mktime(time.gmtime()))
+            extra = {}
+            if self.tagsbranch != 'default':
+                extra['branch'] = self.tagsbranch
+            try:
+                tagparent = self.repo.changectx(self.tagsbranch).node()
+            except hg.RepoError, inst:
+                tagparent = nullid
             self.repo.rawcommit([".hgtags"], "update tags", "convert-repo",
-                                date, self.repo.changelog.tip(), nullid)
+                                date, tagparent, nullid)
             return hex(self.repo.changelog.tip())
 
 class mercurial_source(converter_source):