import sys
import os, os.path
-from gbp.command_wrappers import (GitFetch, GitMerge, Command,
+from gbp.command_wrappers import (GitFetch, Command,
CommandExecFailed, PristineTar)
from gbp.config import (GbpOptionParser, GbpOptionGroup)
from gbp.errors import GbpError
if update:
gbp.log.info("Updating '%s'" % branch)
repo.set_branch(branch)
- GitMerge(remote)()
+ repo.merge(remote)
return update
def main(argv):
GitCommand.__init__(self, 'fetch', opts)
-# FIXME: move to gbp.git.merge
-class GitMerge(GitCommand):
- """Wrap git merge"""
- def __init__(self, branch, verbose=False):
- verbose = [ ['--no-summary'], [] ][verbose]
- GitCommand.__init__(self, 'merge', [branch] + verbose)
- self.run_error = 'Couldn\'t merge from "%s"' % (branch,)
-
-
# FIXME: move to gbp.git.create_tag
class GitTag(GitCommand):
"""Wrap git tag"""
remote += merge.replace("refs/heads","", 1)
return remote
+ def merge(self, commit, verbose=False):
+ """
+ Merge changes from the named commit into the current branch
+
+ @param commit: the commit to merge from (usually a branch name)
+ @type commit: string
+ """
+ args = [ "--summary" ] if verbose else [ "--no-summary" ]
+ self._git_command("merge", args + [ commit ])
+
def is_fast_forward(self, from_branch, to_branch):
"""
check if an update from from_branch to to_branch would be a fast
gbp.log.info("Merging to '%s'" % options.debian_branch)
repo.set_branch(options.debian_branch)
try:
- gbpc.GitMerge(tag)()
+ repo.merge(tag)
except gbpc.CommandExecFailed:
raise GbpError, """Merge failed, please resolve."""
if options.postimport: