[darcs-users] feature request: darcs show files for a particular rev / moment in time of repo

Eric Kow kowey at darcs.net
Tue Apr 7 15:55:17 UTC 2009


It's certainly to see patch-tag folks working on darcs proper!

On Mon, Apr 06, 2009 at 23:24:26 -0700, Thomas Hartman wrote:
> first, modify arguments to have an argument type of patch, tag, or match
> pattern, but not index range.
> 
> thartman at ubuntu:~/haskellInstalls/darcs.net>darcs diff
> src/Darcs/Arguments.lhs
> 57c57
> <                          changes_format, match_one_context,
> match_one_nontag,
> ---
> >                          changes_format, match_one_context,
> match_one_nontag, match_one_nonrange,
> 626c626,627
> < match_one = concat_options [__match, __patch, __tag, __index]
> ---
> > match_one_nonrange = concat_options [__match, __patch, __tag]
> > match_one = concat_options [__match, __patch, __tag, __index] -- this
> seems kinda wrong. __index is a range.

It might be useful to realise that the flag --match is not the
same --matches.  Likewise, the flag --index (singular) is not
the same as --index (plural, perhaps calling it --indexes would
be reasonable).

So  --match   and --index (singular) match single patches.
And --matches and --index (plural)   match multiple patches.

I would suggest not worrying about the --index flag (if we accept
--matches, there isn't any reason not to accept --index, and darcs
show files --index=4-5

In short, I am fairly confident you can get away without any
modifications to Darcs.Arguments.  If you're curious, have a look at
Darcs.Match to see how these get used.  Matching is a delicate art,
with lots of subtle semantic differences depending on what command
you're using.  It's fun!

> Then, modify Darcs/Commands/ShowFiles.lhs (attached)

Perhaps somebody else look at this?

> key snip below.
> 
> If anyone can point me to where I'm going wrong, it would be aweseom!
> 
> manifest_cmd :: ([DarcsFlag] -> Slurpy -> [FilePath]) -> [DarcsFlag] ->
> [String] -> IO ()
> manifest_cmd to_list opts _ = do
>     list <- (to_list opts) `fmap` ( withRepository opts $ \repository -> do
>       formerdir <- getCurrentDirectory
>       thename <- return $ takeFileName formerdir
>       withTempDir thename $ \dir -> do
>         if have_nonrange_match opts
>           then createPristineDirectoryTree repository (toFilePath dir)
>           else error "should have nonrange match"
>         slurp repository
>       -- slurp
> repository
> 
>     )
>     mapM_ output list
>     where slurp :: RepoPatch p => Repository p C(r u r) -> IO Slurpy
>           slurp = if NoPending `notElem` opts
>                   then slurp_pending else slurp_recorded
>           output_null name = do { putStr name ; putChar '\0' }
>           output = if NullFlag `elem` opts then output_null else putStrLn

How about darcs sending us a patch?

-- 
Eric Kow <http://www.nltg.brighton.ac.uk/home/Eric.Kow>
PGP Key ID: 08AC04F9
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL: <http://lists.osuosl.org/pipermail/darcs-users/attachments/20090407/a75edddd/attachment.pgp>


More information about the darcs-users mailing list