better command name

This commit is contained in:
Joey Hess 2011-10-31 15:18:41 -04:00
parent 09861cf4f7
commit 3d3e1c4c25
6 changed files with 16 additions and 18 deletions

View file

@ -5,7 +5,7 @@
- Licensed under the GNU GPL version 3 or higher. - Licensed under the GNU GPL version 3 or higher.
-} -}
module Command.SetContent where module Command.Reinject where
import Common.Annex import Common.Annex
import Command import Command
@ -14,7 +14,7 @@ import Annex.Content
import qualified Command.Fsck import qualified Command.Fsck
def :: [Command] def :: [Command]
def = [command "setcontent" (paramPair paramPath paramPath) seek def = [command "reinject" (paramPair paramPath paramPath) seek
"sets content of annexed file"] "sets content of annexed file"]
seek :: [CommandSeek] seek :: [CommandSeek]
@ -22,7 +22,7 @@ seek = [withWords start]
start :: [FilePath] -> CommandStart start :: [FilePath] -> CommandStart
start (src:dest:[]) = do start (src:dest:[]) = do
showStart "setcontent" dest showStart "reinject" dest
next $ perform src dest next $ perform src dest
start _ = error "specify a src file and a dest file" start _ = error "specify a src file and a dest file"

View file

@ -26,7 +26,7 @@ import qualified Command.Copy
import qualified Command.Get import qualified Command.Get
import qualified Command.FromKey import qualified Command.FromKey
import qualified Command.DropKey import qualified Command.DropKey
import qualified Command.SetContent import qualified Command.Reinject
import qualified Command.Fix import qualified Command.Fix
import qualified Command.Init import qualified Command.Init
import qualified Command.Describe import qualified Command.Describe
@ -63,7 +63,7 @@ cmds = concat
, Command.Init.def , Command.Init.def
, Command.Describe.def , Command.Describe.def
, Command.InitRemote.def , Command.InitRemote.def
, Command.SetContent.def , Command.Reinject.def
, Command.Unannex.def , Command.Unannex.def
, Command.Uninit.def , Command.Uninit.def
, Command.PreCommit.def , Command.PreCommit.def

2
debian/changelog vendored
View file

@ -13,7 +13,7 @@ git-annex (3.20111026) UNRELEASED; urgency=low
.gitattributes information about numcopies is not available in a bare .gitattributes information about numcopies is not available in a bare
repository. repository.
* unused, dropunused: Now work in bare repositories. * unused, dropunused: Now work in bare repositories.
* Removed the setkey command, and added a setcontent command with a more * Removed the setkey command, and added a reinject command with a more
useful interface. useful interface.
* The fromkey command now takes the key as its first parameter. The --key * The fromkey command now takes the key as its first parameter. The --key
option is no longer used. option is no longer used.

View file

@ -4,6 +4,5 @@
subject="comment 4" subject="comment 4"
date="2011-05-14T16:29:35Z" date="2011-05-14T16:29:35Z"
content=""" content="""
Although, if you really do want to shoot yourself in the foot, or know you Now available as `git-annex reinject`.
have the old content, you can use `git-annex setcontent`.
"""]] """]]

View file

@ -274,19 +274,18 @@ subdirectories).
However, if a backend changes the information it uses to construct a key, However, if a backend changes the information it uses to construct a key,
this can also be used to migrate files to use the new key format. this can also be used to migrate files to use the new key format.
* setcontent src dest * reinject src dest
Makes the dest file, which must already be tracked by git-annex have the Moves the src file into the annex as the content of the dest file.
content of the src file. The src file is removed. This can be useful if you This can be useful if you have obtained the content of a file from
have obtained the content of a file from elsewhere and want to put it in elsewhere and want to put it in the local annex.
the local annex.
Automatically runs fsck on dest to check that the expected content was Automatically runs fsck on dest to check that the expected content was
provided. provided.
Example: Example:
git annex setcontent /tmp/foo.iso foo.iso git annex reinject /tmp/foo.iso foo.iso
* unannex [path ...] * unannex [path ...]

View file

@ -88,7 +88,7 @@ blackbox = TestLabel "blackbox" $ TestList
-- test order matters, later tests may rely on state from earlier -- test order matters, later tests may rely on state from earlier
[ test_init [ test_init
, test_add , test_add
, test_setcontent , test_reinject
, test_unannex , test_unannex
, test_drop , test_drop
, test_get , test_get
@ -140,13 +140,13 @@ test_add = "git-annex add" ~: TestList [basic, sha1dup, subdirs]
changeWorkingDirectory "dir" changeWorkingDirectory "dir"
git_annex "add" ["-q", "../dir2"] @? "add of ../subdir failed" git_annex "add" ["-q", "../dir2"] @? "add of ../subdir failed"
test_setcontent :: Test test_reinject :: Test
test_setcontent = "git-annex setcontent/fromkey" ~: TestCase $ intmpclonerepo $ do test_reinject = "git-annex reinject/fromkey" ~: TestCase $ intmpclonerepo $ do
git_annex "drop" ["-q", "--force", sha1annexedfile] @? "drop failed" git_annex "drop" ["-q", "--force", sha1annexedfile] @? "drop failed"
writeFile tmp $ content sha1annexedfile writeFile tmp $ content sha1annexedfile
r <- annexeval $ Types.Backend.getKey backendSHA1 tmp r <- annexeval $ Types.Backend.getKey backendSHA1 tmp
let key = show $ fromJust r let key = show $ fromJust r
git_annex "setcontent" ["-q", tmp, sha1annexedfile] @? "setcontent failed" git_annex "reinject" ["-q", tmp, sha1annexedfile] @? "reinject failed"
git_annex "fromkey" ["-q", key, sha1annexedfiledup] @? "fromkey failed" git_annex "fromkey" ["-q", key, sha1annexedfiledup] @? "fromkey failed"
annexed_present sha1annexedfiledup annexed_present sha1annexedfiledup
where where