Mercurial > hg
changeset 10379:a78bfaf988e1
add -b/--branch option to clone, bundle, incoming, outgoing, pull, push
author | Sune Foldager <cryo@cyanite.org> |
---|---|
date | Sun, 07 Feb 2010 15:23:46 +0100 |
parents | 04e1e6743809 |
children | ee72d89c0d9f |
files | hgext/graphlog.py mercurial/commands.py mercurial/hg.py tests/test-branch-option tests/test-branch-option.out tests/test-debugcomplete.out |
diffstat | 6 files changed, 39 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/graphlog.py Sun Feb 07 15:31:53 2010 +0100 +++ b/hgext/graphlog.py Sun Feb 07 15:23:46 2010 +0100 @@ -277,7 +277,7 @@ check_unsupported_flags(opts) dest = ui.expandpath(dest or 'default-push', dest or 'default') - dest, branches = hg.parseurl(dest) + dest, branches = hg.parseurl(dest, opts.get('branch')) revs, checkout = hg.addbranchrevs(repo, repo, branches, opts.get('rev')) other = hg.repository(cmdutil.remoteui(ui, opts), dest) if revs: @@ -305,7 +305,7 @@ """ check_unsupported_flags(opts) - source, branches = hg.parseurl(ui.expandpath(source)) + source, branches = hg.parseurl(ui.expandpath(source), opts.get('branch')) other = hg.repository(cmdutil.remoteui(repo, opts), source) revs, checkout = hg.addbranchrevs(repo, other, branches, opts.get('rev')) ui.status(_('comparing with %s\n') % url.hidepassword(source))
--- a/mercurial/commands.py Sun Feb 07 15:31:53 2010 +0100 +++ b/mercurial/commands.py Sun Feb 07 15:23:46 2010 +0100 @@ -538,7 +538,7 @@ visit.append(p) else: dest = ui.expandpath(dest or 'default-push', dest or 'default') - dest, branches = hg.parseurl(dest) + dest, branches = hg.parseurl(dest, opts.get('branch')) other = hg.repository(cmdutil.remoteui(repo, opts), dest) revs, checkout = hg.addbranchrevs(repo, other, branches, revs) o = repo.findoutgoing(other, force=opts.get('force')) @@ -607,8 +607,9 @@ a) the changeset, tag or branch specified with -u/--updaterev b) the changeset, tag or branch given with the first -r/--rev - c) the branch given with the url#branch source syntax - d) the head of the default branch + c) the branch given with the first -b/--branch + d) the branch given with the url#branch source syntax + e) the head of the default branch Use 'hg clone -u . src dst' to checkout the source repository's parent changeset (applicable for local source repositories only). @@ -651,7 +652,8 @@ pull=opts.get('pull'), stream=opts.get('uncompressed'), rev=opts.get('rev'), - update=opts.get('updaterev') or not opts.get('noupdate')) + update=opts.get('updaterev') or not opts.get('noupdate'), + branch=opts.get('branch')) def commit(ui, repo, *pats, **opts): """commit the specified files or all outstanding changes @@ -1921,7 +1923,7 @@ See pull for valid source format details. """ limit = cmdutil.loglimit(opts) - source, branches = hg.parseurl(ui.expandpath(source)) + source, branches = hg.parseurl(ui.expandpath(source), opts.get('branch')) other = hg.repository(cmdutil.remoteui(repo, opts), source) ui.status(_('comparing with %s\n') % url.hidepassword(source)) revs, checkout = hg.addbranchrevs(repo, other, branches, opts.get('rev')) @@ -2210,7 +2212,7 @@ """ limit = cmdutil.loglimit(opts) dest = ui.expandpath(dest or 'default-push', dest or 'default') - dest, branches = hg.parseurl(dest) + dest, branches = hg.parseurl(dest, opts.get('branch')) revs, checkout = hg.addbranchrevs(repo, repo, branches, opts.get('rev')) if revs: revs = [repo.lookup(rev) for rev in revs] @@ -2330,7 +2332,7 @@ If SOURCE is omitted, the 'default' path will be used. See 'hg help urls' for more information. """ - source, branches = hg.parseurl(ui.expandpath(source)) + source, branches = hg.parseurl(ui.expandpath(source), opts.get('branch')) other = hg.repository(cmdutil.remoteui(repo, opts), source) ui.status(_('pulling from %s\n') % url.hidepassword(source)) revs, checkout = hg.addbranchrevs(repo, other, branches, opts.get('rev')) @@ -2368,7 +2370,7 @@ URLs. If DESTINATION is omitted, a default path will be used. """ dest = ui.expandpath(dest or 'default-push', dest or 'default') - dest, branches = hg.parseurl(dest) + dest, branches = hg.parseurl(dest, opts.get('branch')) revs, checkout = hg.addbranchrevs(repo, repo, branches, opts.get('rev')) other = hg.repository(cmdutil.remoteui(repo, opts), dest) ui.status(_('pushing to %s\n') % url.hidepassword(dest)) @@ -3415,6 +3417,8 @@ _('run even when the destination is unrelated')), ('r', 'rev', [], _('a changeset intended to be added to the destination')), + ('b', 'branch', [], + _('a specific branch you would like to bundle')), ('', 'base', [], _('a base changeset assumed to be available at the destination')), ('a', 'all', None, _('bundle all changesets in the repository')), @@ -3436,6 +3440,8 @@ _('revision, tag or branch to check out')), ('r', 'rev', [], _('include the specified changeset')), + ('b', 'branch', [], + _('clone only the specified branch')), ('', 'pull', None, _('use pull protocol to copy metadata')), ('', 'uncompressed', None, _('use uncompressed transfer (fast over LAN)')), @@ -3567,6 +3573,8 @@ ('', 'bundle', '', _('file to store the bundles into')), ('r', 'rev', [], _('a remote changeset intended to be added')), + ('b', 'branch', [], + _('a specific branch you would like to pull')), ] + logopts + remoteopts, _('[-p] [-n] [-M] [-f] [-r REV]...' ' [--bundle FILENAME] [SOURCE]')), @@ -3621,6 +3629,8 @@ ('r', 'rev', [], _('a changeset intended to be included in the destination')), ('n', 'newest-first', None, _('show newest record first')), + ('b', 'branch', [], + _('a specific branch you would like to push')), ] + logopts + remoteopts, _('[-M] [-p] [-n] [-f] [-r REV]... [DEST]')), "parents": @@ -3637,6 +3647,8 @@ _('run even when remote repository is unrelated')), ('r', 'rev', [], _('a remote changeset intended to be added')), + ('b', 'branch', [], + _('a specific branch you would like to pull')), ] + remoteopts, _('[-u] [-f] [-r REV]... [-e CMD] [--remotecmd CMD] [SOURCE]')), "^push": @@ -3644,6 +3656,8 @@ [('f', 'force', None, _('force push')), ('r', 'rev', [], _('a changeset intended to be included in the destination')), + ('b', 'branch', [], + _('a specific branch you would like to push')), ] + remoteopts, _('[-f] [-r REV]... [-e CMD] [--remotecmd CMD] [DEST]')), "recover": (recover, []),
--- a/mercurial/hg.py Sun Feb 07 15:31:53 2010 +0100 +++ b/mercurial/hg.py Sun Feb 07 15:23:46 2010 +0100 @@ -164,7 +164,7 @@ _update(r, uprev) def clone(ui, source, dest=None, pull=False, rev=None, update=True, - stream=False): + stream=False, branch=None): """Make a copy of an existing repository. Create a copy of an existing repository in a new directory. The @@ -196,11 +196,13 @@ update: update working directory after clone completes, if destination is local repository (True means update to default rev, anything else is treated as a revision) + + branch: branches to clone """ if isinstance(source, str): origsource = ui.expandpath(source) - source, branch = parseurl(origsource) + source, branch = parseurl(origsource, branch) src_repo = repository(ui, source) else: src_repo = source
--- a/tests/test-branch-option Sun Feb 07 15:31:53 2010 +0100 +++ b/tests/test-branch-option Sun Feb 07 15:23:46 2010 +0100 @@ -26,8 +26,10 @@ echo in rev c branch a hg in -qr c ../branch#a +hg in -qr c -b a echo out branch . hg out -q ../branch#. +hg out -q -b . echo clone branch b cd .. hg clone branch2#b branch3
--- a/tests/test-branch-option.out Sun Feb 07 15:31:53 2010 +0100 +++ b/tests/test-branch-option.out Sun Feb 07 15:23:46 2010 +0100 @@ -18,8 +18,11 @@ in rev c branch a 1:dd6e60a716c6 2:f25d57ab0566 +1:dd6e60a716c6 +2:f25d57ab0566 out branch . 2:65511d0e2b55 +2:65511d0e2b55 clone branch b requesting all changes adding changesets
--- a/tests/test-debugcomplete.out Sun Feb 07 15:31:53 2010 +0100 +++ b/tests/test-debugcomplete.out Sun Feb 07 15:23:46 2010 +0100 @@ -165,7 +165,7 @@ % Show all commands + options add: include, exclude, dry-run annotate: rev, follow, no-follow, text, user, file, date, number, changeset, line-number, include, exclude -clone: noupdate, updaterev, rev, pull, uncompressed, ssh, remotecmd +clone: noupdate, updaterev, rev, branch, pull, uncompressed, ssh, remotecmd commit: addremove, close-branch, include, exclude, message, logfile, date, user diff: rev, change, text, git, nodates, show-function, reverse, ignore-all-space, ignore-space-change, ignore-blank-lines, unified, stat, include, exclude export: output, switch-parent, rev, text, git, nodates @@ -173,8 +173,8 @@ init: ssh, remotecmd log: follow, follow-first, date, copies, keyword, rev, removed, only-merges, user, only-branch, prune, patch, git, limit, no-merges, style, template, include, exclude merge: force, rev, preview -pull: update, force, rev, ssh, remotecmd -push: force, rev, ssh, remotecmd +pull: update, force, rev, branch, ssh, remotecmd +push: force, rev, branch, ssh, remotecmd remove: after, force, include, exclude serve: accesslog, daemon, daemon-pipefds, errorlog, port, address, prefix, name, webdir-conf, pid-file, stdio, templates, style, ipv6, certificate status: all, modified, added, removed, deleted, clean, unknown, ignored, no-status, copies, print0, rev, change, include, exclude @@ -186,7 +186,7 @@ bisect: reset, good, bad, skip, command, noupdate branch: force, clean branches: active, closed -bundle: force, rev, base, all, type, ssh, remotecmd +bundle: force, rev, branch, base, all, type, ssh, remotecmd cat: output, rev, decode, include, exclude copy: after, force, include, exclude, dry-run debugancestor: @@ -210,10 +210,10 @@ help: identify: rev, num, id, branch, tags import: strip, base, force, no-commit, exact, import-branch, message, logfile, date, user, similarity -incoming: force, newest-first, bundle, rev, patch, git, limit, no-merges, style, template, ssh, remotecmd +incoming: force, newest-first, bundle, rev, branch, patch, git, limit, no-merges, style, template, ssh, remotecmd locate: rev, print0, fullpath, include, exclude manifest: rev -outgoing: force, rev, newest-first, patch, git, limit, no-merges, style, template, ssh, remotecmd +outgoing: force, rev, newest-first, branch, patch, git, limit, no-merges, style, template, ssh, remotecmd parents: rev, style, template paths: recover: