inprogress: Support --key
This commit is contained in:
parent
92c566f1b2
commit
7fd5376334
6 changed files with 44 additions and 32 deletions
17
CHANGELOG
17
CHANGELOG
|
@ -1,11 +1,5 @@
|
|||
git-annex (7.20191115) UNRELEASED; urgency=medium
|
||||
git-annex (7.20191218) upstream; urgency=medium
|
||||
|
||||
* Sped up many git-annex commands that operate on many files, by
|
||||
avoiding reserialization of keys.
|
||||
find is 7% faster; whereis is 3% faster; and git-annex get when
|
||||
all files are already present is 5% faster
|
||||
* Stop displaying rsync progress, and use git-annex's own progress display
|
||||
for local-to-local repo transfers.
|
||||
* git-lfs: The url provided to initremote/enableremote will now be
|
||||
stored in the git-annex branch, allowing enableremote to be used without
|
||||
an url. initremote --sameas can be used to add additional urls.
|
||||
|
@ -14,6 +8,13 @@ git-annex (7.20191115) UNRELEASED; urgency=medium
|
|||
* sync, assistant: Pull and push from git-lfs remotes.
|
||||
* Fix bug that made bare repos be treated as non-bare when --git-dir
|
||||
was used.
|
||||
* inprogress: Support --key.
|
||||
* Sped up many git-annex commands that operate on many files, by
|
||||
avoiding reserialization of keys.
|
||||
find is 7% faster; whereis is 3% faster; and git-annex get when
|
||||
all files are already present is 5% faster
|
||||
* Stop displaying rsync progress, and use git-annex's own progress display
|
||||
for local-to-local repo transfers.
|
||||
* benchmark: Changed --databases to take a parameter specifiying the size
|
||||
of the database to benchmark.
|
||||
* benchmark --databases: Display size of the populated database.
|
||||
|
@ -22,7 +23,7 @@ git-annex (7.20191115) UNRELEASED; urgency=medium
|
|||
* Windows: Fix handling of changes to time zone. (Used to work but was
|
||||
broken in version 7.20181031.)
|
||||
|
||||
-- Joey Hess <id@joeyh.name> Fri, 15 Nov 2019 11:57:19 -0400
|
||||
-- Joey Hess <id@joeyh.name> Wed, 18 Dec 2019 13:53:51 -0400
|
||||
|
||||
git-annex (7.20191114) upstream; urgency=medium
|
||||
|
||||
|
|
|
@ -176,21 +176,26 @@ data KeyOptions
|
|||
parseKeyOptions :: Parser KeyOptions
|
||||
parseKeyOptions = parseAllOption
|
||||
<|> parseBranchKeysOption
|
||||
<|> flag' WantUnusedKeys
|
||||
( long "unused" <> short 'U'
|
||||
<> help "operate on files found by last run of git-annex unused"
|
||||
)
|
||||
<|> (WantSpecificKey <$> option (str >>= parseKey)
|
||||
( long "key" <> metavar paramKey
|
||||
<> help "operate on specified key"
|
||||
))
|
||||
<|> parseUnusedKeysOption
|
||||
<|> parseSpecificKeyOption
|
||||
|
||||
parseUnusedKeysOption :: Parser KeyOptions
|
||||
parseUnusedKeysOption = flag' WantUnusedKeys
|
||||
( long "unused" <> short 'U'
|
||||
<> help "operate on files found by last run of git-annex unused"
|
||||
)
|
||||
|
||||
parseSpecificKeyOption :: Parser KeyOptions
|
||||
parseSpecificKeyOption = WantSpecificKey <$> option (str >>= parseKey)
|
||||
( long "key" <> metavar paramKey
|
||||
<> help "operate on specified key"
|
||||
)
|
||||
|
||||
parseBranchKeysOption :: Parser KeyOptions
|
||||
parseBranchKeysOption =
|
||||
WantBranchKeys <$> some (option (str >>= pure . Ref)
|
||||
( long "branch" <> metavar paramRef
|
||||
<> help "operate on files in the specified branch or treeish"
|
||||
))
|
||||
parseBranchKeysOption = WantBranchKeys <$> some (option (str >>= pure . Ref)
|
||||
( long "branch" <> metavar paramRef
|
||||
<> help "operate on files in the specified branch or treeish"
|
||||
))
|
||||
|
||||
parseFailedTransfersOption :: Parser KeyOptions
|
||||
parseFailedTransfersOption = flag' WantFailedTransfers
|
||||
|
|
|
@ -19,24 +19,24 @@ cmd = noCommit $ noMessages $ command "inprogress" SectionQuery
|
|||
|
||||
data InprogressOptions = InprogressOptions
|
||||
{ inprogressFiles :: CmdParams
|
||||
, allOption :: Bool
|
||||
, keyOptions :: Maybe KeyOptions
|
||||
}
|
||||
|
||||
optParser :: CmdParamsDesc -> Parser InprogressOptions
|
||||
optParser desc = InprogressOptions
|
||||
<$> cmdParams desc
|
||||
<*> switch
|
||||
( long "all"
|
||||
<> short 'A'
|
||||
<> help "access all files currently being downloaded"
|
||||
)
|
||||
<*> optional (parseAllOption <|> parseSpecificKeyOption)
|
||||
|
||||
seek :: InprogressOptions -> CommandSeek
|
||||
seek o = do
|
||||
ts <- map (transferKey . fst) <$> getTransfers
|
||||
if allOption o
|
||||
then forM_ ts $ commandAction . start'
|
||||
else do
|
||||
case keyOptions o of
|
||||
Just WantAllKeys ->
|
||||
forM_ ts $ commandAction . start'
|
||||
Just (WantSpecificKey k)
|
||||
| k `elem` ts -> commandAction (start' k)
|
||||
| otherwise -> commandAction stop
|
||||
_ -> do
|
||||
let s = S.fromList ts
|
||||
withFilesInGit
|
||||
(commandAction . (whenAnnexed (start s)))
|
||||
|
|
|
@ -40,6 +40,10 @@ some file formats can be usefully streamed in this way.
|
|||
Rather than specifying a filename or path, this option can be
|
||||
used to access all files that are currently being downloaded.
|
||||
|
||||
* `--key=keyname`
|
||||
|
||||
Access the file that is currently being downloaded for the specified key.
|
||||
|
||||
* file matching options
|
||||
|
||||
The [[git-annex-matching-options]](1)
|
||||
|
@ -47,7 +51,7 @@ some file formats can be usefully streamed in this way.
|
|||
|
||||
# EXIT STATUS
|
||||
|
||||
If any of the requested files are not currently being downloaded,
|
||||
If any of the requested items are not currently being downloaded,
|
||||
the exit status will be 1.
|
||||
|
||||
# SEE ALSO
|
||||
|
|
|
@ -6,3 +6,5 @@ Please consider adding a `--key` option there, which would display the single in
|
|||
My use case is serving git-annexed files to the web from a bare repository (<https://gitlab.com/chrysn/annex-to-web>, see also [[todo/git-annex-cat]]), which would be especially useful with gitolite repositories as they are by design bare, and on devices where checkouts are cumbersome (cf. [[forum/Dealing_with_crippled_Android_file_system]]).
|
||||
|
||||
A workaround is running `git annex inprogress --all | grep $KEY`, but that's probably relying on an implementation detail that could be changed at any time (though it probably won't as to avoid race conditions as in `tail -f $(git annex inprogress file-thats-almost.done)`).
|
||||
|
||||
> [[done]] --[[Joey]]
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
Name: git-annex
|
||||
Version: 7.20191114
|
||||
Version: 7.20191218
|
||||
Cabal-Version: >= 1.8
|
||||
License: AGPL-3
|
||||
Maintainer: Joey Hess <id@joeyh.name>
|
||||
|
|
Loading…
Reference in a new issue