OLD | NEW |
(Empty) | |
| 1 #!/bin/bash |
| 2 |
| 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. |
| 6 |
| 7 svn_lkgr=`curl -s http://chromium-status.appspot.com/lkgr` |
| 8 if [ $? != 0 -o -z "$svn_lkgr" ]; then |
| 9 echo 'Could not get svn lkgr from chromium-status.appspot.com/lkgr' |
| 10 exit 1 |
| 11 fi |
| 12 |
| 13 # Run a trivial git-svn command to force it to update the revision cache |
| 14 # (which causes spew that might otherwise confuse the next command). |
| 15 git svn info > /dev/null |
| 16 if [ $? != 0 ]; then |
| 17 cat <<EOF 1>&2 |
| 18 Could not run a trivial git-svn command. You probably need to set up your |
| 19 working directory for git-svn, by following these instructions: |
| 20 |
| 21 http://code.google.com/p/chromium/wiki/UsingNewGit#Initial_checkout |
| 22 EOF |
| 23 exit 1 |
| 24 fi |
| 25 |
| 26 git_lkgr=`git svn find-rev r${svn_lkgr}` |
| 27 if [ $? != 0 -o -z "$git_lkgr" ]; then |
| 28 cat <<EOF 1>&2 |
| 29 Could not map svn revision ${svn_lkgr} to a git commit. |
| 30 You may need to `git fetch` and try again. |
| 31 EOF |
| 32 exit 1 |
| 33 fi |
| 34 |
| 35 set -o pipefail |
| 36 closest_commit=`git rev-list --ancestry-path \ |
| 37 --grep='SVN changes up to revision [0-9]*' \ |
| 38 ${git_lkgr}..refs/remotes/origin/master | tail -1` |
| 39 if [ $? != 0 -o -z "$closest_commit" ]; then |
| 40 cat <<EOF 1>&2 |
| 41 Could not find a blessed git commit (with accurate .DEPS.git and submodules) |
| 42 after svn lkgr revision $svn_lkgr. |
| 43 EOF |
| 44 exit 1 |
| 45 fi |
| 46 |
| 47 closest_svn_commit=`git rev-list -n 1 ${closest_commit}^1` |
| 48 if [ $? != 0 -o -z "$closest_svn_commit" ]; then |
| 49 cat <<EOF 1>&2 |
| 50 I am thoroughly confused. Please file a bug report at http://new.crbug.com. |
| 51 EOF |
| 52 exit 1 |
| 53 fi |
| 54 |
| 55 if [ "${closest_svn_commit}" = "${git_lkgr}" ]; then |
| 56 echo "${closest_commit}" |
| 57 exit 0 |
| 58 else |
| 59 cat <<EOF 1>&2 |
| 60 There is no master commit which corresponds exactly to lkgr. |
| 61 The closest commit is ${closest_commit}. |
| 62 EOF |
| 63 exit 1 |
| 64 fi |
OLD | NEW |