From 8a19129da13ac4a0da49fd9e5317631b7f40d896 Mon Sep 17 00:00:00 2001 From: Andras Becsi Date: Wed, 16 Jul 2014 17:11:14 +0200 Subject: init-repository: fix checkout of pure git repositories Since some projects are maintained in git repositories only even the 'svn' DEPS file has some git shasums instead of svn revisions. Check the current shasum and tag outside of the ref block so we actually end up checking out the parsed shasum for non-git-svn repositories. Change-Id: Iabc4a5b15e50a0f0df84179a65929352ee2addb7 Reviewed-by: Michael Bruning --- tools/scripts/git_submodule.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/tools/scripts/git_submodule.py b/tools/scripts/git_submodule.py index f22f7323c..fa5e9691c 100644 --- a/tools/scripts/git_submodule.py +++ b/tools/scripts/git_submodule.py @@ -161,7 +161,6 @@ class Submodule: oldCwd = os.getcwd() os.chdir(self.path) error = 0 - current_shasum = '' if self.ref: # Fetch the ref we parsed from the DEPS file. error = subprocessCall(['git', 'fetch', 'origin', self.ref]) @@ -170,18 +169,20 @@ class Submodule: return error error = subprocessCall(['git', 'checkout', 'FETCH_HEAD']); - current_shasum = subprocessCheckOutput(['git', 'rev-parse', 'HEAD']).strip() - current_tag = subprocessCheckOutput(['git', 'name-rev', '--tags', '--name-only', current_shasum]).strip() - if current_tag == resolver.currentVersion(): - # We checked out a tagged version of chromium. - self.shasum = current_shasum - elif self.revision: + if self.revision: search_string = '\"git-svn-id: .*@' + str(self.revision) + '\"' line = subprocessCheckOutput(['git', 'log', '-n1', '--pretty=oneline', '--grep=' + search_string]) if line: self.shasum = line.split()[0] + current_shasum = subprocessCheckOutput(['git', 'rev-parse', 'HEAD']).strip() + current_tag = subprocessCheckOutput(['git', 'name-rev', '--tags', '--name-only', current_shasum]).strip() + + if current_tag == resolver.currentVersion(): + # We checked out a tagged version of chromium. + self.shasum = current_shasum + if not self.shasum: # No shasum could be deduced, use the submodule shasum. os.chdir(oldCwd) -- cgit v1.2.3