metadata: Fix reversion introduced in 5.20150727 that caused display of metadata to not work.
This commit is contained in:
parent
d54c9c46da
commit
0f66f766b0
3 changed files with 22 additions and 18 deletions
|
@ -33,11 +33,11 @@ withFilesInGit :: (FilePath -> CommandStart) -> CmdParams -> CommandSeek
|
||||||
withFilesInGit a params = seekActions $ prepFiltered a $
|
withFilesInGit a params = seekActions $ prepFiltered a $
|
||||||
seekHelper LsFiles.inRepo params
|
seekHelper LsFiles.inRepo params
|
||||||
|
|
||||||
withFilesInGitNonRecursive :: (FilePath -> CommandStart) -> CmdParams -> CommandSeek
|
withFilesInGitNonRecursive :: String -> (FilePath -> CommandStart) -> CmdParams -> CommandSeek
|
||||||
withFilesInGitNonRecursive a params = ifM (Annex.getState Annex.force)
|
withFilesInGitNonRecursive needforce a params = ifM (Annex.getState Annex.force)
|
||||||
( withFilesInGit a params
|
( withFilesInGit a params
|
||||||
, if null params
|
, if null params
|
||||||
then needforce
|
then error needforce
|
||||||
else seekActions $ prepFiltered a (getfiles [] params)
|
else seekActions $ prepFiltered a (getfiles [] params)
|
||||||
)
|
)
|
||||||
where
|
where
|
||||||
|
@ -51,8 +51,7 @@ withFilesInGitNonRecursive a params = ifM (Annex.getState Annex.force)
|
||||||
[] -> do
|
[] -> do
|
||||||
void $ liftIO $ cleanup
|
void $ liftIO $ cleanup
|
||||||
getfiles c ps
|
getfiles c ps
|
||||||
_ -> needforce
|
_ -> error needforce
|
||||||
needforce = error "Not recursively setting metadata. Use --force to do that."
|
|
||||||
|
|
||||||
withFilesNotInGit :: Bool -> (FilePath -> CommandStart) -> CmdParams -> CommandSeek
|
withFilesNotInGit :: Bool -> (FilePath -> CommandStart) -> CmdParams -> CommandSeek
|
||||||
withFilesNotInGit skipdotfiles a params
|
withFilesNotInGit skipdotfiles a params
|
||||||
|
|
|
@ -27,12 +27,12 @@ data MetaDataOptions = MetaDataOptions
|
||||||
, keyOptions :: Maybe KeyOptions
|
, keyOptions :: Maybe KeyOptions
|
||||||
}
|
}
|
||||||
|
|
||||||
data GetSet = Get MetaField | Set [ModMeta]
|
data GetSet = Get MetaField | GetAll | Set [ModMeta]
|
||||||
|
|
||||||
optParser :: CmdParamsDesc -> Parser MetaDataOptions
|
optParser :: CmdParamsDesc -> Parser MetaDataOptions
|
||||||
optParser desc = MetaDataOptions
|
optParser desc = MetaDataOptions
|
||||||
<$> cmdParams desc
|
<$> cmdParams desc
|
||||||
<*> ((Get <$> getopt) <|> (Set <$> many modopts))
|
<*> ((Get <$> getopt) <|> (Set <$> some modopts) <|> pure GetAll)
|
||||||
<*> optional (parseKeyOptions False)
|
<*> optional (parseKeyOptions False)
|
||||||
where
|
where
|
||||||
getopt = option (eitherReader mkMetaField)
|
getopt = option (eitherReader mkMetaField)
|
||||||
|
@ -57,7 +57,9 @@ seek o = do
|
||||||
now <- liftIO getPOSIXTime
|
now <- liftIO getPOSIXTime
|
||||||
let seeker = case getSet o of
|
let seeker = case getSet o of
|
||||||
Get _ -> withFilesInGit
|
Get _ -> withFilesInGit
|
||||||
|
GetAll -> withFilesInGit
|
||||||
Set _ -> withFilesInGitNonRecursive
|
Set _ -> withFilesInGitNonRecursive
|
||||||
|
"Not recursively setting metadata. Use --force to do that."
|
||||||
withKeyOptions (keyOptions o) False
|
withKeyOptions (keyOptions o) False
|
||||||
(startKeys now o)
|
(startKeys now o)
|
||||||
(seeker $ whenAnnexed $ start now o)
|
(seeker $ whenAnnexed $ start now o)
|
||||||
|
@ -71,23 +73,24 @@ startKeys = start' Nothing
|
||||||
|
|
||||||
start' :: AssociatedFile -> POSIXTime -> MetaDataOptions -> Key -> CommandStart
|
start' :: AssociatedFile -> POSIXTime -> MetaDataOptions -> Key -> CommandStart
|
||||||
start' afile now o k = case getSet o of
|
start' afile now o k = case getSet o of
|
||||||
Set ms -> do
|
|
||||||
showStart' "metadata" k afile
|
|
||||||
next $ perform now ms k
|
|
||||||
Get f -> do
|
Get f -> do
|
||||||
l <- S.toList . currentMetaDataValues f <$> getCurrentMetaData k
|
l <- S.toList . currentMetaDataValues f <$> getCurrentMetaData k
|
||||||
liftIO $ forM_ l $
|
liftIO $ forM_ l $
|
||||||
putStrLn . fromMetaValue
|
putStrLn . fromMetaValue
|
||||||
stop
|
stop
|
||||||
|
_ -> do
|
||||||
|
showStart' "metadata" k afile
|
||||||
|
next $ perform now o k
|
||||||
|
|
||||||
|
perform :: POSIXTime -> MetaDataOptions -> Key -> CommandPerform
|
||||||
|
perform now o k = case getSet o of
|
||||||
|
Set ms -> do
|
||||||
|
oldm <- getCurrentMetaData k
|
||||||
|
let m = combineMetaData $ map (modMeta oldm) ms
|
||||||
|
addMetaData' k m now
|
||||||
|
next $ cleanup k
|
||||||
|
_ -> next $ cleanup k
|
||||||
|
|
||||||
perform :: POSIXTime -> [ModMeta] -> Key -> CommandPerform
|
|
||||||
perform _ [] k = next $ cleanup k
|
|
||||||
perform now ms k = do
|
|
||||||
oldm <- getCurrentMetaData k
|
|
||||||
let m = combineMetaData $ map (modMeta oldm) ms
|
|
||||||
addMetaData' k m now
|
|
||||||
next $ cleanup k
|
|
||||||
|
|
||||||
cleanup :: Key -> CommandCleanup
|
cleanup :: Key -> CommandCleanup
|
||||||
cleanup k = do
|
cleanup k = do
|
||||||
l <- map unwrapmeta . fromMetaData <$> getCurrentMetaData k
|
l <- map unwrapmeta . fromMetaData <$> getCurrentMetaData k
|
||||||
|
|
2
debian/changelog
vendored
2
debian/changelog
vendored
|
@ -34,6 +34,8 @@ git-annex (5.20150732) UNRELEASED; urgency=medium
|
||||||
built using the cryptonite library.
|
built using the cryptonite library.
|
||||||
* Improve Setup.hs file so that cabal copy --destdir works.
|
* Improve Setup.hs file so that cabal copy --destdir works.
|
||||||
Thanks, Magnus Therning.
|
Thanks, Magnus Therning.
|
||||||
|
* metadata: Fix reversion introduced in 5.20150727 that caused display
|
||||||
|
of metadata to not work.
|
||||||
|
|
||||||
-- Joey Hess <id@joeyh.name> Fri, 31 Jul 2015 12:31:39 -0400
|
-- Joey Hess <id@joeyh.name> Fri, 31 Jul 2015 12:31:39 -0400
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue