reinit: New command that can initialize a new reposotory using the configuration of a previously known repository. Useful if a repository got deleted and you want to clone it back the way it was.

This commit is contained in:
Joey Hess 2014-04-15 20:13:35 -04:00
parent 162565d928
commit 915d038bec
8 changed files with 81 additions and 11 deletions

38
Command/Reinit.hs Normal file
View file

@ -0,0 +1,38 @@
{- git-annex command
-
- Copyright 2014 Joey Hess <joey@kitenet.net>
-
- Licensed under the GNU GPL version 3 or higher.
-}
module Command.Reinit where
import Common.Annex
import Command
import Annex.Init
import Annex.UUID
import Types.UUID
import qualified Remote
def :: [Command]
def = [dontCheck repoExists $
command "reinit" (paramUUID ++ " or " ++ paramDesc) seek SectionUtility ""]
seek :: CommandSeek
seek = withWords start
start :: [String] -> CommandStart
start ws = do
showStart "reinit" s
next $ perform s
where
s = unwords ws
perform :: String -> CommandPerform
perform s = do
u <- if isUUID s
then return $ toUUID s
else Remote.nameToUUID s
storeUUID u
initialize'
next $ return True