Mercurial > hgsubversion
changeset 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 | 1ba8ed29148e |
children | 05cd4a5138bf |
files | __init__.py hg_delta_editor.py stupid.py wrappers.py |
diffstat | 4 files changed, 17 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/__init__.py +++ b/__init__.py @@ -68,6 +68,7 @@ def uisetup(ui): ('', 'svn-authors', '', 'username mapping filename'), ('', 'svn-filemap', '', 'remap file to exclude paths or include only certain paths'), + ('', 'svn-no-branchnames', False, "don't record branch names in hg"), ]) try:
--- 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 ' ',
--- a/stupid.py +++ b/stupid.py @@ -526,8 +526,10 @@ def svn_server_pull_rev(ui, svn, hg_edit hg_editor.authors[r.author], date, extra) - ha = hg_editor.repo.commitctx(current_ctx) branch = extra.get('branch', None) + if hg_editor.opts.get('svn_no_branchnames', False): + extra.pop('branch', None) + ha = hg_editor.repo.commitctx(current_ctx) if not branch in hg_editor.branches: hg_editor.branches[branch] = None, 0, r.revnum hg_editor.add_to_revmap(r.revnum, b, ha) @@ -558,6 +560,9 @@ def svn_server_pull_rev(ui, svn, hg_edit if 'closed-branches' in hg_editor.repo.branchtags(): closed = hg_editor.repo['closed-branches'].node() parents = (parent, closed) + extra = {} + if not hg_editor.opts.get('svn_no_branchnames', False): + extra['branch'] = 'closed-branches' current_ctx = context.memctx(hg_editor.repo, parents, r.message or util.default_commit_msg, @@ -565,7 +570,7 @@ def svn_server_pull_rev(ui, svn, hg_edit filectxfn, hg_editor.authors[r.author], date, - {'branch': 'closed-branches'}) + extra) ha = hg_editor.repo.commitctx(current_ctx) ui.status('Marked branch %s as closed.\n' % (b or 'default')) hg_editor._save_metadata()