git-annex/Command/Merge.hs

40 lines
860 B
Haskell
Raw Normal View History

2011-06-22 22:46:45 +00:00
{- git-annex command
-
- Copyright 2011, 2013 Joey Hess <joey@kitenet.net>
2011-06-22 22:46:45 +00:00
-
- Licensed under the GNU GPL version 3 or higher.
-}
module Command.Merge where
2011-10-05 20:02:51 +00:00
import Common.Annex
2011-06-22 22:46:45 +00:00
import Command
2011-10-04 04:40:47 +00:00
import qualified Annex.Branch
import qualified Git.Branch
import Command.Sync (prepMerge, mergeLocal)
2011-06-22 22:46:45 +00:00
def :: [Command]
def = [command "merge" paramNothing seek SectionMaintenance
"automatically merge changes from remotes"]
2011-06-22 22:46:45 +00:00
seek :: [CommandSeek]
seek =
[ withNothing mergeBranch
, withNothing mergeSynced
]
2011-06-22 22:46:45 +00: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 22:46:45 +00:00
mergeSynced :: CommandStart
mergeSynced = do
branch <- inRepo Git.Branch.current
prepMerge
maybe stop mergeLocal branch