2011-06-22 22:46:45 +00:00
|
|
|
{- git-annex command
|
|
|
|
-
|
2015-01-21 16:50:09 +00:00
|
|
|
- Copyright 2011, 2013 Joey Hess <id@joeyh.name>
|
2011-06-22 22:46:45 +00:00
|
|
|
-
|
|
|
|
- Licensed under the GNU GPL version 3 or higher.
|
|
|
|
-}
|
|
|
|
|
|
|
|
module Command.Merge where
|
|
|
|
|
|
|
|
import Command
|
2011-10-04 04:40:47 +00:00
|
|
|
import qualified Annex.Branch
|
2018-10-19 19:17:48 +00:00
|
|
|
import Annex.CurrentBranch
|
|
|
|
import Command.Sync (prepMerge, mergeLocal, mergeConfig)
|
2011-06-22 22:46:45 +00:00
|
|
|
|
2015-07-08 16:33:27 +00:00
|
|
|
cmd :: Command
|
2015-07-08 19:08:02 +00:00
|
|
|
cmd = command "merge" SectionMaintenance
|
2015-07-08 16:33:27 +00:00
|
|
|
"automatically merge changes from remotes"
|
2015-07-08 19:08:02 +00:00
|
|
|
paramNothing (withParams seek)
|
2011-06-22 22:46:45 +00:00
|
|
|
|
2015-07-08 19:08:02 +00:00
|
|
|
seek :: CmdParams -> CommandSeek
|
2017-02-17 18:04:43 +00:00
|
|
|
seek _ = do
|
|
|
|
commandAction mergeBranch
|
|
|
|
commandAction mergeSynced
|
2011-06-22 22:46:45 +00:00
|
|
|
|
2013-07-03 19:42:56 +00:00
|
|
|
mergeBranch :: CommandStart
|
|
|
|
mergeBranch = do
|
2017-11-28 18:40:26 +00:00
|
|
|
showStart' "merge" (Just "git-annex")
|
2013-07-03 19:42:56 +00:00
|
|
|
next $ do
|
|
|
|
Annex.Branch.update
|
|
|
|
-- commit explicitly, in case no remote branches were merged
|
2018-08-02 18:06:06 +00:00
|
|
|
Annex.Branch.commit =<< Annex.Branch.commitMessage
|
2013-07-03 19:42:56 +00:00
|
|
|
next $ return True
|
2011-06-22 22:46:45 +00:00
|
|
|
|
2013-07-03 19:42:56 +00:00
|
|
|
mergeSynced :: CommandStart
|
|
|
|
mergeSynced = do
|
2013-09-13 18:55:55 +00:00
|
|
|
prepMerge
|
2018-10-19 19:17:48 +00:00
|
|
|
mergeLocal mergeConfig def =<< getCurrentBranch
|