[PATCH STABLE] clone: allow caller to pass a repo object with no branches

Greg Ward greg-hg at gerg.ca
Tue Jul 6 11:01:07 CDT 2010


# HG changeset patch
# User Greg Ward <greg-hg at gerg.ca>
# Date 1278429662 14400
# Branch stable
# Node ID 5147d16ed6570d34ab84cfb6d77f5422fba655dc
# Parent  2eaaad99f2f0d041d61a4b10f0b56101e4efd2a9
clone: allow caller to pass a repo object with no branches.

This restores a convenient API feature that worked in 1.5.x and was
broken by 3d6915f5a2bb.

diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -19,7 +19,10 @@
     return (os.path.isfile(path) and bundlerepo or localrepo)
 
 def addbranchrevs(lrepo, repo, branches, revs):
-    hashbranch, branches = branches
+    if branches:
+        hashbranch, branches = branches
+    else:
+        hashbranch = None
     if not hashbranch and not branches:
         return revs or None, revs and revs[0] or None
     revs = revs and list(revs) or []


More information about the Mercurial-devel mailing list