From ba0334116cd8811d49b96cd39dd83e565e0bedb7 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 15 Sep 2012 20:46:38 -0400 Subject: [PATCH] more descriptive name for oneshot --- Annex/Content.hs | 4 ++-- CmdLine.hs | 6 +++--- Command.hs | 9 +++++---- Command/ConfigList.hs | 2 +- Command/DropKey.hs | 2 +- Command/InAnnex.hs | 2 +- Command/RecvKey.hs | 2 +- Command/SendKey.hs | 2 +- Command/TransferKey.hs | 2 +- Command/Version.hs | 2 +- Command/WebApp.hs | 2 +- Command/Whereis.hs | 2 +- Types/Command.hs | 2 +- 13 files changed, 20 insertions(+), 19 deletions(-) diff --git a/Annex/Content.hs b/Annex/Content.hs index e944ea62fb..fab27d88a3 100644 --- a/Annex/Content.hs +++ b/Annex/Content.hs @@ -298,9 +298,9 @@ getKeysPresent = liftIO . traverse (2 :: Int) =<< fromRepo gitAnnexObjectDir - especially if performing a short-lived action. -} saveState :: Bool -> Annex () -saveState oneshot = doSideAction $ do +saveState nocommit = doSideAction $ do Annex.Queue.flush - unless oneshot $ + unless nocommit $ whenM alwayscommit $ Annex.Branch.commit "update" where diff --git a/CmdLine.hs b/CmdLine.hs index edbe5e107d..b3aeb57aa4 100644 --- a/CmdLine.hs +++ b/CmdLine.hs @@ -43,7 +43,7 @@ dispatch fuzzyok allargs allcmds commonoptions fields header getgitrepo = do forM_ fields $ \(f, v) -> Annex.setField f v sequence_ flags prepCommand cmd params - tryRun state' cmd $ [startup] ++ actions ++ [shutdown $ cmdoneshot cmd] + tryRun state' cmd $ [startup] ++ actions ++ [shutdown $ cmdnocommit cmd] where err msg = msg ++ "\n\n" ++ usage header allcmds commonoptions cmd = Prelude.head cmds @@ -112,8 +112,8 @@ startup = return True {- Cleanup actions. -} shutdown :: Bool -> Annex Bool -shutdown oneshot = do - saveState oneshot +shutdown nocommit = do + saveState nocommit sequence_ =<< M.elems <$> Annex.getState Annex.cleanup liftIO Git.Command.reap -- zombies from long-running git processes sshCleanup -- ssh connection caching diff --git a/Command.hs b/Command.hs index cbffd39fa5..ce45599c8d 100644 --- a/Command.hs +++ b/Command.hs @@ -8,7 +8,7 @@ module Command ( command, noRepo, - oneShot, + noCommit, withOptions, next, stop, @@ -43,9 +43,10 @@ import Annex.CheckAttr command :: String -> String -> [CommandSeek] -> String -> Command command = Command [] Nothing commonChecks False -{- Makes a command run in oneshot mode. -} -oneShot :: Command -> Command -oneShot c = c { cmdoneshot = True } +{- Indicates that a command doesn't need to commit any changes to + - the git-annex branch. -} +noCommit :: Command -> Command +noCommit c = c { cmdnocommit = True } {- Adds a fallback action to a command, that will be run if it's used - outside a git repository. -} diff --git a/Command/ConfigList.hs b/Command/ConfigList.hs index fc4ba91022..505ad99e1b 100644 --- a/Command/ConfigList.hs +++ b/Command/ConfigList.hs @@ -12,7 +12,7 @@ import Command import Annex.UUID def :: [Command] -def = [oneShot $ command "configlist" paramNothing seek +def = [noCommit $ command "configlist" paramNothing seek "outputs relevant git configuration"] seek :: [CommandSeek] diff --git a/Command/DropKey.hs b/Command/DropKey.hs index d55c5e83a3..c0d4f85cfe 100644 --- a/Command/DropKey.hs +++ b/Command/DropKey.hs @@ -15,7 +15,7 @@ import Annex.Content import Types.Key def :: [Command] -def = [oneShot $ command "dropkey" (paramRepeating paramKey) seek +def = [noCommit $ command "dropkey" (paramRepeating paramKey) seek "drops annexed content for specified keys"] seek :: [CommandSeek] diff --git a/Command/InAnnex.hs b/Command/InAnnex.hs index ad0a4d5c7c..ac4af8d0bc 100644 --- a/Command/InAnnex.hs +++ b/Command/InAnnex.hs @@ -12,7 +12,7 @@ import Command import Annex.Content def :: [Command] -def = [oneShot $ command "inannex" (paramRepeating paramKey) seek +def = [noCommit $ command "inannex" (paramRepeating paramKey) seek "checks if keys are present in the annex"] seek :: [CommandSeek] diff --git a/Command/RecvKey.hs b/Command/RecvKey.hs index 0606f9c510..6db6ed41bc 100644 --- a/Command/RecvKey.hs +++ b/Command/RecvKey.hs @@ -16,7 +16,7 @@ import Logs.Transfer import Command.SendKey (fieldTransfer) def :: [Command] -def = [oneShot $ command "recvkey" paramKey seek +def = [noCommit $ command "recvkey" paramKey seek "runs rsync in server mode to receive content"] seek :: [CommandSeek] diff --git a/Command/SendKey.hs b/Command/SendKey.hs index 8f914b5ed1..aa6d5c4fce 100644 --- a/Command/SendKey.hs +++ b/Command/SendKey.hs @@ -15,7 +15,7 @@ import Logs.Transfer import qualified Fields def :: [Command] -def = [oneShot $ command "sendkey" paramKey seek +def = [noCommit $ command "sendkey" paramKey seek "runs rsync in server mode to send content"] seek :: [CommandSeek] diff --git a/Command/TransferKey.hs b/Command/TransferKey.hs index 1af95f1708..ed6fbb68c6 100644 --- a/Command/TransferKey.hs +++ b/Command/TransferKey.hs @@ -19,7 +19,7 @@ import qualified Option def :: [Command] def = [withOptions options $ - oneShot $ command "transferkey" paramKey seek + noCommit $ command "transferkey" paramKey seek "transfers a key from or to a remote"] options :: [Option] diff --git a/Command/Version.hs b/Command/Version.hs index af08d3d709..4cc5cb4aec 100644 --- a/Command/Version.hs +++ b/Command/Version.hs @@ -13,7 +13,7 @@ import qualified Build.SysConfig as SysConfig import Annex.Version def :: [Command] -def = [oneShot $ noRepo showPackageVersion $ dontCheck repoExists $ +def = [noCommit $ noRepo showPackageVersion $ dontCheck repoExists $ command "version" paramNothing seek "show version info"] seek :: [CommandSeek] diff --git a/Command/WebApp.hs b/Command/WebApp.hs index a7d00738ff..ae37b324c3 100644 --- a/Command/WebApp.hs +++ b/Command/WebApp.hs @@ -31,7 +31,7 @@ import Control.Concurrent import Control.Concurrent.STM def :: [Command] -def = [oneShot $ noRepo startNoRepo $ dontCheck repoExists $ +def = [noCommit $ noRepo startNoRepo $ dontCheck repoExists $ command "webapp" paramNothing seek "launch webapp"] seek :: [CommandSeek] diff --git a/Command/Whereis.hs b/Command/Whereis.hs index b697bf5541..c77b3a02ca 100644 --- a/Command/Whereis.hs +++ b/Command/Whereis.hs @@ -15,7 +15,7 @@ import Remote import Logs.Trust def :: [Command] -def = [command "whereis" paramPaths seek +def = [noCommit $ command "whereis" paramPaths seek "lists repositories that have file content"] seek :: [CommandSeek] diff --git a/Types/Command.hs b/Types/Command.hs index c5020d112f..24413ebadc 100644 --- a/Types/Command.hs +++ b/Types/Command.hs @@ -38,7 +38,7 @@ data Command = Command { cmdoptions :: [Option] -- command-specific options , cmdnorepo :: Maybe (IO ()) -- an action to run when not in a repo , cmdcheck :: [CommandCheck] -- check stage - , cmdoneshot :: Bool -- don't save state after running + , cmdnocommit :: Bool -- don't commit journalled state changes , cmdname :: String , cmdparamdesc :: String -- description of params for usage , cmdseek :: [CommandSeek] -- seek stage