hg.clone(ui, repo) always crashes
Greg Ward
greg at gerg.ca
Tue Jul 6 10:17:37 CDT 2010
OK, I know I can't expect a stable API, that I have to port my
extensions and stuff for every major release. That's OK. But this
simple script:
"""
from mercurial import ui, hg
ui = ui.ui()
repo = hg.repository(ui, '.')
hg.clone(repo.ui, repo, dest='/tmp/foo')
"""
is guaranteed to crash under 1.6. In particular, if you pass a
non-string to hg.clone as 'source', a crash is inevitable. Proof: if
source is not a string, we set branch = None. Then we pass None to
addbranchrevs() as branches. addbranchrevs() assumes that branches is
an iterable of length 2 so it crashes:
Traceback (most recent call last):
File "testclone", line 5, in <module>
hg.clone(repo.ui, repo, dest='/tmp/foo')
File "/home/gward/src/hg-crew-stable/mercurial/hg.py", line 226, in clone
rev, checkout = addbranchrevs(src_repo, src_repo, branch, rev)
File "/home/gward/src/hg-crew-stable/mercurial/hg.py", line 22, in
addbranchrevs
hashbranch, branches = branches
TypeError: 'NoneType' object is not iterable
I bisected and found:
changeset: 11322:3d6915f5a2bb
user: Sune Foldager <cryo at cyanite.org>
date: 2010-06-10 12:46:09 +0200
summary: improve --branch processing (and differentiate from # syntax)
Looks like an easy fix to restore the old behaviour.
Greg
More information about the Mercurial-devel
mailing list