tweak
This commit is contained in:
parent
d9fdc76a14
commit
24b35113cf
1 changed files with 12 additions and 10 deletions
|
@ -63,7 +63,7 @@ showLog file ps = do
|
||||||
zone <- liftIO getCurrentTimeZone
|
zone <- liftIO getCurrentTimeZone
|
||||||
sets <- mapM (getset newref) ps
|
sets <- mapM (getset newref) ps
|
||||||
previous <- maybe (return genesis) (getset oldref) (lastMaybe ps)
|
previous <- maybe (return genesis) (getset oldref) (lastMaybe ps)
|
||||||
mapM_ (diff zone) $ zip sets (drop 1 sets ++ [previous])
|
mapM_ (diff file zone) $ zip sets (drop 1 sets ++ [previous])
|
||||||
where
|
where
|
||||||
genesis = (0, S.empty)
|
genesis = (0, S.empty)
|
||||||
getset select change = do
|
getset select change = do
|
||||||
|
@ -71,15 +71,14 @@ showLog file ps = do
|
||||||
return (changetime change, s)
|
return (changetime change, s)
|
||||||
get ref = map toUUID . Logs.Presence.getLog . L.unpack <$>
|
get ref = map toUUID . Logs.Presence.getLog . L.unpack <$>
|
||||||
catObject ref
|
catObject ref
|
||||||
diff zone ((ts, new), (_, old)) = do
|
|
||||||
let time = show $ utcToLocalTime zone $
|
diff :: FilePath -> TimeZone -> ((POSIXTime, S.Set UUID), (POSIXTime, S.Set UUID)) -> Annex ()
|
||||||
posixSecondsToUTCTime ts
|
diff file zone ((ts, new), (_, old)) = output True added >> output False removed
|
||||||
output time True added
|
|
||||||
output time False removed
|
|
||||||
where
|
where
|
||||||
added = S.difference new old
|
added = S.difference new old
|
||||||
removed = S.difference old new
|
removed = S.difference old new
|
||||||
output time present s = do
|
time = showTimeStamp zone ts
|
||||||
|
output present s = do
|
||||||
rs <- map (dropWhile isSpace) . lines <$>
|
rs <- map (dropWhile isSpace) . lines <$>
|
||||||
Remote.prettyPrintUUIDs "log" (S.toList s)
|
Remote.prettyPrintUUIDs "log" (S.toList s)
|
||||||
liftIO $ mapM_ (putStrLn . format) rs
|
liftIO $ mapM_ (putStrLn . format) rs
|
||||||
|
@ -123,3 +122,6 @@ parseRaw l = (Git.Ref oldsha, Git.Ref newsha)
|
||||||
parseTimeStamp :: String -> POSIXTime
|
parseTimeStamp :: String -> POSIXTime
|
||||||
parseTimeStamp = utcTimeToPOSIXSeconds . fromMaybe (error "bad timestamp") .
|
parseTimeStamp = utcTimeToPOSIXSeconds . fromMaybe (error "bad timestamp") .
|
||||||
parseTime defaultTimeLocale "%s"
|
parseTime defaultTimeLocale "%s"
|
||||||
|
|
||||||
|
showTimeStamp :: TimeZone -> POSIXTime -> String
|
||||||
|
showTimeStamp zone = show . utcToLocalTime zone . posixSecondsToUTCTime
|
||||||
|
|
Loading…
Reference in a new issue