resolvemerge: New plumbing command that runs the automatic merge conflict resolver.
This commit is contained in:
parent
003ebf58f5
commit
cb66ca3a76
6 changed files with 60 additions and 3 deletions
|
@ -5,7 +5,10 @@
|
|||
- Licensed under the GNU GPL version 3 or higher.
|
||||
-}
|
||||
|
||||
module Annex.AutoMerge (autoMergeFrom) where
|
||||
module Annex.AutoMerge
|
||||
( autoMergeFrom
|
||||
, resolveMerge
|
||||
) where
|
||||
|
||||
import Common.Annex
|
||||
import qualified Annex.Queue
|
||||
|
|
|
@ -54,6 +54,7 @@ import qualified Command.Whereis
|
|||
import qualified Command.List
|
||||
import qualified Command.Log
|
||||
import qualified Command.Merge
|
||||
import qualified Command.ResolveMerge
|
||||
import qualified Command.Info
|
||||
import qualified Command.Status
|
||||
import qualified Command.Migrate
|
||||
|
@ -164,6 +165,7 @@ cmds = concat
|
|||
, Command.List.def
|
||||
, Command.Log.def
|
||||
, Command.Merge.def
|
||||
, Command.ResolveMerge.def
|
||||
, Command.Info.def
|
||||
, Command.Status.def
|
||||
, Command.Migrate.def
|
||||
|
|
38
Command/ResolveMerge.hs
Normal file
38
Command/ResolveMerge.hs
Normal file
|
@ -0,0 +1,38 @@
|
|||
{- git-annex command
|
||||
-
|
||||
- Copyright 2014 Joey Hess <joey@kitenet.net>
|
||||
-
|
||||
- Licensed under the GNU GPL version 3 or higher.
|
||||
-}
|
||||
|
||||
module Command.ResolveMerge where
|
||||
|
||||
import Common.Annex
|
||||
import Command
|
||||
import qualified Git
|
||||
import Git.Sha
|
||||
import qualified Git.Branch
|
||||
import Annex.AutoMerge
|
||||
|
||||
def :: [Command]
|
||||
def = [command "resolvemerge" paramNothing seek SectionPlumbing
|
||||
"resolve merge conflicts"]
|
||||
|
||||
seek :: CommandSeek
|
||||
seek ps = withNothing start ps
|
||||
|
||||
start :: CommandStart
|
||||
start = do
|
||||
showStart "resolvemerge" ""
|
||||
us <- fromMaybe nobranch <$> inRepo Git.Branch.current
|
||||
d <- fromRepo Git.localGitDir
|
||||
let merge_head = d </> "MERGE_HEAD"
|
||||
them <- fromMaybe (error nomergehead) . extractSha
|
||||
<$> liftIO (readFile merge_head)
|
||||
ifM (resolveMerge (Just us) them)
|
||||
( next $ next $ return True
|
||||
, error "Merge conflict could not be automatically resolved."
|
||||
)
|
||||
where
|
||||
nobranch = error "No branch is currently checked out."
|
||||
nomergehead = error "No SHA found in .git/merge_head"
|
2
debian/changelog
vendored
2
debian/changelog
vendored
|
@ -9,6 +9,8 @@ git-annex (5.20140710) UNRELEASED; urgency=medium
|
|||
* S3: Deal with AWS ACL configurations that do not allow creating or
|
||||
checking the location of a bucket, but only reading and writing content to
|
||||
it.
|
||||
* resolvemerge: New plumbing command that runs the automatic merge conflict
|
||||
resolver.
|
||||
|
||||
-- Joey Hess <joeyh@debian.org> Wed, 09 Jul 2014 23:29:21 -0400
|
||||
|
||||
|
|
|
@ -170,8 +170,8 @@ subdirectories).
|
|||
|
||||
* `merge`
|
||||
|
||||
This performs the same merging that is done by the sync command, but
|
||||
without pushing or pulling any data.
|
||||
This performs the same merging (and merge conflict resolution)
|
||||
that is done by the sync command, but without pushing or pulling any data.
|
||||
|
||||
One way to use this is to put `git annex merge` into a repository's
|
||||
post-receive hook. Then any syncs to the repository will update its working
|
||||
|
@ -939,6 +939,16 @@ subdirectories).
|
|||
Most MATCHING OPTIONS can be used with findref, to limit the files it
|
||||
finds. However, the --include and --exclude options will not work.
|
||||
|
||||
* `resolvemerge`
|
||||
|
||||
Resolves a conflicted merge, by adding both conflicting versions of the
|
||||
file to the tree, using variants of their filename. This is done
|
||||
automatically when using `git annex sync` or `git annex merge`.
|
||||
|
||||
Note that only merge conflicts that involve an annexed file are resolved.
|
||||
Merge conflicts between two files that are not annexed will not be
|
||||
automatically resolved.
|
||||
|
||||
* `test`
|
||||
|
||||
This runs git-annex's built-in test suite.
|
||||
|
|
|
@ -5,3 +5,5 @@ between local branches.
|
|||
|
||||
E.g., one might invoke «git annex merge» or «git annex autoresolve»
|
||||
after «git merge» when conflicts are found.
|
||||
|
||||
> [[done]] as resolvemerge. --[[Joey]]
|
||||
|
|
Loading…
Add table
Reference in a new issue