Add -r <svn revision> option

TBR=scheib@chromium.org
NOTRY=true



Review URL: https://chromiumcodereview.appspot.com/11959013

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@177228 0039d316-1c4b-4281-b951-d872f2087c98
experimental/szager/collated-output
szager@chromium.org 12 years ago
parent dd4e931730
commit cc9cbc899d

@ -6,6 +6,7 @@
force_branch=no force_branch=no
quiet=no quiet=no
svn_lkgr=
while [ $# -gt 0 ]; do while [ $# -gt 0 ]; do
case "$1" in case "$1" in
@ -15,6 +16,10 @@ while [ $# -gt 0 ]; do
-q|--quiet) -q|--quiet)
quiet=yes quiet=yes
;; ;;
-r|--revision)
svn_lkgr="$2"
shift
;;
*) *)
echo "Unknown option: $1" echo "Unknown option: $1"
;; ;;
@ -22,11 +27,17 @@ while [ $# -gt 0 ]; do
shift shift
done done
if [ -z "$svn_lkgr" ]; then
svn_lkgr=`curl -s http://chromium-status.appspot.com/lkgr` svn_lkgr=`curl -s http://chromium-status.appspot.com/lkgr`
if [ $? != 0 -o -z "$svn_lkgr" ]; then if [ $? != 0 -o -z "$svn_lkgr" ]; then
echo 'Could not get svn lkgr from chromium-status.appspot.com/lkgr' echo 'Could not get svn lkgr from chromium-status.appspot.com/lkgr'
exit 1 exit 1
fi fi
fi
if [ "${svn_lkgr:0:1}" = "r" ]; then
svn_lkgr="${svn_lkgr:1}"
fi
# Run a trivial git-svn command to force it to update the revision cache # Run a trivial git-svn command to force it to update the revision cache
# (which causes spew that might otherwise confuse the next command). # (which causes spew that might otherwise confuse the next command).
@ -55,13 +66,9 @@ closest_commit=`git rev-list --ancestry-path \
--grep='SVN changes up to revision [0-9]*' \ --grep='SVN changes up to revision [0-9]*' \
${git_lkgr}..refs/remotes/origin/master | tail -1` ${git_lkgr}..refs/remotes/origin/master | tail -1`
if [ $? != 0 -o -z "$closest_commit" ]; then if [ $? != 0 -o -z "$closest_commit" ]; then
cat <<EOF 1>&2 closest_commit=
Could not find a blessed git commit (with accurate .DEPS.git and submodules) closest_svn_commit=
after svn lkgr revision $svn_lkgr. else
EOF
exit 1
fi
closest_svn_commit=`git rev-list -n 1 ${closest_commit}^1` closest_svn_commit=`git rev-list -n 1 ${closest_commit}^1`
if [ $? != 0 -o -z "$closest_svn_commit" ]; then if [ $? != 0 -o -z "$closest_svn_commit" ]; then
cat <<EOF 1>&2 cat <<EOF 1>&2
@ -69,6 +76,7 @@ I am thoroughly confused. Please file a bug report at http://new.crbug.com.
EOF EOF
exit 1 exit 1
fi fi
fi
# Pick a name for the new branch. Use `git rev-parse` to make sure the branch # Pick a name for the new branch. Use `git rev-parse` to make sure the branch
# doesn't already exist; if it does, iterate an integer suffix to uniquify it. # doesn't already exist; if it does, iterate an integer suffix to uniquify it.
@ -90,11 +98,11 @@ if [ "${closest_svn_commit}" = "${git_lkgr}" ]; then
elif [ "${quiet}" = "yes" ]; then elif [ "${quiet}" = "yes" ]; then
exit 1 exit 1
elif [ "${force_branch}" = "no" ]; then elif [ "${force_branch}" = "no" ]; then
cat <<EOF echo "There is no master commit which corresponds exactly to svn revision ${svn_lkgr}."
There is no master commit which corresponds exactly to lkgr. if [ -n "$closest_commit" ]; then
The closest commit is ${closest_commit}. echo "The closest commit is ${closest_commit}."
EOF fi
read -n 1 -p 'Would you like to create a new branch based on lkgr? (y/N) ' read -n 1 -p "Would you like to create a new branch based on r${svn_lkgr}? (y/N) "
echo echo
if [ "x$REPLY" != "xy" -a "x$REPLY" != "xY" ]; then if [ "x$REPLY" != "xy" -a "x$REPLY" != "xY" ]; then
exit 0 exit 0
@ -135,7 +143,7 @@ The new branch "$lkgr_branch" was branched from this commit:
$git_lkgr $git_lkgr
... which maps to the svn lkgr commit r${svn_lkgr}. The new branch ... which maps to the svn commit r${svn_lkgr}. The new branch
has one additional commit, to bring .DEPS.git, .gitmodules, and the has one additional commit, to bring .DEPS.git, .gitmodules, and the
invisible git submodule files up to date with DEPS. invisible git submodule files up to date with DEPS.

Loading…
Cancel
Save