git-annex/Command/Merge.hs

38 lines
885 B
Haskell
Raw Normal View History

2011-06-22 22:46:45 +00:00
{- git-annex command
-
- Copyright 2011, 2013 Joey Hess <id@joeyh.name>
2011-06-22 22:46:45 +00:00
-
- Licensed under the GNU AGPL version 3 or higher.
2011-06-22 22:46:45 +00:00
-}
module Command.Merge where
import Command
2011-10-04 04:40:47 +00:00
import qualified Annex.Branch
import Annex.CurrentBranch
import Command.Sync (prepMerge, mergeLocal, mergeConfig)
2011-06-22 22:46:45 +00:00
cmd :: Command
cmd = command "merge" SectionMaintenance
"automatically merge changes from remotes"
paramNothing (withParams seek)
2011-06-22 22:46:45 +00:00
seek :: CmdParams -> CommandSeek
seek _ = do
commandAction mergeBranch
commandAction mergeSynced
2011-06-22 22:46:45 +00:00
mergeBranch :: CommandStart
mergeBranch = do
showStart' "merge" (Just "git-annex")
next $ do
Annex.Branch.update
-- commit explicitly, in case no remote branches were merged
Annex.Branch.commit =<< Annex.Branch.commitMessage
next $ return True
2011-06-22 22:46:45 +00:00
mergeSynced :: CommandStart
mergeSynced = do
prepMerge
mergeLocal mergeConfig def =<< getCurrentBranch