hg.clone: do not ignore branch argument when source is a repo object

This is a revert of f6aa66376f81. The "bug" mentioned in this changeset is unclear:
hopefully using a test to cover this usage should prevent any bugs.
This commit is contained in:
Nicolas Dumazet 2010-07-02 15:12:50 +09:00
parent 14ab4a3d21
commit bd660e421e
3 changed files with 18 additions and 1 deletions

View File

@ -221,7 +221,7 @@ def clone(ui, source, dest=None, pull=False, rev=None, update=True,
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)

View File

@ -209,4 +209,14 @@ EOF
python simpleclone.py
rm -r ua
cat <<EOF > 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

View File

@ -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