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

Unified Diff: update_depot_tools

Issue 10263004: Handle updating depot_tools repos that are git cloned. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 8 years, 8 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 | update_depot_tools.bat » ('j') | update_depot_tools.bat » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: update_depot_tools
diff --git a/update_depot_tools b/update_depot_tools
index 00859e338be2dad2bc210cafc514a4613b78b71f..810c2f37110a0b24aa377e32613615d6b520887d 100755
--- a/update_depot_tools
+++ b/update_depot_tools
@@ -63,6 +63,33 @@ function test_git_svn {
fi
}
+function is_git_clone_repo {
+ GITCONFIG="$("$GIT" config remote.origin.fetch > /dev/null)"
+ GITCONFIG_RC="$?"
+ if [ "$GITCONFIG_RC" == "0" ]
+ then
+ return 0
+ fi
+ return 1
+}
+
+function update_git_repo {
+ if is_git_clone_repo
M-A Ruel 2012/04/29 00:56:01 the rest of the file uses the style: "if is_git_cl
cmp 2012/04/30 03:16:16 Done. When writing this, I saw: if ...; then if
+ then
+ git fetch -q origin
+ git rebase -q origin
+ return 0
+ fi
+
+ test_git_svn
+ # work around a git-svn --quiet bug
+ OUTPUT=`"$GIT" svn rebase -q -q`
+ if [[ ! "$OUTPUT" == *Current.branch* ]]; then
+ echo $OUTPUT 1>&2
+ fi
+ return 0
+}
+
# Get the current SVN revision.
get_svn_revision() {
LANGUAGE=C "$SVN" info "$base_dir" | \
@@ -73,12 +100,7 @@ get_svn_revision() {
if [ "X$DEPOT_TOOLS_UPDATE" != "X0" -a -e "$base_dir/.git" ]
then
cd $base_dir
- test_git_svn
- # work around a git-svn --quiet bug
- OUTPUT=`"$GIT" svn rebase -q -q`
- if [[ ! "$OUTPUT" == *Current.branch* ]]; then
- echo $OUTPUT 1>&2
- fi
+ update_git_repo
cd - > /dev/null
fi
« no previous file with comments | « no previous file | update_depot_tools.bat » ('j') | update_depot_tools.bat » ('J')

Powered by Google App Engine
This is Rietveld 408576698