2011-06-22 18:46:45 -04:00
|
|
|
{- git-annex command
|
|
|
|
-
|
2013-07-03 15:42:56 -04:00
|
|
|
- Copyright 2011, 2013 Joey Hess <joey@kitenet.net>
|
2011-06-22 18:46:45 -04:00
|
|
|
-
|
|
|
|
- Licensed under the GNU GPL version 3 or higher.
|
|
|
|
-}
|
|
|
|
|
|
|
|
module Command.Merge where
|
|
|
|
|
2011-10-05 16:02:51 -04:00
|
|
|
import Common.Annex
|
2011-06-22 18:46:45 -04:00
|
|
|
import Command
|
2011-10-04 00:40:47 -04:00
|
|
|
import qualified Annex.Branch
|
2013-07-03 15:42:56 -04:00
|
|
|
import qualified Git.Branch
|
2013-09-13 14:55:55 -04:00
|
|
|
import Command.Sync (prepMerge, mergeLocal)
|
2011-06-22 18:46:45 -04:00
|
|
|
|
2011-10-29 15:19:05 -04:00
|
|
|
def :: [Command]
|
2013-03-24 18:28:21 -04:00
|
|
|
def = [command "merge" paramNothing seek SectionMaintenance
|
2013-07-03 15:42:56 -04:00
|
|
|
"automatically merge changes from remotes"]
|
2011-06-22 18:46:45 -04:00
|
|
|
|
|
|
|
seek :: [CommandSeek]
|
2013-07-03 15:42:56 -04:00
|
|
|
seek =
|
|
|
|
[ withNothing mergeBranch
|
|
|
|
, withNothing mergeSynced
|
|
|
|
]
|
2011-06-22 18:46:45 -04:00
|
|
|
|
2013-07-03 15:42:56 -04:00
|
|
|
mergeBranch :: CommandStart
|
|
|
|
mergeBranch = do
|
|
|
|
showStart "merge" "git-annex"
|
|
|
|
next $ do
|
|
|
|
Annex.Branch.update
|
|
|
|
-- commit explicitly, in case no remote branches were merged
|
|
|
|
Annex.Branch.commit "update"
|
|
|
|
next $ return True
|
2011-06-22 18:46:45 -04:00
|
|
|
|
2013-07-03 15:42:56 -04:00
|
|
|
mergeSynced :: CommandStart
|
|
|
|
mergeSynced = do
|
2013-09-13 14:55:55 -04:00
|
|
|
prepMerge
|
2013-11-02 15:29:38 -04:00
|
|
|
mergeLocal =<< inRepo Git.Branch.current
|