[darcs-users] [patch267] Accept issue1860: (Un)applying move patc... (and 2 more)

Petr Rockai me at mornfall.net
Sun Jun 6 18:38:58 UTC 2010


Eric Kow <kowey at darcs.net> writes:

> On Sun, Jun 06, 2010 at 17:02:26 +0100, Eric Kow wrote:
>> > Sun Jun  6 16:21:25 CEST 2010  Petr Rockai <me at mornfall.net>
>> > +renameChanged from to = modify $ \st -> st { changed = rename' $ changed st }
>> > +  where rename' = S.fromList . map renameone . S.toList
>
> There's S.map if you're interested.
>
>> > +        renameone x | from `isPrefix` x = to `catPaths` relative from x
>> > +                    | otherwise = x
>> > +        relative (AnchoredPath from) (AnchoredPath x) = AnchoredPath $ drop (length from) x
>
>> Do we have to worry about things like initial/trailing slashes in from
>> and x?
>
> Also, will this do the right thing if from is something like "foo" and x
> is something like "foobar"?
AnchoredPath is a list of path components, not of characters... all the
cases you mention should be covered quite well (no slash characters are
allowed in AnchoredPath ever and components cannot interfere in this way
either).

Yours,
   Petr.


More information about the darcs-users mailing list