diff options
author | Andras Becsi <andras.becsi@digia.com> | 2014-07-14 18:49:19 +0200 |
---|---|---|
committer | Andras Becsi <andras.becsi@digia.com> | 2014-07-15 18:00:16 +0200 |
commit | 1a9e2540113ad0a8542f573a6324a1f4b053e757 (patch) | |
tree | da667f49a48ca3b2cc2a2e4ac0ac072282e016f1 /tools/scripts/git_submodule.py | |
parent | 4fcc9713a8805c4adf1c29bec50100681b37ec70 (diff) | |
download | qtwebengine-1a9e2540113ad0a8542f573a6324a1f4b053e757.tar.gz |
Use the version tag when checking out chromium
Instead of grepping for the VERSION file update in the git log
check out the sha1 that has been tagged with the requested version.
Also harden the regexp we use to translate svn revisions to git
sha1's and further clean up the findShaAndCheckout function.
Change-Id: Iaeb7ebee558b7ebadaf3428e06626736601198cf
Reviewed-by: Michael Bruning <michael.bruning@digia.com>
Diffstat (limited to 'tools/scripts/git_submodule.py')
-rw-r--r-- | tools/scripts/git_submodule.py | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/tools/scripts/git_submodule.py b/tools/scripts/git_submodule.py index 0505d2ca0..f22f7323c 100644 --- a/tools/scripts/git_submodule.py +++ b/tools/scripts/git_submodule.py @@ -161,6 +161,7 @@ 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]) @@ -169,24 +170,26 @@ 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() - search_string = '' - if self.path.endswith('/chromium'): - search_string = resolver.currentVersion() + if current_tag == resolver.currentVersion(): + # We checked out a tagged version of chromium. + self.shasum = current_shasum elif self.revision: - search_string = '@' + str(self.revision) + ' ' - if search_string: + 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] - else: # No revision set, use the submodule shasum - os.chdir(oldCwd) - line = subprocessCheckOutput(['git', 'submodule', 'status', self.path]) - os.chdir(self.path) - line = line.lstrip(' -') - self.shasum = line.split(' ')[0] + self.shasum = line.split()[0] + + if not self.shasum: + # No shasum could be deduced, use the submodule shasum. + os.chdir(oldCwd) + line = subprocessCheckOutput(['git', 'submodule', 'status', self.path]) + os.chdir(self.path) + line = line.lstrip(' -') + self.shasum = line.split(' ')[0] - current_shasum = subprocessCheckOutput(['git', 'show', '-s', '--oneline']).split(' ')[0] if not self.shasum.startswith(current_shasum): # In case HEAD differs check out the actual shasum we require. subprocessCall(['git', 'fetch']) @@ -219,7 +222,7 @@ class Submodule: def initialize(self): if self.matchesOS(): - print '-- initializing ' + self.path + ' --' + print '\n\n-- initializing ' + self.path + ' --' oldCwd = os.getcwd() if os.path.isdir(self.path): self.reset() @@ -233,9 +236,12 @@ class Submodule: if self.findShaAndCheckout() != 0: sys.exit("!!! initialization failed !!!") - os.chdir(self.path) - commit = subprocessCheckOutput(['git', 'rev-list', '--max-count=1', 'HEAD']) - subprocessCall(['git', 'commit', '-a', '--allow-empty', '-m', '-- QtWebEngine baseline --\n\ncommit ' + commit]) + if '3rdparty_upstream' in os.path.abspath(self.path): + # Add baseline commit for upstream repository to be able to reset. + os.chdir(self.path) + commit = subprocessCheckOutput(['git', 'rev-list', '--max-count=1', 'HEAD']) + subprocessCall(['git', 'commit', '-a', '--allow-empty', '-m', '-- QtWebEngine baseline --\n\ncommit ' + commit]) + os.chdir(oldCwd) else: print '-- skipping ' + self.path + ' for this operating system. --' |