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

Unified Diff: land-external-contributor-cl.sh

Issue 1052803002: Add script for landing CLs on behalf of external authors. (Closed) Base URL: https://github.com/chromium/dom-distiller.git@master
Patch Set: Added support for printing the description Created 5 years, 9 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: land-external-contributor-cl.sh
diff --git a/land-external-contributor-cl.sh b/land-external-contributor-cl.sh
new file mode 100755
index 0000000000000000000000000000000000000000..09dbb5c00d872cee1ec14443e7c2a5b0eb7d4d26
--- /dev/null
+++ b/land-external-contributor-cl.sh
@@ -0,0 +1,56 @@
+#!/usr/bin/env bash
+# A helpful script to land contributions from external developers.
+# The script requires one parameter, which is the issue number to land on behalf
+# of the author.
+if [[ -z "$1" ]]; then
+ echo "First argument must be the issue number."
+ echo "Example: $(basename $0) 123456"
+ exit 1
+fi
+(
+ get_author_from_first_comment() {
cjhopman 2015/04/06 18:28:52 We should probably have git cl expose the actual a
wychen 2015/04/07 03:15:40 I have a CL here under review. https://codereview.
+ # Need to strip colors first from the result of |git cl comments|.
+ git cl comments | \
+ sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g" | \
+ grep "@" | \
+ head -n 1 | \
+ awk '{print $3;}'
+ }
+
+ set -e
+ issue_number=$1
+ # Ensure origin/master is up to date, and checkout a branch which tracks it.
+ git remote update
+ git checkout -tb land-issue-${issue_number} origin/master
+
+ # Setup the branch correctly with the last patch from the review.
+ git cl patch ${issue_number}
+ git cl issue ${issue_number}
+
+ # Print the CL description to help identify if this is the correct CL.
+ echo "The following is the description on that issue:"
+ echo "######"
+ GIT_EDITOR=cat git cl description | \
nyquist 2015/04/02 19:15:30 This sadly edits the CL description; so it should
wychen 2015/04/02 22:36:06 I'll fix this in git_cl.py soon. https://coderevie
nyquist 2015/04/03 01:23:31 That's fantastic! Thanks! I guess this is ready f
wychen 2015/04/07 03:15:39 The fix on git_cl.py was committed, so I guess thi
+ grep -v "^#" | \
+ sed -r "s/Loaded authentication cookies from.*$//g"
+ echo "######"
cjhopman 2015/04/06 18:28:52 This should probably have some sort of confirm dia
wychen 2015/04/07 03:15:39 If Ctrl-c counts as a way to reject, we already ha
+
+ # Get author e-mail by inspecting the first comment, and ask user to verify.
+ author_email=$(get_author_from_first_comment)
+ echo "Author e-mail: Enter to use, or enter correct e-mail [${author_email}]:"
+ read email_override
+ if [[ ! -z "${email_override}" ]]; then
+ author_email="${email_override}"
+ fi
+
+ # Get author name from the username in the e-mail, and ask user to verify.
+ author_name=$(echo ${author_email} | awk '{split($0,a,"@"); print a[1]};')
+ echo "Author name: Enter to use, or enter correct name. [${author_name}]:"
+ read name_override
+ if [[ ! -z "${name_override}" ]]; then
+ author_name="${name_override}"
+ fi
+
+ # Land the current branch.
+ git cl land -c "${author_name} <${author_email}>"
cjhopman 2015/04/06 18:28:52 does this run presubmits?
wychen 2015/04/07 03:15:40 Adding "ant clean && ant test" before this line?
cjhopman 2015/04/07 16:59:17 Tests aren't the same as presubmits. I believe tha
nyquist 2015/04/14 18:44:35 We are intentionally not running tests here. We pr
+)
« 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