# HG changeset patch # User Nicolas Dumazet # Date 2010-07-02 06:12:50 # Node ID b1ae33b813cb5c0f7a7b95de112b21182f972a4d # Parent 2b7a75ca691322f2d25c55f62335228f47e91ae2 hg.clone: do not ignore branch argument when source is a repo object This is a revert of 4a70178f9bde. The "bug" mentioned in this changeset is unclear: hopefully using a test to cover this usage should prevent any bugs. diff --git a/mercurial/hg.py b/mercurial/hg.py --- a/mercurial/hg.py +++ b/mercurial/hg.py @@ -221,7 +221,7 @@ def clone(ui, source, dest=None, pull=Fa src_repo = repository(ui, source) else: src_repo = source - branch = (None, []) + branch = (None, branch or []) origsource = source = src_repo.url() rev, checkout = addbranchrevs(src_repo, src_repo, branch, rev) diff --git a/tests/test-clone b/tests/test-clone --- a/tests/test-clone +++ b/tests/test-clone @@ -209,4 +209,14 @@ EOF python simpleclone.py rm -r ua +cat < branchclone.py +from mercurial import ui, hg +myui = ui.ui() +repo = hg.repository(myui, 'a') +hg.clone(myui, repo, dest="ua", branch=["stable",]) +EOF + +python branchclone.py +rm -r ua + exit 0 diff --git a/tests/test-clone.out b/tests/test-clone.out --- a/tests/test-clone.out +++ b/tests/test-clone.out @@ -314,3 +314,10 @@ e8ece76546a6 e8ece76546a6 updating to branch default 3 files updated, 0 files merged, 0 files removed, 0 files unresolved +requesting all changes +adding changesets +adding manifests +adding file changes +added 14 changesets with 14 changes to 3 files +updating to branch stable +3 files updated, 0 files merged, 0 files removed, 0 files unresolved