merge: Now also merges synced/master or similar branches, which makes it useful to put in a post-receive hook to make a repository automatically update its working copy when git annex sync or the assistant sync with it.
This commit is contained in:
parent
3afe7af48b
commit
980e9a15e0
4 changed files with 38 additions and 22 deletions
|
@ -1,6 +1,6 @@
|
|||
{- git-annex command
|
||||
-
|
||||
- Copyright 2011 Joey Hess <joey@kitenet.net>
|
||||
- Copyright 2011, 2013 Joey Hess <joey@kitenet.net>
|
||||
-
|
||||
- Licensed under the GNU GPL version 3 or higher.
|
||||
-}
|
||||
|
@ -10,22 +10,29 @@ module Command.Merge where
|
|||
import Common.Annex
|
||||
import Command
|
||||
import qualified Annex.Branch
|
||||
import qualified Git.Branch
|
||||
import Command.Sync (mergeLocal)
|
||||
|
||||
def :: [Command]
|
||||
def = [command "merge" paramNothing seek SectionMaintenance
|
||||
"auto-merge remote changes into git-annex branch"]
|
||||
"automatically merge changes from remotes"]
|
||||
|
||||
seek :: [CommandSeek]
|
||||
seek = [withNothing start]
|
||||
seek =
|
||||
[ withNothing mergeBranch
|
||||
, withNothing mergeSynced
|
||||
]
|
||||
|
||||
start :: CommandStart
|
||||
start = do
|
||||
showStart "merge" "."
|
||||
next perform
|
||||
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
|
||||
|
||||
perform :: CommandPerform
|
||||
perform = do
|
||||
Annex.Branch.update
|
||||
-- commit explicitly, in case no remote branches were merged
|
||||
Annex.Branch.commit "update"
|
||||
next $ return True
|
||||
mergeSynced :: CommandStart
|
||||
mergeSynced = do
|
||||
branch <- inRepo Git.Branch.current
|
||||
maybe stop mergeLocal branch
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue