Add plumbing-level lookupkey command.
This commit is contained in:
parent
f0cf4d1861
commit
7d5b25515c
5 changed files with 37 additions and 1 deletions
|
@ -119,7 +119,7 @@ catKeyChecked needhead ref@(Ref r) =
|
||||||
- For command-line git-annex use, that doesn't matter. It's perfectly
|
- For command-line git-annex use, that doesn't matter. It's perfectly
|
||||||
- reasonable for things staged in the index after the currently running
|
- reasonable for things staged in the index after the currently running
|
||||||
- git-annex process to not be noticed by it. However, we do want to see
|
- git-annex process to not be noticed by it. However, we do want to see
|
||||||
- what's in the index, since it may have uncommitted changes not in HEAD>
|
- what's in the index, since it may have uncommitted changes not in HEAD
|
||||||
-
|
-
|
||||||
- For the assistant, this is much more of a problem, since it commits
|
- For the assistant, this is much more of a problem, since it commits
|
||||||
- files and then needs to be able to immediately look up their keys.
|
- files and then needs to be able to immediately look up their keys.
|
||||||
|
|
26
Command/LookupKey.hs
Normal file
26
Command/LookupKey.hs
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
{- git-annex command
|
||||||
|
-
|
||||||
|
- Copyright 2013 Joey Hess <joey@kitenet.net>
|
||||||
|
-
|
||||||
|
- Licensed under the GNU GPL version 3 or higher.
|
||||||
|
-}
|
||||||
|
|
||||||
|
module Command.LookupKey where
|
||||||
|
|
||||||
|
import Common.Annex
|
||||||
|
import Command
|
||||||
|
import Annex.CatFile
|
||||||
|
import Types.Key
|
||||||
|
|
||||||
|
def :: [Command]
|
||||||
|
def = [notBareRepo $
|
||||||
|
command "lookupkey" (paramRepeating paramFile) seek
|
||||||
|
SectionPlumbing "looks up key used for file"]
|
||||||
|
|
||||||
|
seek :: [CommandSeek]
|
||||||
|
seek = [withStrings start]
|
||||||
|
|
||||||
|
start :: String -> CommandStart
|
||||||
|
start file = do
|
||||||
|
liftIO . maybe exitFailure (putStrLn . key2file) =<< catKeyFile file
|
||||||
|
stop
|
|
@ -20,6 +20,7 @@ import qualified Command.Drop
|
||||||
import qualified Command.Move
|
import qualified Command.Move
|
||||||
import qualified Command.Copy
|
import qualified Command.Copy
|
||||||
import qualified Command.Get
|
import qualified Command.Get
|
||||||
|
import qualified Command.LookupKey
|
||||||
import qualified Command.FromKey
|
import qualified Command.FromKey
|
||||||
import qualified Command.DropKey
|
import qualified Command.DropKey
|
||||||
import qualified Command.TransferKey
|
import qualified Command.TransferKey
|
||||||
|
@ -124,6 +125,7 @@ cmds = concat
|
||||||
, Command.Schedule.def
|
, Command.Schedule.def
|
||||||
, Command.Ungroup.def
|
, Command.Ungroup.def
|
||||||
, Command.Vicfg.def
|
, Command.Vicfg.def
|
||||||
|
, Command.LookupKey.def
|
||||||
, Command.FromKey.def
|
, Command.FromKey.def
|
||||||
, Command.DropKey.def
|
, Command.DropKey.def
|
||||||
, Command.TransferKey.def
|
, Command.TransferKey.def
|
||||||
|
|
1
debian/changelog
vendored
1
debian/changelog
vendored
|
@ -1,6 +1,7 @@
|
||||||
git-annex (5.20131214) UNRELEASED; urgency=low
|
git-annex (5.20131214) UNRELEASED; urgency=low
|
||||||
|
|
||||||
* Fix test suite to cover lock --force change.
|
* Fix test suite to cover lock --force change.
|
||||||
|
* Add plumbing-level lookupkey command.
|
||||||
|
|
||||||
-- Joey Hess <joeyh@debian.org> Sun, 15 Dec 2013 13:32:49 -0400
|
-- Joey Hess <joeyh@debian.org> Sun, 15 Dec 2013 13:32:49 -0400
|
||||||
|
|
||||||
|
|
|
@ -727,6 +727,13 @@ subdirectories).
|
||||||
point to annexed content. Also handles injecting changes to unlocked
|
point to annexed content. Also handles injecting changes to unlocked
|
||||||
files into the annex.
|
files into the annex.
|
||||||
|
|
||||||
|
* `lookupkey [file ...]`
|
||||||
|
|
||||||
|
This plumbing-level command looks up the key used for a file in the
|
||||||
|
index. The key is output to stdout. If there is no key (because
|
||||||
|
the file is not added to git, or is not a git-annex managed file),
|
||||||
|
nothing is output, and it exits nonzero.
|
||||||
|
|
||||||
* `fromkey key file`
|
* `fromkey key file`
|
||||||
|
|
||||||
This plumbing-level command can be used to manually set up a file
|
This plumbing-level command can be used to manually set up a file
|
||||||
|
|
Loading…
Reference in a new issue