Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Unified Diff: git-lkgr

Issue 10958056: git command to find a git revision corresponding to lkgr. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools/
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: git-lkgr
===================================================================
--- git-lkgr (revision 0)
+++ git-lkgr (revision 0)
@@ -0,0 +1,64 @@
+#!/bin/bash
+
+# Copyright (c) 2012 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+svn_lkgr=`curl -s http://chromium-status.appspot.com/lkgr`
+if [ $? != 0 -o -z "$svn_lkgr" ]; then
+ echo 'Could not get svn lkgr from chromium-status.appspot.com/lkgr'
+ exit 1
+fi
+
+# Run a trivial git-svn command to force it to update the revision cache
+# (which causes spew that might otherwise confuse the next command).
+git svn info > /dev/null
+if [ $? != 0 ]; then
+ cat <<EOF 1>&2
+Could not run a trivial git-svn command. You probably need to set up your
+working directory for git-svn, by following these instructions:
+
+http://code.google.com/p/chromium/wiki/UsingNewGit#Initial_checkout
+EOF
+ exit 1
+fi
+
+git_lkgr=`git svn find-rev r${svn_lkgr}`
+if [ $? != 0 -o -z "$git_lkgr" ]; then
+ cat <<EOF 1>&2
+Could not map svn revision ${svn_lkgr} to a git commit.
+You may need to `git fetch` and try again.
+EOF
+ exit 1
+fi
+
+set -o pipefail
+closest_commit=`git rev-list --ancestry-path \
+ --grep='SVN changes up to revision [0-9]*' \
+ ${git_lkgr}..refs/remotes/origin/master | tail -1`
+if [ $? != 0 -o -z "$closest_commit" ]; then
+ cat <<EOF 1>&2
+Could not find a blessed git commit (with accurate .DEPS.git and submodules)
+after svn lkgr revision $svn_lkgr.
+EOF
+ exit 1
+fi
+
+closest_svn_commit=`git rev-list -n 1 ${closest_commit}^1`
+if [ $? != 0 -o -z "$closest_svn_commit" ]; then
+ cat <<EOF 1>&2
+I am thoroughly confused. Please file a bug report at http://new.crbug.com.
+EOF
+ exit 1
+fi
+
+if [ "${closest_svn_commit}" = "${git_lkgr}" ]; then
+ echo "${closest_commit}"
+ exit 0
+else
+ cat <<EOF 1>&2
+There is no master commit which corresponds exactly to lkgr.
+The closest commit is ${closest_commit}.
+EOF
+ exit 1
+fi
Property changes on: git-lkgr
___________________________________________________________________
Added: svn:executable
+ *
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698