Skip to content

Commit

Permalink
Use 'darcs show' rather than 'darcs query'.
Browse files Browse the repository at this point in the history
darcs query has been removed from recent versions.
  • Loading branch information
jgm committed Feb 14, 2017
1 parent 0e3b42f commit 85c05c1
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions Data/FileStore/Darcs.hs
Expand Up @@ -49,7 +49,7 @@ darcsFileStore repo = FileStore {
, directory = darcsDirectory repo
, search = darcsSearch repo
, idsMatch = const hashsMatch repo }

-- | Run a darcs command and return error status, error output, standard output. The repository
-- is used as working directory.
runDarcsCommand :: FilePath -> String -> [String] -> IO (ExitCode, String, B.ByteString)
Expand Down Expand Up @@ -187,13 +187,14 @@ darcsRetrieve repo name mbId = do
let opts = case mbId of
Nothing -> ["contents", name]
Just revid -> ["contents", "--match=hash " ++ revid, name]
(status, err, output) <- runDarcsCommand repo "query" opts
(status, err, output) <- runDarcsCommand repo "show" opts
if B.null output
then do
(_, _, out) <- runDarcsCommand repo "query" (["files", "--no-directories"] ++ opts)
(_, _, out) <- runDarcsCommand repo "show" (["files", "--no-directories"] ++ opts)
if B.null out || null (filter (== name) . getNames $ output)
then throwIO NotFound else return ()
else return ()
then throwIO NotFound
else return ()
else return ()
if status == ExitSuccess
then return $ fromByteString output
else throwIO $ UnknownError $ "Error in darcs query contents:\n" ++ err
Expand Down

0 comments on commit 85c05c1

Please sign in to comment.