summaryrefslogtreecommitdiffstats
path: root/tools/sync-webkit-git.py
diff options
context:
space:
mode:
authorevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-20 19:40:40 +0000
committerevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-20 19:40:40 +0000
commitda4c190047d7d361f91403272097e03bf122da12 (patch)
treeafe2076f901ac7e966a1fd880b8aeace8cf1c2fb /tools/sync-webkit-git.py
parenta03a48bee3d77539c8b2abbabdf31c3a9fbc9beb (diff)
downloadchromium_src-da4c190047d7d361f91403272097e03bf122da12.zip
chromium_src-da4c190047d7d361f91403272097e03bf122da12.tar.gz
chromium_src-da4c190047d7d361f91403272097e03bf122da12.tar.bz2
sync-webkit-git: handle DEPS specifying nonexistent revision
Suppose WebKit trunk's recent history is commits r1, r5, and r10. Then suppose our DEPS file asks for r8. We should then use r5 as that contains the same code as r8. Note that if recent history is as above but lacking r10, we still die, because it's possible that r8 exists on trunk but just hasn't made it into git. Review URL: http://codereview.chromium.org/546090 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36655 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/sync-webkit-git.py')
-rwxr-xr-xtools/sync-webkit-git.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/tools/sync-webkit-git.py b/tools/sync-webkit-git.py
index c5cc283..26490c5 100755
--- a/tools/sync-webkit-git.py
+++ b/tools/sync-webkit-git.py
@@ -51,6 +51,8 @@ def FindSVNRev(target_rev):
log = subprocess.Popen(['git', 'log', '--no-color', '--first-parent',
'--pretty=medium', 'origin'],
stdout=subprocess.PIPE)
+ # Track whether we saw a revision *later* than the one we're seeking.
+ saw_later = False
for line in log.stdout:
match = commit_re.match(line)
if match:
@@ -61,10 +63,14 @@ def FindSVNRev(target_rev):
rev = int(match.group(1))
if rev <= target_rev:
log.stdout.close() # Break pipe.
- if rev == target_rev:
- return commit
- else:
- return None
+ if rev < target_rev:
+ if not saw_later:
+ return None # Can't be sure whether this rev is ok.
+ print ("WARNING: r%d not found, so using next nearest earlier r%d" %
+ (target_rev, rev))
+ return commit
+ else:
+ saw_later = True
print "Error: reached end of log without finding commit info."
print "Something has likely gone horribly wrong."