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

Side by Side 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, 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/env bash
2 # A helpful script to land contributions from external developers.
3 # The script requires one parameter, which is the issue number to land on behalf
4 # of the author.
5 if [[ -z "$1" ]]; then
6 echo "First argument must be the issue number."
7 echo "Example: $(basename $0) 123456"
8 exit 1
9 fi
10 (
11 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.
12 # Need to strip colors first from the result of |git cl comments|.
13 git cl comments | \
14 sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g" | \
15 grep "@" | \
16 head -n 1 | \
17 awk '{print $3;}'
18 }
19
20 set -e
21 issue_number=$1
22 # Ensure origin/master is up to date, and checkout a branch which tracks it.
23 git remote update
24 git checkout -tb land-issue-${issue_number} origin/master
25
26 # Setup the branch correctly with the last patch from the review.
27 git cl patch ${issue_number}
28 git cl issue ${issue_number}
29
30 # Print the CL description to help identify if this is the correct CL.
31 echo "The following is the description on that issue:"
32 echo "######"
33 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
34 grep -v "^#" | \
35 sed -r "s/Loaded authentication cookies from.*$//g"
36 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
37
38 # Get author e-mail by inspecting the first comment, and ask user to verify.
39 author_email=$(get_author_from_first_comment)
40 echo "Author e-mail: Enter to use, or enter correct e-mail [${author_email}]:"
41 read email_override
42 if [[ ! -z "${email_override}" ]]; then
43 author_email="${email_override}"
44 fi
45
46 # Get author name from the username in the e-mail, and ask user to verify.
47 author_name=$(echo ${author_email} | awk '{split($0,a,"@"); print a[1]};')
48 echo "Author name: Enter to use, or enter correct name. [${author_name}]:"
49 read name_override
50 if [[ ! -z "${name_override}" ]]; then
51 author_name="${name_override}"
52 fi
53
54 # Land the current branch.
55 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
56 )
OLDNEW
« 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