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.
--- a/mercurial/hg.py Wed Aug 11 12:29:20 2010 +0200
+++ b/mercurial/hg.py Fri Jul 02 15:12:50 2010 +0900
@@ -221,7 +221,7 @@
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)
--- a/tests/test-clone Wed Aug 11 12:29:20 2010 +0200
+++ b/tests/test-clone Fri Jul 02 15:12:50 2010 +0900
@@ -209,4 +209,14 @@
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
--- a/tests/test-clone.out Wed Aug 11 12:29:20 2010 +0200
+++ b/tests/test-clone.out Fri Jul 02 15:12:50 2010 +0900
@@ -314,3 +314,10 @@
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