From da4c190047d7d361f91403272097e03bf122da12 Mon Sep 17 00:00:00 2001 From: "evan@chromium.org" Date: Wed, 20 Jan 2010 19:40:40 +0000 Subject: 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 --- tools/sync-webkit-git.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'tools') 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." -- cgit v1.1