Mercurial > hgsubversion
diff hgsubversion/wrappers.py @ 701:3b8088de027d
clone: replace the --singlebranch with overloading for --branch
Instead of adding yet another option, we take the --branch option to
mean the resulting branch name. It's stored in the branch map.
author | Dan Villiom Podlaski Christiansen <danchr@gmail.com> |
---|---|
date | Thu, 23 Sep 2010 16:54:27 +0200 |
parents | 03dca55abec9 |
children | 385213d2e2da |
line wrap: on
line diff
--- a/hgsubversion/wrappers.py +++ b/hgsubversion/wrappers.py @@ -246,6 +246,15 @@ def pull(repo, source, heads=[], force=F repo.ui.setconfig('hgsubversion', 'layout', layout) repo.ui.note('using %s layout\n' % layout) + branch = repo.ui.config('hgsubversion', 'branch') + if branch: + if layout != 'single': + msg = ('branch cannot be specified for Subversion clones using ' + 'standard directory layout') + raise hgutil.Abort(msg) + + meta.branchmap['default'] = branch + ui = repo.ui start = meta.revmap.youngest origrevcount = len(meta.revmap) @@ -390,7 +399,6 @@ optionmap = { 'authors': ('hgsubversion', 'authormap'), 'filemap': ('hgsubversion', 'filemap'), 'branchmap': ('hgsubversion', 'branchmap'), - 'singlebranch': ('hgsubversion', 'singlebranch'), 'stupid': ('hgsubversion', 'stupid'), 'defaulthost': ('hgsubversion', 'defaulthost'), 'defaultauthors': ('hgsubversion', 'defaultauthors'), @@ -408,6 +416,10 @@ def clone(orig, ui, source, dest=None, * them as well as other ways of customising the conversion process. """ + branch = opts.get('branch', None) + if branch: + ui.setconfig('hgsubversion', 'branch', branch[-1]) + for opt, (section, name) in optionmap.iteritems(): if opt in opts and opts[opt]: ui.setconfig(section, name, str(opts.pop(opt))) @@ -436,6 +448,11 @@ def generic(orig, ui, repo, *args, **opt Subversion %(target)s can be used for %(command)s. See 'hg help %(extension)s' for more on the conversion process. """ + + branch = opts.get('branch', None) + if branch: + ui.setconfig('hgsubversion', 'branch', branch[-1]) + for opt, (section, name) in optionmap.iteritems(): if opt in opts and opts[opt]: if isinstance(repo, str):