diff hg_delta_editor.py @ 321:b6c6d32c8ef1

Add an option to clone without branch names.
author Augie Fackler <durin42@gmail.com>
date Fri, 08 May 2009 16:11:08 -0500
parents 5dc8fee7fc96
children 05cd4a5138bf
line wrap: on
line diff
--- a/hg_delta_editor.py
+++ b/hg_delta_editor.py
@@ -633,6 +633,9 @@ class HgChangeReceiver(delta.Editor):
             def del_all_files(*args):
                 raise IOError
             files = parentctx.manifest().keys()
+            extra = {}
+            if not self.opts.get('svn_no_branchnames', False):
+                extra['branch'] = 'closed-branches'
             current_ctx = context.memctx(self.repo,
                                          parents,
                                          rev.message or ' ',
@@ -640,7 +643,7 @@ class HgChangeReceiver(delta.Editor):
                                          del_all_files,
                                          self.authors[rev.author],
                                          date,
-                                         {'branch': 'closed-branches'})
+                                         extra)
             new_hash = self.repo.commitctx(current_ctx)
             self.ui.status('Marked branch %s as closed.\n' % (branch or
                                                               'default'))
@@ -686,6 +689,8 @@ class HgChangeReceiver(delta.Editor):
                                           data=data,
                                           islink=is_link, isexec=is_exec,
                                           copied=copied)
+            if self.opts.get('svn_no_branchnames', False):
+                extra.pop('branch', None)
             current_ctx = context.memctx(self.repo,
                                          parents,
                                          rev.message or '...',
@@ -713,6 +718,8 @@ class HgChangeReceiver(delta.Editor):
             extra = util.build_extra(rev.revnum, branch,
                                      open(self.uuid_file).read(),
                                      self.subdir)
+            if self.opts.get('svn_no_branchnames', False):
+                extra.pop('branch', None)
             current_ctx = context.memctx(self.repo,
                                          (ha, node.nullid),
                                          rev.message or ' ',