Sun Nov 15 17:32:06 PST 2009 [email protected]
* add versioned show files functionality (darcs show files -p 'some
patch')
Thomas, can you post a follow-up patch to make --no-pending the default
when invoked with -p? An option that does not work by default is not
very convenient.
The rest is ok.
New patches:
[add versioned show files functionality (darcs show files -p 'some
patch')
>> This is needed for convenience and flagset consistency.
manifest_cmd :: ([DarcsFlag] -> Slurpy -> [FilePath]) -> [DarcsFlag] ->
[String] -> IO ()
manifest_cmd to_list opts _ = do
- list <- (to_list opts) `fmap` withRepository opts slurp
+ list <- (to_list opts) `fmap` withRepository opts myslurp
mapM_ output list
hunk ./src/Darcs/Commands/ShowFiles.lhs 97
- where slurp :: RepoPatch p => Repository p C(r u r) -> IO Slurpy
- slurp = if NoPending `notElem` opts
- then slurp_pending else slurp_recorded
+ where myslurp :: RepoPatch p => Repository p C(r u r) -> IO Slurpy
+ myslurp = do let isPending = NoPending `notElem` opts
+ isRevisioned = have_nonrange_match opts
+ case (isPending, isRevisioned) of
+ (True,False) -> slurp_pending
+ (False,True) -> slurp_revision opts
+ (False,False) -> slurp_recorded
+ (True,True) -> error $ unlines ["Can't mix
pending option (default) with revisioned show files; ",
+ "perhaps you
want darcs <your cmd> --no-pending ?"]
output_null name = do { putStr name ; putChar '\0' }
output = if NullFlag `elem` opts then output_null else
putStrLn
>> The argument-handling logic could be externalized to the Arguments
and Flags modules. Either way, -p should imply --no-pending with that
command (and with all commands since it is only ever used here).
hunk ./src/Darcs/Commands/ShowFiles.lhs 108
+
+slurp_revision :: RepoPatch p => [DarcsFlag] -> Repository p C(r u r)
-> IO Slurpy
+slurp_revision opts r = withDelayedDir "revisioned.showfiles" $ \_ ->
do
+ get_nonrange_match r opts
+ slurp =<< getCurrentDirectory
+
>> The logic is good: create a snapshot of the repository at a given >>
patch, then slurp at that date. Why not use virtualTreeIO like in
>> showContents? I think this would be more performant than slurping
>> (Petr, can you comment on that?)
_______________________________________________
darcs-users mailing list
[email protected]
http://lists.osuosl.org/mailman/listinfo/darcs-users