Re: [darcs-devel] Re: darcs patch: Windows hard link support

2006-12-14 Thread Juliusz Chroboczek
Simon,

Looking further at your patch, I'm not quite sure whether you're
looking at the right place.  Please forgive me if the below is obvious
for you.

There are two places where Darcs will create hard links: (1) when
doing``darcs get'' on a local filesystem, and (2) when runninng 
``darcs optimize --relink''.

The function maybe_relink, which is the one you tried to patch, is
only used by (2).  Now (1) is implemented differently: it calls
copyFilesOrUrls, which in turn calls copyLocals, which in turn calls
copyLocal which is in External.hs and is implemented as so:

  copyLocal fou out = createLink fou out `catchall` cloneFile fou out

  cloneFile source dest = readFilePS source >>= writeFilePS dest

So in order to get hard links on Windows when doing ``darcs get'',
you've got two solutions -- you can either implement
System.Posix.Files.createLink on Windows within the Ghc libraries
(surely the preferred solution), or provide us with an implentation of
createLink that works under Windows and that we'll substitute for
Ghc's version within Darcs.

(In case you find yourself confused by the package structure: there's
an extra indirection through a module ``Workaround'' which is
generated by configure.)

Juliusz

___
darcs-devel mailing list
darcs-devel@darcs.net
http://www.abridgegame.org/cgi-bin/mailman/listinfo/darcs-devel


RE: [darcs-devel] Re: darcs patch: Windows hard link support

2006-12-14 Thread Simon Marlow
Juliusz Chroboczek wrote:
> Looking further at your patch, I'm not quite sure whether you're
> looking at the right place.  Please forgive me if the below is
> obvious for you.
>
> There are two places where Darcs will create hard links: (1) when
> doing``darcs get'' on a local filesystem, and (2) when runninng
> ``darcs optimize --relink''.
>
> The function maybe_relink, which is the one you tried to patch, is
> only used by (2).  Now (1) is implemented differently: it calls
> copyFilesOrUrls, which in turn calls copyLocals, which in turn calls
> copyLocal which is in External.hs and is implemented as so:
>
>   copyLocal fou out = createLink fou out `catchall` cloneFile fou out
>
>   cloneFile source dest = readFilePS source >>= writeFilePS dest
>
> So in order to get hard links on Windows when doing ``darcs get'',
> you've got two solutions -- you can either implement
> System.Posix.Files.createLink on Windows within the Ghc libraries
> (surely the preferred solution), or provide us with an implentation of
> createLink that works under Windows and that we'll substitute for
> Ghc's version within Darcs.
>
> (In case you find yourself confused by the package structure: there's
> an extra indirection through a module ``Workaround'' which is
> generated by configure.)

Thanks Juliusz - actually I did realise this after I submitted the patch.  One 
reason for the confusion was that I timed a 'darcs get' from a local repo using 
my installed darcs against the newly built one, and the new one was much 
faster, so I declared success :-)   I guess the speedup must be due to 
something else - maybe the System.Process switch that was also in my local copy.

Cheers,
Simon

___
darcs-devel mailing list
darcs-devel@darcs.net
http://www.abridgegame.org/cgi-bin/mailman/listinfo/darcs-devel


Re: [darcs-devel] Re: darcs patch: Windows hard link support

2006-12-11 Thread Eric Y. Kow
> >I don't understand Windows -- but that looks completely bogus to me.
> >Does it obey the description in the comment just below?
> 
> Er.  Ok, I completely failed to understand what maybe_relink() was supposed 
> to do, and didn't notice that it should compare the files before attempting 
> to link.  Sorry about that, please ignore the patch, maybe I'll submit a 
> fixed one at some point.

Thanks for watching carefully, Juliusz.  I have rolled this patch back.

Argh... sorry about that, everybody.  My lessons are to read surronding
code more carefully, watch for suspicious stuff like the Windows code
being so much shorter that the Unix stuff, and pay close attention to
inner nuts and bolts.

Simon:
  Please note that you'll probably want to pull in both your patch and
  the rollback before submitting a new one.

Juliusz:
  Will you be able to advise on any new patches on this?
  I definitely plan on moving with much more care on this code.

-- 
Eric Kow http://www.loria.fr/~kow
PGP Key ID: 08AC04F9 Merci de corriger mon français.


pgpKvTnT1NaC6.pgp
Description: PGP signature
___
darcs-devel mailing list
darcs-devel@darcs.net
http://www.abridgegame.org/cgi-bin/mailman/listinfo/darcs-devel


[darcs-devel] Re: darcs patch: Windows hard link support

2006-12-11 Thread Simon Marlow

Juliusz Chroboczek wrote:

+#define _WIN32_WINNT 0x0500
+#include 
hunk ./maybe_relink.c 39
-return 0;
+BOOL result;
+result = CreateHardLink(src, dst, NULL);
+if (!result)
+return 0;
+else
+return -2;
}



I don't understand Windows -- but that looks completely bogus to me.
Does it obey the description in the comment just below?


Er.  Ok, I completely failed to understand what maybe_relink() was supposed to 
do, and didn't notice that it should compare the files before attempting to 
link.  Sorry about that, please ignore the patch, maybe I'll submit a fixed one 
at some point.


Cheers,
Simon


___
darcs-devel mailing list
darcs-devel@darcs.net
http://www.abridgegame.org/cgi-bin/mailman/listinfo/darcs-devel