hg clone MY_REPO "" fails with the python errors attached. Obviously it doesn't make sense to clone to a blank target directory, but a sensible error message would be nice. hg --version : 1.7.1 uname -r : 2.6.35-23-generic python --version : 2.6.6 tail -4 ~/.hgrc : [extensions] rebase = mq = color =
yep. It only happens if source repository is not copiable. A nice way to reproduce is to try to clone from a bundle. Following patch can fix makedirs: # HG changeset patch # User Nicolas Dumazet <nicdumz.commits@gmail.com> # Date 1291106892 -32400 # Branch stable # Node ID f4852cdaec01c70005b893e4fc087188d67690c1 # Parent 417f3c27983bcb6ab95b169801edc63c5c138dcf util: do not recurse in makedirs if name is '' (issue2528) diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -844,7 +844,7 @@ except OSError, err: if err.errno == errno.EEXIST: return - if err.errno != errno.ENOENT: + if not name or err.errno != errno.ENOENT: raise parent = os.path.abspath(os.path.dirname(name)) makedirs(parent, mode) diff --git a/tests/test-bundle.t b/tests/test-bundle.t --- a/tests/test-bundle.t +++ b/tests/test-bundle.t @@ -399,6 +399,13 @@ $ rm -r full-clone +When cloning from a non-copiable repository into '', do not +recurse infinitely (issue 2528) + + $ hg clone full.hg '' + abort: No such file or directory + [255] + test for http://mercurial.selenic.com/bts/issue216 Unbundle incremental bundles into fresh empty in one go But in reality, we might run into troubles in other areas: os.path.realpath('') is equivalent to os.path.realpath('.'): localrepo(path='', create=False) will work on ./.hg/ ... nasty!
Hmm... what do you mean by "not copiable"? The repo is over ssh so I can't directly cp it, but I can scp it and hg clone it. The most sensible solution seems to me to fail consistently, as you're effectively asking hg to clone into a directory with no name. It seems OK to clone to ./ though (as if you had not passed a third argument).
Fixed by http://selenic.com/repo/hg/rev/2649be11ab0b Nicolas Dumazet <nicdumz.commits@gmail.com> util: do not recurse in makedirs if name is '' (issue2528) (please test the fix)
Sorry, I thought the patch had already been reviewed and tested. It does fix the problem, but "No such file or directory" isn't really the correct error msg. "hg clone MY_REPO local_dir" should work fine as long as local_dir *doesn't* exist.
hgbot is only a robot, updating issues after pushes, no worries ;) In my opinion '' is not a valid directory: in reality I can't think of a straightforward meaning of '' as a directory specification. But we're still discussing it and how to handle this... Opinions may vary and I should not be the only one to decide. There are a lot of places in code where passing '' doesn't really make sense. For instance, if path is everything but '', makedirs works perfectly. os.path functions handle it with different standards... Maybe some toplevel code could replace '' by '.' after a clear user warning? In the mean time, aborting is not perfect/could be better, but it is still better than a nasty opaque infinite recursion ;)
Yes, I agree it's better than infinite recursion. The only reason I marked it as cbb was that, purely from a user's perspective, "abort: No such file or directory" doesn't really indicate what was wrong with the clone they just attempted. The problem isn't that the path they passed doesn't exist, but rather that they passed an illegal path. I agree though that it's ambiguous what the user's intention was in passing "".
--- Bug imported by bugzilla@serpentine.com 2012-05-12 09:15 EDT --- This bug was previously known as _bug_ 2528 at http://mercurial.selenic.com/bts/issue2528 Imported an attachment (id=1487)
Bulk close: no activity for >2 years -> WONTFIX
Bulk change recent WONTFIX -> new, more descriptive ARCHIVED state (sorry for the spam)