[repohooks] Remove %B in favour of %s & %b
Remove the requirement for git 1.7.2 and instead switch --format=%B for
--format=%s and --format=%b
BUG=none
TEST=Test using git 1.7.1 and 1.7.2.3 to ensure the same result.
Change-Id: Ib82249a2ea984f1431417ba0777214cba1e2fcc8
Reviewed-on: http://gerrit.chromium.org/gerrit/426
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Tested-by: Sean Paul <seanpaul@chromium.org>
diff --git a/pre-upload.py b/pre-upload.py
index 38ba3d0..ed22fb2 100644
--- a/pre-upload.py
+++ b/pre-upload.py
@@ -98,25 +98,6 @@
# Git Helpers
-
-def _check_git_version():
- """Checks the git version installed, dies if it is insufficient"""
- cmd = ['git', '--version']
- output = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0]
- m = re.match('(git version )([0-9]+\.[0-9]+\.[0-9]+).*\n', output)
- if not m or not m.group(2):
- _report_error('Failed to get git version, git output=' + output)
-
- version = m.group(2).split('.')
- version = map(lambda x: int(x), version)
- for v, mv in zip(version, MIN_GIT_VERSION):
- if v < mv:
- _report_error('Invalid version of git (' + m.group(2) + '), you need '
- + 'at least version '
- + ''.join([`num` + '.' for num in MIN_GIT_VERSION]))
- elif v > mv:
- break
-
def _get_upstream_branch():
"""Returns the upstream tracking branch of the current branch.
@@ -176,7 +157,7 @@
def _get_commit_desc(commit):
"""Returns the full commit message of a commit."""
- return _run_command(['git', 'log', '--format=%B', commit + '^!'])
+ return _run_command(['git', 'log', '--format=%s%n%n%b', commit + '^!'])
# Common Hooks
@@ -362,7 +343,6 @@
# Main
def main(project_list, **kwargs):
- _check_git_version()
hooks = _setup_project_hooks()
for project in project_list:
_run_project_hooks(project, hooks)