diff hgext/convert/hg.py @ 5260:be4835ad9a85

convert: new config variable hg.tagsbranch controls which branch tags are committed to
author Brendan Cully <brendan@kublai.com>
date Mon, 27 Aug 2007 15:39:07 -0700
parents 33015dac5df5
children 70e9a527cc61
line wrap: on
line diff
--- 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):