Permalink
Browse files

Handle limit parameter when not USE_MAXCOUNT in darcs.

Ignore-this: 3e0bfc78606643fec408be8508f66148

darcs-hash:20120523052039-0f649-e33070e67de0004754e64a21c5dfcabdd5b40bae.gz
  • Loading branch information...
jgm committed May 23, 2012
1 parent 1743aee commit 7049d0f401b918c648b19732094c743df418050a
Showing with 10 additions and 2 deletions.
  1. +10 −2 Data/FileStore/Darcs.hs
View
@@ -123,7 +123,14 @@ darcsLog repo names (TimeRange begin end) mblimit = do
if status == ExitSuccess
then case parseDarcsXML $ toString output of
Nothing -> throwIO ResourceExists
- Just parsed -> return parsed
+ Just parsed -> return $
+#ifdef USE_MAXCOUNT
+ parsed
+#else
+ case mblimit of
+ Just lim -> take lim parsed
+ Nothing -> parsed
+#endif
else throwIO $ UnknownError $ "darcs changes returned error status.\n" ++ err
where
opts = timeOpts begin end ++ limit
@@ -167,7 +174,8 @@ darcsLatestRevId repo name = do
let patchs = parseDarcsXML $ toString output
case patchs of
Nothing -> throwIO NotFound
- Just as -> if null as then throwIO NotFound else return $ revId $ head as
+ Just [] -> throwIO NotFound
+ Just (x:_) -> return $ revId x
-- | Retrieve the contents of a resource.
darcsRetrieve :: Contents a

0 comments on commit 7049d0f

Please sign in to comment.