On Fri, Sep 12, 2008 at 06:58:12PM -0700, Jason Dagit wrote:
> On Fri, Sep 12, 2008 at 10:38 AM, David Roundy <[EMAIL PROTECTED]> wrote:
> > Here's a fix for a bug that shows up when you try
> >
> > darcs put remote.server:
> >
> > And then a refactor to get rid of those Regexes.
> 
> Personal style preference here:
> +is_url :: String -> Bool
> +is_url (':':'/':'/':_) = True
> +is_url (_:x) = is_url x
> +is_url "" = False
> 
> The first case is a little hard for me to read just due to all the
> quotes and colons.
>
> is_url :: String -> Bool
> is_url "" = False
> is_url s = "://" `isPrefixOf` s || is_url (tail s)

It's a bit awkward to read, but I  don't think it's too hard,  and I
prefer to avoid (when possible) using standard library functions that I
don't  know when they've been added.  It would be nice if that were
documented (is it?).

> Also, will we run into problems if I do:
> mkdir :
> echo 'hi!' > :/blah
> darcs add ://blah
> 
> Are there any commands down the road that I could do with the path
> "://blah" that are going to fail?


You've already got problems if you're including ':' in your paths, as darcs
doesn't support this.  That's not quite true, as your  example will
probably work  fine, since darcs add already knows that it's being given  a
file/directory argument, and doesn't call is_file.  Certainly  if you do

mkdir http:
cd http:
mkdir foo
cd foo
darcs init
cd ../..
darcs get http://foo

things will go crazy.  The simple rule is that if it contains a colon in
any position but the second character, it's not a file.  We could  indeed
extend  this rule to say that paths beginning with a colon might  also be
files, but I don't see a  huge  demand for that.

David
_______________________________________________
darcs-users mailing list
darcs-users@darcs.net
http://lists.osuosl.org/mailman/listinfo/darcs-users

Reply via email to