[PATCH V2] clone: allow clones into effectively empty directories

Jason Harris jason at jasonfharris.com
Wed Apr 6 03:33:01 CDT 2011


On Apr 6, 2011, at 10:17 AM, Dominik Psenner wrote:

>> -----Original Message-----
>> From: mercurial-devel-bounces at selenic.com [mailto:mercurial-devel-
>> bounces at selenic.com] On Behalf Of Jason Harris
>> Sent: Tuesday, April 05, 2011 2:13 PM
>> To: Frank Kingswood
>> Cc: mercurial-devel at selenic.com
>> Subject: Re: [PATCH V2] clone: allow clones into effectively empty
>> directories
>> 
>> On Apr 5, 2011, at 1:46 PM, Frank Kingswood wrote:
>> 
>>> On 05/04/11 11:58, Jason Harris wrote:
>>>> # HG changeset patch
>>>> # User jfh<jason at jasonfharris.com>
>>>> # Date 1301985969 -7200
>>>> # Node ID 730ee0bb855649b63c93318434e657b3432fa1dd
>>>> # Parent  0995eee8ffe4a24478379fb16fd6c38812bc3dd5
>>>> clone: allow clones into effectively empty directories
>>>> 
>>>> In OSX many empty directories actually have a '.DS_Store' file
>>>> in them, which is effectively ignored by lots of things.  The
>>>> presence of this .DS_Store file shouldn't mean that the directory
>>>> is treated as though it really has stuff in it.
>>>> 
>>>> Similarly, ignore the thumbs.db and desktop.ini files for windows
>>>> support.
>>> 
>>> This is getting far too magic for my liking. What if someone actually
>> has such a file in his repository?
>> 
>> It doesn't matter if such a file is in a repository. The question is: if
>> you clone into a directory and the directory is to all essentially
>> purposes empty. Should we still bail even if there is OS cruft in the
>> directory? Right now if its totally empty then Mercurial allows the clone
>> into the directory. This patch changes things so that if there is a
>> directory and it *only* contains something like a '.DS_Store' file it
>> means that the user has created this in the OSX finder and we should be
>> able to clone a repo *into* that directory, and so we allow the clone. (It
>> certainly is not hard to imagine a user creating a folder in the windows
>> explorer or the OSX finder and then wanting to clone into it...)
>> 
>> (Actually I created this patch in response to:
>> https://bitbucket.org/jfh/machg/issue/222)
>> 
>> Its not of course a critical issue, and maybe we would want these files to
>> be platform specific? 
> 
> *uoh* What if I mounted a winX folder into unix?

Well with V2 of the patch you would still be able to clone into that directory. With patch V1 it wouldn't work and the user would have to go remove the trivial OS cruft and then repeat the operation. If mercurial does clone into the directory with OS cruft files, the cruft files would stick around and they wouldn't be touched... Nothing bad would happen. So currently if you have an "effectively" empty winX directory and you mount it into unix, then I think you should be able to clone into it...

Simple.

However, this isn't a critical issue to me, I / we can easily work around this in MacHg. Ie in MacHg we can simply blow away the OS cruft file before cloning into the then totally empty directory. In fact this is exactly what one of my contributors Stephen Greene has done with this patch for MacHg here:

https://bitbucket.org/greenesd/machg/changeset/4391646af20e

I just thought it was cleaner for Mercurial proper to do this... I still think it is.

Cheers,
  Jas


> Certainly the case of anyone ever having a single
>> directory with the file .DS_Store in windows or linux and them actually
>> storing useful information in this single file is pretty vanishingly
>> small...
>> 
>> 
>>> Really this is just a change to allow users to avoid the stop-and-think
>> when overwriting a directory -- it is not really all that much work to
>> delete a directory.
>> 
>> Its a small detail, but it smooths the process on OSX, for users. A good
>> UI just does such things unobtrusively and without hassling the user.
>> 
>> Cheers,
>>  Jas
>> _______________________________________________
>> Mercurial-devel mailing list
>> Mercurial-devel at selenic.com
>> http://selenic.com/mailman/listinfo/mercurial-devel
> 
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel



More information about the Mercurial-devel mailing list