[darcs-users] [patch303] DRAFT Resolve issue1891: implement darcs revert -o/-O.
Eric Kow
kowey at darcs.net
Thu Jul 15 12:27:10 UTC 2010
Not a review, just a question.
DRAFT Resolve issue1891: implement darcs revert -o/-O.
------------------------------------------------------
> revertCmd :: [DarcsFlag] -> [String] -> IO ()
> revertCmd opts args = withRepoLock opts $- \repository -> do
> hunk ./src/Darcs/Commands/Revert.lhs 97
> changes <- unrecordedChanges opts repository files
> let pre_changed_files = applyToFilepaths (invert changes) (map toFilePath files)
> rec <- readRecorded repository
> + let unrevert ps | Just out <- getOutput opts "stash.dpatch" =
> + do allpatches <- newset2RL `fmap` readRepo repository -- TODO minimize the context here?
> + date <- getDate opts
> + author <- getAuthor opts
> + info <- (patchinfo date "stash" author [])
> + savetoBundle opts allpatches $ n2pia (infopatch info $ fromPrims ps) :>: NilFL
> + putStrLn $ "To unrevert this patch, use darcs apply " ++ show' out ++ ",\n"
> + ++ "followed by darcs unrecord or darcs amend --edit."
> + | otherwise = writeUnrevert repository ps rec NilFL
> + show' = drop 1 . init . show
What exactly happens if the stash file already exists?
I seem to remember that darcs send -o just clobbers it, but in the case
of stashing, would that be desirable? (Particularly if the user just
does a revert -O stash-dir)
> +
> Sealed touching_changes <- return (chooseTouching pre_changed_files changes)
> (case touching_changes of
> NilFL -> putStrLn "There are no changes to revert!"
> hunk ./src/Darcs/Commands/Revert.lhs 128
> addToPending repository $ invert p
> when (Debug `elem` opts) $ putStrLn "About to write the unrevert file."
> case commute (norevert:>p) of
> - Just (p':>_) -> writeUnrevert repository p' rec NilFL
> + Just (p':>_) -> unrevert p'
> - Nothing -> writeUnrevert repository (norevert+>+p) rec NilFL
> + Nothing -> unrevert (norevert+>+p)
What's happened here?
--
Eric Kow <http://www.nltg.brighton.ac.uk/home/Eric.Kow>
For a faster response, please try +44 (0)1273 64 2905.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.osuosl.org/pipermail/darcs-users/attachments/20100715/61e40ba0/attachment.pgp>
More information about the darcs-users
mailing list