[issue1668] hg clone into an existing, empty directory should not Abort clone

Rich mercurial-bugs at selenic.com
Mon May 18 20:28:27 CDT 2009


New submission from Rich <richietommy at yahoo.com>:

This behaviour is especially vexing with TortoiseHG, but is a pain from the
shell as well. I've only been using HG for a day, but it annoyed me enough to
spend 20 minutes and hunt down the culprit.

So, in a shell, the following currently happens:

~$ mkdir new_repo
~$ hg clone http://repository.com/new_repo new_repo/
http authorization required
realm: Repository
user: rich
password: 
abort: destination 'new_repo/' already exists

So my proposed solution is in the case that the directory already exists, check
if it is empty, and if it is, go ahead and clone anyway. Doesn't that make more
sense? Expected behaviour:

~$ mkdir new_repo
~$ hg clone http://repository.com/new_repo new_repo/
http authorization required
realm: Repository
user: rich
password: 
requesting all changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1573 changes to 1573 files
updating working directory
1573 files updated, 0 files merged, 0 files removed, 0 files unresolved

See the attached patch for the solution (it's against
mercurial-common_1.2.1+hg20090518-7893-592c454477c6-0ppa1 from whoever's
bleeding edge PPA). Thanks,

-Rich

----------
files: hg.patch
messages: 9366
nosy: hotspoons
priority: feature
status: unread
title: hg clone into an existing, empty directory should not Abort clone
topic: clone

____________________________________________________
Mercurial issue tracker <mercurial-bugs at selenic.com>
<http://www.selenic.com/mercurial/bts/issue1668>
____________________________________________________
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hg.patch
Type: text/x-patch
Size: 635 bytes
Desc: not available
Url : http://selenic.com/pipermail/mercurial-devel/attachments/20090519/b06d5922/attachment.bin 


More information about the Mercurial-devel mailing list