summaryrefslogtreecommitdiffstats
path: root/tools/scripts/version_resolver.py
diff options
context:
space:
mode:
authorAndras Becsi <andras.becsi@digia.com>2014-07-02 11:34:47 +0200
committerAndras Becsi <andras.becsi@digia.com>2014-07-03 13:14:44 +0200
commitd8245424b814591a4fbc4115c1fabe0a34479bb3 (patch)
treeeec90dda1799b2631f0d99f2c51a2b974c89ac38 /tools/scripts/version_resolver.py
parent5317069f3d0d27ed6192a41b3f7b7e6b74dfbbed (diff)
tools: add reset option to patch_upstream.py
This patch makes it possible to reset the upstream chromium repository to its baseline state. Change-Id: Idff94a0f873e994716f77c83f4c5b79bcd48aec5 Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
Diffstat (limited to 'tools/scripts/version_resolver.py')
-rw-r--r--tools/scripts/version_resolver.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/tools/scripts/version_resolver.py b/tools/scripts/version_resolver.py
index 73a5c5c6b..aec1bf6fa 100644
--- a/tools/scripts/version_resolver.py
+++ b/tools/scripts/version_resolver.py
@@ -197,3 +197,31 @@ def preparePatchesFromSnapshot():
os.chdir(oldCwd)
return patches_dict
+def resetUpstream():
+ oldCwd = os.getcwd()
+ target_dir = os.path.join(upstream_src_dir, 'chromium')
+ os.chdir(target_dir)
+
+ chromium = GitSubmodule.Submodule()
+ chromium.path = "."
+ submodules = chromium.readSubmodules()
+ submodules.append(chromium)
+
+ print('-- resetting upstream submodules in ' + os.path.relpath(target_dir) + ' to baseline --')
+
+ for module in submodules:
+ oldCwd = os.getcwd()
+ module_path = os.path.abspath(os.path.join(target_dir, module.path))
+ if not os.path.isdir(module_path):
+ continue
+
+ cwd = os.getcwd()
+ os.chdir(module_path)
+ line = subprocess.check_output(['git', 'log', '-n1', '--pretty=oneline', '--grep=-- QtWebEngine baseline --'])
+ line = line.split(' ')[0]
+ if line:
+ subprocess.call(['git', 'reset', '-q', '--hard', line])
+ os.chdir(cwd)
+ module.reset()
+ os.chdir(oldCwd)
+ print('done.\n')