[darcs-users] post-hoc move

Lele Gaifax lele at nautilus.homeip.net
Fri Jul 31 14:54:46 UTC 2009


On Fri, 31 Jul 2009 15:32:09 +0100
Hamish Allan <hamish at gmail.com> wrote:

> On Fri, Jul 31, 2009 at 2:47 PM, Isaac
> Dupree<ml at isaac.cedarswampstudios.org> wrote:
> 
> > But that's scary!  Unix mv overwrites the destination file, and --
> > on the surface -- darcs move seems to include such an mv!
> 
> I'd recommend trying not to think of darcs move being anything like
> unix mv. Otherwise, you might end up specifying a directory as the
> target for a file, meaning "move this file to this directory", whereas
> darcs will treat it as "overwrite this directory with this file".
> 

Dunno where that fear come from, never happened to me, and I'm not
able to reproduce it. Consider:

    $ mkdir subdir
    $ darcs add subdir
    $ darcs move a.txt subdir
    $ darcs wha -s
     ./a.txt -> ./subdir/a.txt
    A ./subdir/
    $ mkdir unknowndir
    $ darcs move b.txt unknowndir

    darcs failed:  The target directory unknowndir isn't known in working directory, did you forget to add it?

So, darcs refuses to move a file in a not-yet-covered dir. And:

    $ touch c.txt
    $ touch d.txt
    $ darcs move b.txt d.txt

    darcs failed:  A file or dir named d.txt (or perhaps differing only in case)
    already exists in working directory.
    Use --case-ok to allow files differing only in case.
    $ darcs add c.txt
    $ darcs move b.txt c.txt

    darcs failed:  A file or dir named c.txt (or perhaps differing only in case)
    already exists in working directory.
    Use --case-ok to allow files differing only in case.

Darcs refuses to overwrite another file, either "known" or not. So,
yes, you are right suggesting that "darcs mv != unix mv", in the sense
that Isaac's fear isn't real.

ciao, lele.
-- 
nickname: Lele Gaifax    | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas    | comincerò ad aver paura di chi mi copia.
lele at nautilus.homeip.net |                 -- Fortunato Depero, 1929.


More information about the darcs-users mailing list