summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2012-09-27 12:47:36 +0300
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>2012-09-27 14:30:01 +0300
commit897f2d87c8923749cfc0212bc338eb87f3e76c13 (patch)
treeb7bb09cf53064d07fe91b6e7bcbbb49890463920
parent43f30c4c95711cc1cf3ea4dbf94eefb7098c7bb2 (diff)
downloadgit-buildpackage-897f2d87c8923749cfc0212bc338eb87f3e76c13.tar.gz
git-buildpackage-897f2d87c8923749cfc0212bc338eb87f3e76c13.tar.bz2
git-buildpackage-897f2d87c8923749cfc0212bc338eb87f3e76c13.zip
GitRepository/merge: use _cmd_has_feature()
Instead of the haphazard (and buggy) version checking, use _cmd_has_feature() for checking if the --edit option is supported. Also, remove the unused _get_git_version() method. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
-rw-r--r--gbp/git/repository.py25
1 files changed, 3 insertions, 22 deletions
diff --git a/gbp/git/repository.py b/gbp/git/repository.py
index b8fdd291..ca7486a1 100644
--- a/gbp/git/repository.py
+++ b/gbp/git/repository.py
@@ -203,26 +203,6 @@ class GitRepository(object):
raise GitRepositoryError("Error running git %s: %s" %
(command, excobj))
- def _get_git_version(self):
- """
- Return the version of the git suite (i.e. "git client commands")
- that is installed on the OS.
-
- The version is not a property of the git repository itself, but the
- information it is needed in some methods of GitRepository() in order
- to call git subcommands with correct arguments.
-
- @return: git version
- @rtype: C{str}
- """
- out = self._git_inout("version", [])
- # effectively "lstrip" everything until the first number
- version_re = re.compile(r'^[^0-9]*(?P<version>.*)$')
- m = version_re.match(out[0])
- if m:
- return m.group('version')
- return None
-
def _cmd_has_feature(self, command, feature):
"""
Check if the git command has certain feature enabled.
@@ -431,10 +411,11 @@ class GitRepository(object):
"""
args = GitArgs()
args.add_cond(verbose, '--summary', '--no-summary')
- if (self._get_git_version() >= '1.7.8'):
+ if (self._cmd_has_feature('merge', 'edit')):
args.add_cond(edit, '--edit', '--no-edit')
else:
- log.debug("edit/no-edit option for git-merge not supported by your git suite version")
+ log.debug("Your git suite doesn't support --edit/--no-edit " \
+ "option for git-merge ")
args.add(commit)
self._git_command("merge", args.args)