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

Matthew Elder matt at mattelder.org
Tue Apr 7 15:01:43 UTC 2009


I hope the darcs gurus can get this functionality in the main line :)

On Mon, Apr 6, 2009 at 11:24 PM, Thomas Hartman <
thomashartman1 at googlemail.com> wrote:

> So, I tried to implement this. So far no success, but I think I may be
> close.
>
> 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.
>
> Then, modify Darcs/Commands/ShowFiles.lhs (attached)
>
> 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
>
>
>
> On Thu, Apr 2, 2009 at 3:38 PM, Thomas Hartman <
> thomashartman1 at googlemail.com> wrote:
>
>> I would like to be able to use the flags
>>
>>   --match=PATTERN       select a single patch matching PATTERN
>>   -p REGEXP  --patch=REGEXP        select a single patch matching REGEXP
>>   -t REGEXP  --tag=REGEXP          select tag matching REGEXP
>>
>> for
>>
>> darcs query files (aka darcs show files)
>>
>> Currently, these flags work for
>>
>> darcs query contents
>>
>> but not files.
>>
>> I think
>>
>>   -n N-M     --index=N-M           select a range of patches
>>
>> makes no sense in a query files context, but I could be overlooking
>> something, in which case I would want that too.
>>
>> The ability to get an idea of repository state at a point in time would
>> enable me to implement github-style repository browsing for patch-tag
>>
>> I am currently looking at another way to do this, based on (ab)using
>> filestore library functions, but it's a bit of a kludge.
>>
>> Of course, I need this mainly for doing directory listings at a
>> point-in-time. darcs query files for a single file should just list the file
>> if it exists, otherwise an error message, I think.
>>
>>
>> --
>> Thomas Hartman
>>
>> Darcs hosting: patch-tag.com
>> The elegance of haskell, the simplicity of php: happstack.com
>>
>
>
>
> --
> Thomas Hartman
>
> Darcs hosting: patch-tag.com
> The elegance of haskell, the simplicity of php: happstack.com
>



-- 
Need somewhere to put your code? http://patch-tag.com
Want to build a webapp? http://happstack.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osuosl.org/pipermail/darcs-users/attachments/20090407/36ea4187/attachment.htm>


More information about the darcs-users mailing list