--branch, stage 1

Added --branch option to copy, drop, fsck, get, metadata, mirror, move, and
whereis commands. This option makes git-annex operate on files that are
included in a specified branch (or other treeish).

The names of the files from the branch that are being operated on are not
displayed yet; only the keys. Displaying the filenames will need changes
to every affected command.

Also, note that --branch can be specified repeatedly. This is not really
documented, but seemed worth supporting, especially since we may later want
the ability to operate on all branches matching a refspec. However, when
operating on two branches that contain the same key, that key will be
operated on twice.
This commit is contained in:
Joey Hess 2016-07-20 12:05:22 -04:00
parent 948bcf3125
commit bf8bf14e8e
Failed to extract signature
13 changed files with 96 additions and 18 deletions

View file

@ -141,6 +141,7 @@ data KeyOptions
| WantUnusedKeys
| WantSpecificKey Key
| WantIncompleteKeys
| WantBranchKeys [Branch]
parseKeyOptions :: Bool -> Parser KeyOptions
parseKeyOptions allowincomplete = if allowincomplete
@ -152,6 +153,10 @@ parseKeyOptions allowincomplete = if allowincomplete
else base
where
base = parseAllOption
<|> WantBranchKeys <$> many (option (str >>= pure . Ref)
( long "branch" <> metavar paramRef
<> help "operate on files in the specified branch or treeish"
))
<|> flag' WantUnusedKeys
( long "unused" <> short 'U'
<> help "operate on files found by last run of git-annex unused"