(CommandList children: [ (C {(set)} {(-eu)}) (C {(Lit_Other ":")} { (BracedVarSub token: <VSub_Name RELEASE_REPOSITORIES> suffix_op: (StringUnary op_id: VTest_ColonEquals arg_word: {(DQ ("git@github.com:bazelbuild/bazel"))} ) spids: [58 64] ) } ) (C {(Lit_Other ":")} { (BracedVarSub token: <VSub_Name MASTER_REPOSITORIES> suffix_op: (StringUnary op_id: VTest_ColonEquals arg_word: {(DQ ("https://bazel.googlesource.com/bazel"))} ) spids: [72 78] ) } ) (C {(Lit_Other ":")} { (BracedVarSub token: <VSub_Name EDITOR> suffix_op: (StringUnary op_id:VTest_Equals arg_word:{(vi)}) spids: [86 90] ) } ) (C {(Lit_Other ":")} { (BracedVarSub token: <VSub_Name RELEASE_AUTHOR> suffix_op: (StringUnary op_id: VTest_Equals arg_word: {(DQ ("Bazel Release System <noreply@google.com>"))} ) spids: [98 104] ) } ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:SCRIPT_DIR) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (AndOr children: [ (C {(cd)} { (DQ (CommandSubPart command_list: (CommandList children: [ (C {(dirname)} { (DQ (BracedVarSub token: <VSub_Name BASH_SOURCE> bracket_op: (ArrayIndex expr: (ArithWord w:{(Lit_Digits 0)}) ) spids: [119 124] ) ) } ) ] ) left_token: <Left_CommandSub "$("> spids: [115 126] ) ) } ) (C {(pwd)}) ] op_id: Op_DAmp ) ] ) left_token: <Left_CommandSub "$("> spids: [111 132] ) } spids: [110] ) ] spids: [110] ) (C {(source)} {(${ VSub_Name SCRIPT_DIR) (/relnotes.sh)}) (C {(source)} {(${ VSub_Name SCRIPT_DIR) (/common.sh)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:RELEASE_NOTE_MESSAGE) op: Equal rhs: { (SQ <"# Editing release notes\n"> <"# Modify the release notes to make them suitable for the release.\n"> <"# Every line starting with a # will be removed as well as every\n"> <"# empty line at the start and at the end.\n"> ) } spids: [156] ) ] spids: [156] ) (FuncDef name: set_release_name body: (BraceGroup children: [ (AndOr children: [ (SimpleCommand words: [{(git)} {(notes)} {(--ref) (Lit_Other "=") (release)} {(remove)}] redirects: [(Redir op_id:Redir_Great fd:2 arg_word:{(/dev/null)} spids:[187])] ) (C {(true)}) ] op_id: Op_DPipe ) (AndOr children: [ (SimpleCommand words: [{(git)} {(notes)} {(--ref) (Lit_Other "=") (release-candidate)} {(remove)}] redirects: [(Redir op_id:Redir_Great fd:2 arg_word:{(/dev/null)} spids:[205])] ) (C {(true)}) ] op_id: Op_DPipe ) (C {(git)} {(notes)} {(--ref) (Lit_Other "=") (release)} {(append)} {(-m)} {(DQ ($ VSub_Number "$1"))} ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:relname) op: Equal rhs: {(DQ ($ VSub_Number "$1"))} spids: [232] ) ] spids: [230] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (LogicalNot child: (BoolUnary op_id: BoolUnary_z child: { (DQ (BracedVarSub token: <VSub_Number 2> suffix_op: (StringUnary op_id:VTest_Hyphen arg_word:{(SQ )}) spids: [247 250] ) ) } ) ) ) terminator: <Op_Semi ";"> ) ] action: [ (C {(git)} {(notes)} {(--ref) (Lit_Other "=") (release-candidate)} {(append)} {(-m)} {(DQ ($ VSub_Number "$2"))} ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:relname) op: Equal rhs: {(DQ (${ VSub_Name relname) (RC) (${ VSub_Number 2))} spids: [276] ) ] spids: [276] ) ] spids: [-1 256] ) ] spids: [-1 288] ) (C {(echo)} {(DQ ($ VSub_Name "$relname"))}) ] spids: [174] ) spids: [168 173] ) (FuncDef name: trim_empty_lines body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:f) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [(C {(echo)} {(SQ <Lit_EscapedChar "\\f">)})] ) left_token: <Left_CommandSub "$("> spids: [316 322] ) ) } spids: [314] ) ] spids: [312] ) (Pipeline children: [ (C {(tr)} {(SQ <"\\n">)} {(SQ <"\\f">)}) (C {(sed)} {(-e)} {(DQ ("s/^") ($ VSub_Name "$f") ("*//"))} {(-e)} {(DQ (s/) ($ VSub_Name "$f") ("*") (Lit_Other "$") (//))} ) (C {(tr)} {(SQ <"\\f">)} {(SQ <"\\n">)}) ] negated: False ) ] spids: [309] ) spids: [303 308] ) (FuncDef name: release_note_editor body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:tmpfile) op: Equal rhs: {(DQ ($ VSub_Number "$1"))} spids: [398] ) ] spids: [396] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:origin_branch) op: Equal rhs: {(DQ ($ VSub_Number "$2"))} spids: [406] ) ] spids: [404] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:branch_name) op: Equal rhs: { (DQ (BracedVarSub token: <VSub_Number 3> suffix_op: (StringUnary op_id:VTest_Hyphen arg_word:{(SQ )}) spids: [416 419] ) ) } spids: [414] ) ] spids: [412] ) (AndOr children: [ (C {($ VSub_Name "$EDITOR")} {(${ VSub_Name tmpfile)}) (BraceGroup children: [ (SimpleCommand words: [{(echo)} {(DQ ("Editor failed, cancelling release creation..."))}] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[440])] ) (SimpleCommand words: [{(git)} {(checkout)} {(-q)} {(${ VSub_Name origin_branch)}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(/dev/null)} spids:[454])] ) (AndOr children: [ (C {(Lit_Other "[")} {(-z)} {(DQ (${ VSub_Name branch_name))} {(Lit_Other "]")}) (C {(git)} {(branch)} {(-D)} {(${ VSub_Name branch_name)}) ] op_id: Op_DPipe ) (C {(exit)} {(1)}) ] spids: [431] ) ] op_id: Op_DPipe ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:relnotes) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(cat)} {(${ VSub_Name tmpfile)}) (C {(grep)} {(-v)} {(SQ <"^#">)}) (C {(trim_empty_lines)}) ] negated: False ) ] ) left_token: <Left_CommandSub "$("> spids: [499 519] ) ) } spids: [497] ) ] spids: [495] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(-z)} {(DQ (${ VSub_Name relnotes))} {(Lit_Other "]")}) terminator: <Op_Semi ";"> ) ] action: [ (SimpleCommand words: [ {(echo)} {(DQ ("Release notes are empty, cancelling release creation..."))} ] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[547])] ) (SimpleCommand words: [{(git)} {(checkout)} {(-q)} {(${ VSub_Name origin_branch)}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(/dev/null)} spids:[561])] ) (AndOr children: [ (C {(Lit_Other "[")} {(-z)} {(DQ (${ VSub_Name branch_name))} {(Lit_Other "]")}) (C {(git)} {(branch)} {(-D)} {(${ VSub_Name branch_name)}) ] op_id: Op_DPipe ) (C {(exit)} {(1)}) ] spids: [-1 538] ) ] spids: [-1 595] ) (SimpleCommand words: [{(echo)} {(DQ (${ VSub_Name relnotes))}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(${ VSub_Name tmpfile)} spids: [606] ) ] ) ] spids: [393] ) spids: [387 392] ) (FuncDef name: create_release_commit body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:release_title) op: Equal rhs: {(DQ ($ VSub_Number "$1"))} spids: [628] ) ] spids: [626] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:release_name) op: Equal rhs: {(DQ ($ VSub_Number "$2"))} spids: [636] ) ] spids: [634] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:relnotes) op: Equal rhs: {(DQ ($ VSub_Number "$3"))} spids: [644] ) ] spids: [642] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:tmpfile) op: Equal rhs: {(DQ ($ VSub_Number "$4"))} spids: [652] ) ] spids: [650] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:baseline) op: Equal rhs: {(DQ ($ VSub_Number "$5"))} spids: [660] ) ] spids: [658] ) (C {(shift)} {(5)}) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:cherrypicks) op: Equal rhs: {($ VSub_At "$@")} spids: [673] ) ] spids: [671] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:changelog_path) op: Equal rhs: {(DQ ($ VSub_Name "$PWD") (/CHANGELOG.md))} spids: [679] ) ] spids: [677] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:version_info) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(create_revision_information)} {($ VSub_Name "$baseline")} {($ VSub_Name "$cherrypicks")} ) ] ) left_token: <Left_CommandSub "$("> spids: [688 694] ) } spids: [687] ) ] spids: [687] ) (SimpleCommand words: [{(cat)}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(${ VSub_Name tmpfile)} spids: [703] ) (HereDoc op_id: Redir_DLess fd: -1 body: {(DQ ("## ") (${ VSub_Name release_title) ("\n") ("\n"))} do_expansion: True here_end: EOF was_filled: True spids: [708] ) ] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(-n)} {(DQ (${ VSub_Name version_info))} {(Lit_Other "]")}) terminator: <Op_Semi ";"> ) ] action: [ (SimpleCommand words: [{(cat)}] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {(${ VSub_Name tmpfile)} spids: [738] ) (HereDoc op_id: Redir_DLess fd: -1 body: { (DQ (EscapedLiteralPart token:<Lit_EscapedChar "\\`">) (EscapedLiteralPart token: <Lit_EscapedChar "\\`"> ) (EscapedLiteralPart token:<Lit_EscapedChar "\\`">) ("\n") (${ VSub_Name version_info) ("\n") (EscapedLiteralPart token: <Lit_EscapedChar "\\`"> ) (EscapedLiteralPart token:<Lit_EscapedChar "\\`">) (EscapedLiteralPart token:<Lit_EscapedChar "\\`">) ("\n") ) } do_expansion: True here_end: EOF was_filled: True spids: [743] ) ] ) ] spids: [-1 733] ) ] spids: [-1 759] ) (SimpleCommand words: [{(cat)}] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {(${ VSub_Name tmpfile)} spids: [764] ) (HereDoc op_id: Redir_DLess fd: -1 body: {(DQ ("\n") (${ VSub_Name relnotes) ("\n"))} do_expansion: True here_end: EOF was_filled: True spids: [769] ) ] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(-f)} {(DQ (${ VSub_Name changelog_path))} {(Lit_Other "]")} ) terminator: <Op_Semi ";"> ) ] action: [ (SimpleCommand words: [{(echo)}] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {(${ VSub_Name tmpfile)} spids: [799] ) ] ) (SimpleCommand words: [{(cat)} {(DQ (${ VSub_Name changelog_path))}] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {(${ VSub_Name tmpfile)} spids: [813] ) ] ) ] spids: [-1 794] ) ] spids: [-1 819] ) (SimpleCommand words: [{(cat)} {(${ VSub_Name tmpfile)}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(${ VSub_Name changelog_path)} spids: [828] ) ] ) (C {(git)} {(add)} {(${ VSub_Name changelog_path)}) (SimpleCommand words: [{(cat)}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(${ VSub_Name tmpfile)} spids: [850] ) (HereDoc op_id: Redir_DLess fd: -1 body: { (DQ (${ VSub_Name release_title) ("\n") ("\n") (${ VSub_Name version_info) ("\n") ("\n") (${ VSub_Name relnotes) ("\n") ) } do_expansion: True here_end: EOF was_filled: True spids: [855] ) ] ) (C {(git)} {(commit)} {(--no-verify)} {(-F)} {(${ VSub_Name tmpfile)} {(--no-edit)} {(--author)} {(DQ (${ VSub_Name RELEASE_AUTHOR))} ) ] spids: [623] ) spids: [617 622] ) (FuncDef name: apply_cherry_picks body: (BraceGroup children: [ (C {(echo)} {(DQ ("Applying cherry-picks"))}) (ForEach iter_name: i iter_words: [{($ VSub_At "$@")}] do_arg_iter: False body: (DoGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:previous_head) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [(C {(git)} {(rev-parse)} {(HEAD)})] ) left_token: <Left_CommandSub "$("> spids: [934 940] ) ) } spids: [932] ) ] spids: [930] ) (C {(echo)} {(DQ (" Cherry-picking ") ($ VSub_Name "$i"))}) (AndOr children: [ (SimpleCommand words: [{(git)} {(cherry-pick)} {($ VSub_Name "$i")}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(/dev/null)} spids: [958] ) ] ) (BraceGroup children: [ (SimpleCommand words: [ {(echo)} { (DQ ("Failed to cherry-pick ") ($ VSub_Name "$i") (". please resolve the conflict and exit.") ) } ] redirects: [ (Redir op_id: Redir_GreatAnd fd: -1 arg_word: {(2)} spids: [974] ) ] ) (SimpleCommand words: [ {(echo)} { (DQ ( " Use 'git cherry-pick --abort; exit' to abort the cherry-picks." ) ) } ] redirects: [ (Redir op_id: Redir_GreatAnd fd: -1 arg_word: {(2)} spids: [984] ) ] ) (SimpleCommand words: [ {(echo)} { (DQ ( " Use 'git cherry-pick --continue; exit' to resolve the conflict." ) ) } ] redirects: [ (Redir op_id: Redir_GreatAnd fd: -1 arg_word: {(2)} spids: [994] ) ] ) (C {(bash)}) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} { (DQ (CommandSubPart command_list: (CommandList children: [(C {(git)} {(rev-parse)} {(HEAD)})] ) left_token: <Left_CommandSub "$("> spids: [1006 1012] ) ) } {(Lit_Other "=") (Lit_Other "=")} {(DQ (${ VSub_Name previous_head))} {(Lit_Other "]")} ) terminator: <Op_Semi ";"> ) ] action: [ (SimpleCommand words: [ {(echo)} {(DQ ("Cherry-pick aborted, aborting the whole command..."))} ] redirects: [ (Redir op_id: Redir_GreatAnd fd: -1 arg_word: {(2)} spids: [1036] ) ] ) (ControlFlow token: <ControlFlow_Return return> arg_word: {(1)} ) ] spids: [-1 1027] ) ] spids: [-1 1045] ) ] spids: [963] ) ] op_id: Op_DPipe ) ] spids: [927 1051] ) spids: [923 925] ) (ControlFlow token:<ControlFlow_Return return> arg_word:{(0)}) ] spids: [904] ) spids: [898 903] ) (FuncDef name: create_release body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:release_name) op: Equal rhs: {(DQ ($ VSub_Number "$1"))} spids: [1078] ) ] spids: [1076] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:baseline) op: Equal rhs: {(DQ ($ VSub_Number "$2"))} spids: [1086] ) ] spids: [1084] ) (C {(shift)} {(2)}) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:origin_branch) op: Equal rhs: { (CommandSubPart command_list: (CommandList children:[(C {(git_get_branch)})]) left_token: <Left_CommandSub "$("> spids: [1100 1102] ) } spids: [1099] ) ] spids: [1097] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:branch_name) op: Equal rhs: {(DQ (release-) (${ VSub_Name release_name))} spids: [1107] ) ] spids: [1105] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:release_title) op: Equal rhs: { (DQ ("Release ") (${ VSub_Name release_name) (" (") (CommandSubPart command_list: (CommandList children: [ (C {(date)} {(Lit_Other "+") (Lit_Other "%") (Y-) (Lit_Other "%") (m-) (Lit_Other "%") (d) } ) ] ) left_token: <Left_CommandSub "$("> spids: [1125 1135] ) (")") ) } spids: [1118] ) ] spids: [1116] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:tmpfile) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(mktemp)} { (BracedVarSub token: <VSub_Name TMPDIR> suffix_op: (StringUnary op_id: VTest_ColonHyphen arg_word: {(Lit_Slash /) (tmp)} ) spids: [1146 1151] ) (/relnotes-XXXXXXXX) } ) ] ) left_token: <Left_CommandSub "$("> spids: [1143 1153] ) } spids: [1142] ) ] spids: [1140] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:tmpfile2) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(mktemp)} { (BracedVarSub token: <VSub_Name TMPDIR> suffix_op: (StringUnary op_id: VTest_ColonHyphen arg_word: {(Lit_Slash /) (tmp)} ) spids: [1162 1167] ) (/relnotes-XXXXXXXX) } ) ] ) left_token: <Left_CommandSub "$("> spids: [1159 1169] ) } spids: [1158] ) ] spids: [1156] ) (C {(trap)} {(SQ <"rm -f ${tmpfile} ${tmpfile2}">)} {(EXIT)}) (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:rc) op:Equal rhs:{(1)} spids:[1188])] spids: [1186] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(-n)} { (DQ (CommandSubPart command_list: (CommandList children: [ (C {(git)} {(branch)} {(--list)} {(--column)} {(${ VSub_Name branch_name)} ) ] ) left_token: <Left_CommandSub "$("> spids: [1199 1211] ) ) } {(Lit_Other "]")} ) terminator: <Op_Semi ";"> ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:rc) op: Equal rhs: { (ArithSubPart anode: (ArithBinary op_id: Arith_Plus left: (ArithWord w: { (CommandSubPart command_list: (CommandList children: [ (C {(get_release_candidate)} {(DQ (${ VSub_Name branch_name))} ) ] ) left_token: <Left_CommandSub "$("> spids: [1222 1230] ) } ) right: (ArithWord w:{(Lit_Digits 1)}) ) spids: [1221 1234] ) } spids: [1220] ) ] spids: [1220] ) ] spids: [-1 1217] ) ] spids: [-1 1237] ) (AndOr children: [ (SimpleCommand words: [{(git)} {(show)} {(master) (Lit_Other ":") (CHANGELOG.md)}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(${ VSub_Name tmpfile2)} spids: [1253] ) (Redir op_id: Redir_Great fd: 2 arg_word: {(/dev/null)} spids: [1258] ) ] ) (SimpleCommand words: [{(echo)}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(${ VSub_Name tmpfile2)} spids: [1265] ) ] ) ] op_id: Op_DPipe ) (C {(echo)} { (DQ ("Creating new release branch ") (${ VSub_Name branch_name) (" for release ") (${ VSub_Name release_name) ) } ) (C {(git)} {(checkout)} {(-B)} {(${ VSub_Name branch_name)} {(${ VSub_Name baseline)}) (AndOr children: [ (C {(apply_cherry_picks)} {($ VSub_At "$@")}) (BraceGroup children: [ (C {(git)} {(checkout)} {(${ VSub_Name origin_branch)}) (C {(git)} {(branch)} {(-D)} {(${ VSub_Name branch_name)}) (C {(exit)} {(1)}) ] spids: [1308] ) ] op_id: Op_DPipe ) (C {(echo)} {(DQ ("Creating release notes"))}) (SimpleCommand words: [{(echo)} {(DQ (${ VSub_Name RELEASE_NOTE_MESSAGE))}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(${ VSub_Name tmpfile)} spids: [1355] ) ] ) (SimpleCommand words: [{(echo)} {(DQ ("# ") (${ VSub_Name release_title))}] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {(${ VSub_Name tmpfile)} spids: [1371] ) ] ) (SimpleCommand words: [{(echo)}] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {(${ VSub_Name tmpfile)} spids: [1380] ) ] ) (SimpleCommand words: [{(create_release_notes)} {(DQ (${ VSub_Name tmpfile2))}] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {(${ VSub_Name tmpfile)} spids: [1395] ) ] ) (C {(release_note_editor)} {(${ VSub_Name tmpfile)} {(DQ (${ VSub_Name origin_branch))} {(DQ (${ VSub_Name branch_name))} ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:relnotes) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children:[(C {(cat)} {(${ VSub_Name tmpfile)})]) left_token: <Left_CommandSub "$("> spids: [1425 1431] ) ) } spids: [1423] ) ] spids: [1421] ) (C {(create_release_commit)} {(DQ (${ VSub_Name release_title))} {(DQ (${ VSub_Name release_name))} {(DQ (${ VSub_Name relnotes))} {(DQ (${ VSub_Name tmpfile))} {(DQ (${ VSub_Name baseline))} {($ VSub_At "$@")} ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:release_name) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(set_release_name)} {(DQ (${ VSub_Name release_name))} {(DQ (${ VSub_Name rc))} ) ] ) left_token: <Left_CommandSub "$("> spids: [1474 1488] ) } spids: [1473] ) ] spids: [1473] ) (Sentence child: (C {(git)} {(checkout)} {(${ VSub_Name origin_branch)}) terminator: <Op_Amp "&"> ) (SimpleCommand redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(/dev/null)} spids:[1500])] ) (C {(echo)} { (DQ ("Created ") (${ VSub_Name release_name) (" on branch ") (${ VSub_Name branch_name) (.) ) } ) (C {(rm)} {(-f)} {(${ VSub_Name tmpfile)} {(${ VSub_Name tmpfile2)}) (C {(trap)} {(-)} {(EXIT)}) ] spids: [1073] ) spids: [1067 1072] ) (FuncDef name: push_release_candidate body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:branch) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children:[(C {(get_release_branch)})]) left_token: <Left_CommandSub "$("> spids: [1562 1564] ) ) } spids: [1560] ) ] spids: [1558] ) (ForEach iter_name: repo iter_words: [{(${ VSub_Name RELEASE_REPOSITORIES)}] do_arg_iter: False body: (DoGroup children: [ (C {(git)} {(push)} {(-f)} {(${ VSub_Name repo)} {(Lit_Other "+") (${ VSub_Name branch)} ) (C {(git)} {(push)} {(-f)} {(${ VSub_Name repo)} {(Lit_Other "+") (refs/notes/release)} ) (C {(git)} {(push)} {(-f)} {(${ VSub_Name repo)} {(Lit_Other "+") (refs/notes/release-candidate)} ) ] spids: [1579 1626] ) spids: [1573 1577] ) ] spids: [1555] ) spids: [1549 1554] ) (FuncDef name: cleanup_branches body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:tag_name) op: Equal rhs: {($ VSub_Number "$1")} spids: [1645] ) ] spids: [1643] ) (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:i) op:Equal spids:[1651])] spids: [1649] ) (C {(echo)} {(DQ ("Destroying the release branches for release ") (${ VSub_Name tag_name))}) (Sentence child: (C {(git)} {(branch)} {(-D)} {(release-) (${ VSub_Name tag_name)}) terminator: <Op_Amp "&"> ) (AndOr children: [ (SimpleCommand redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(/dev/null)} spids:[1680])] ) (C {(true)}) ] op_id: Op_DPipe ) (ForEach iter_name: i iter_words: [{($ VSub_Name "$RELEASE_REPOSITORIES")}] do_arg_iter: False body: (DoGroup children: [ (Sentence child: (C {(git)} {(push)} {(-f)} {($ VSub_Name "$i")} {(Lit_Other ":") (release-) (${ VSub_Name tag_name)} ) terminator: <Op_Amp "&"> ) (AndOr children: [ (SimpleCommand redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(/dev/null)} spids: [1715] ) ] ) (C {(true)}) ] op_id: Op_DPipe ) ] spids: [1697 1723] ) spids: [1693 1695] ) ] spids: [1640] ) spids: [1634 1639] ) (FuncDef name: do_release body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:branch) op: Equal rhs: { (CommandSubPart command_list: (CommandList children:[(C {(get_release_branch)})]) left_token: <Left_CommandSub "$("> spids: [1749 1751] ) } spids: [1748] ) ] spids: [1746] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:tag_name) op: Equal rhs: { (CommandSubPart command_list: (CommandList children:[(C {(get_release_name)})]) left_token: <Left_CommandSub "$("> spids: [1757 1759] ) } spids: [1756] ) ] spids: [1754] ) (C {(echo)} {(-n)} { (DQ ("You are about to release branch ") (${ VSub_Name branch) (" in tag ") (${ VSub_Name tag_name) (", confirm? [y/N] ") ) } ) (C {(read)} {(answer)}) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(DQ ($ VSub_Name "$answer"))} {(Lit_Other "=")} {(DQ (y))} {(-o)} {(DQ ($ VSub_Name "$answer"))} {(Lit_Other "=")} {(DQ (Y))} {(Lit_Other "]")} ) terminator: <Op_Semi ";"> ) ] action: [ (C {(set_release_name)} {(DQ (${ VSub_Name tag_name))}) (C {(echo)} {(DQ ("Creating the tag"))}) (C {(git)} {(tag)} {(${ VSub_Name tag_name)}) (C {(echo)} {(DQ ("Cherry-picking CHANGELOG.md modification into master"))}) (C {(git)} {(checkout)} {(master)}) (C {(git)} {(pull)} {(--rebase)} { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {(DQ ($ VSub_Name "$MASTER_REPOSITORIES"))}) (C {(cut)} {(-d)} {(DQ (" "))} {(-f)} {(1)}) ] negated: False ) ] ) left_token: <Left_CommandSub "$("> spids: [1871 1891] ) } {(master)} ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:changelog_path) op: Equal rhs: {(DQ ($ VSub_Name "$PWD") (/CHANGELOG.md))} spids: [1906] ) ] spids: [1904] ) (SimpleCommand words: [{(git)} {(show)} {(${ VSub_Name branch) (Lit_Other ":") (CHANGELOG.md)}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(${ VSub_Name changelog_path)} spids: [1923] ) ] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:tmpfile) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(mktemp)} { (BracedVarSub token: <VSub_Name TMPDIR> suffix_op: (StringUnary op_id: VTest_ColonHyphen arg_word: {(Lit_Slash /) (tmp)} ) spids: [1935 1940] ) (/relnotes-XXXXXXXX) } ) ] ) left_token: <Left_CommandSub "$("> spids: [1932 1942] ) } spids: [1931] ) ] spids: [1929] ) (C {(trap)} {(SQ <"rm -f ${tmpfile}">)} {(EXIT)}) (SimpleCommand words: [{(git_commit_msg)} {(${ VSub_Name branch)}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(${ VSub_Name tmpfile)} spids: [1960] ) ] ) (C {(git)} {(add)} {(${ VSub_Name changelog_path)}) (C {(git)} {(commit)} {(--no-verify)} {(-F)} {(${ VSub_Name tmpfile)} {(--no-edit)} {(--author)} {(DQ (${ VSub_Name RELEASE_AUTHOR))} ) (C {(rm)} {(-f)} {(${ VSub_Name tmpfile)}) (C {(trap)} {(-)} {(EXIT)}) (C {(echo)} {(DQ ("Pushing the change to remote repositories"))}) (ForEach iter_name: i iter_words: [{($ VSub_Name "$MASTER_REPOSITORIES")}] do_arg_iter: False body: (DoGroup children: [ (C {(git)} {(push)} {($ VSub_Name "$i")} {(Lit_Other "+") (master)}) ] spids: [2031 2044] ) spids: [2027 2029] ) (ForEach iter_name: i iter_words: [{($ VSub_Name "$RELEASE_REPOSITORIES")}] do_arg_iter: False body: (DoGroup children: [ (C {(git)} {(push)} {($ VSub_Name "$i")} {(Lit_Other "+") (refs/tags/) (${ VSub_Name tag_name)} ) (C {(git)} {(push)} {($ VSub_Name "$i")} {(Lit_Other "+") (refs/notes/release-candidate)} ) (C {(git)} {(push)} {($ VSub_Name "$i")} {(Lit_Other "+") (refs/notes/release)} ) ] spids: [2056 2092] ) spids: [2052 2054] ) (C {(cleanup_branches)} {(${ VSub_Name tag_name)}) ] spids: [-1 1814] ) ] spids: [-1 2102] ) ] spids: [1743] ) spids: [1737 1742] ) (FuncDef name: abandon_release body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:branch_info) op: Equal rhs: { (CommandSubPart command_list: (CommandList children:[(C {(get_release_branch)})]) left_token: <Left_CommandSub "$("> spids: [2125 2127] ) } spids: [2124] ) ] spids: [2122] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:tag_name) op: Equal rhs: { (CommandSubPart command_list: (CommandList children:[(C {(get_release_name)})]) left_token: <Left_CommandSub "$("> spids: [2133 2135] ) } spids: [2132] ) ] spids: [2130] ) (C {(echo)} {(-n)} { (DQ ("You are about to abandon release ") (${ VSub_Name tag_name) (", confirm? [y/N] ")) } ) (C {(read)} {(answer)}) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(DQ ($ VSub_Name "$answer"))} {(Lit_Other "=")} {(DQ (y))} {(-o)} {(DQ ($ VSub_Name "$answer"))} {(Lit_Other "=")} {(DQ (Y))} {(Lit_Other "]")} ) terminator: <Op_Semi ";"> ) ] action: [ (SimpleCommand words: [{(git)} {(checkout)} {(-q)} {(master)}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(/dev/null)} spids:[2196])] ) (C {(cleanup_branches)} {(${ VSub_Name tag_name)}) ] spids: [-1 2185] ) ] spids: [-1 2207] ) ] spids: [2119] ) spids: [2113 2118] ) (FuncDef name: usage body: (BraceGroup children: [ (SimpleCommand words: [{(cat)}] redirects: [ (Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[2223]) (HereDoc op_id: Redir_DLess fd: -1 body: { (DQ ("Usage: ") ($ VSub_Number "$1") (" command [arguments]\n") ("Available commands are:\n") (" - create RELEASE_NAME BASELINE [COMMIT1 ... COMMITN]: creates a new\n") (" release branch for release named RELEASE_NAME, cutting it at\n") (" the commit BASELINE and cherry-picking COMMIT1 ... COMMITN.\n") (" - push: push the current release branch to release repositories.\n") (" - release: do the actual release of the current release branch.\n") (" - abandon: abandon the current release branch.\n") ("\n") ("The typical workflow for the release manager is:\n") ("1. Create the release branch using the decided name for the release\n") (" (usually a version number). The BASELINE is generally a baseline\n") (" that has been tested extensively including inside Google.\n") ("2. Push to the repository and wait for the continuous integration\n") ( " to rebuild and deploy the various artifacts and send the annoucement\n" ) (" mails about a new release candidate being available.\n") ("3. If necessary, creates a new release branch with the same name to\n") (" address return from the users and go back to 2.\n") ("4. Either abandon or release the branch depending on if too much\n") (" problems are reported or if the release is considered viable. The\n") (" CI system should then rebuild from the tag and deploy the artifact\n") (" to GitHub and sends the announcement mails about the new release.\n") ) } do_expansion: True here_end: EOF was_filled: True spids: [2226] ) ] ) (C {(exit)} {(1)}) ] spids: [2218] ) spids: [2212 2217] ) (AndOr children: [ (C {(git)} {(diff-index)} {(--quiet)} {(HEAD)} {(--)}) (BraceGroup children: [ (SimpleCommand words: [{(echo)} {(DQ ("There are pending changes in this git repository."))}] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[2282])] ) (SimpleCommand words: [{(echo)} {(DQ ("Please commit or stash them before using that script."))}] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[2292])] ) (C {(exit)} {(1)}) ] spids: [2273] ) ] op_id: Op_DPipe ) (AndOr children: [ (C {(Lit_Other "[")} { (DQ (CommandSubPart command_list: (CommandList children:[(C {(git)} {(rev-parse)} {(--show-toplevel)})]) left_token: <Left_CommandSub "$("> spids: [2306 2312] ) ) } {(Lit_Other "=") (Lit_Other "=")} {(DQ ($ VSub_Name "$PWD"))} {(Lit_Other "]")} ) (BraceGroup children: [ (SimpleCommand words: [ {(echo)} {(DQ ("You should run this script from the root of the git repository."))} ] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[2335])] ) (C {(exit)} {(1)}) ] spids: [2326] ) ] op_id: Op_DPipe ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:progname) op: Equal rhs: {($ VSub_Number "$0")} spids: [2346] ) ] spids: [2346] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:cmd) op: Equal rhs: { (BracedVarSub token: <VSub_Number 1> suffix_op: (StringUnary op_id:VTest_Hyphen arg_word:{}) spids: [2350 2353] ) } spids: [2349] ) ] spids: [2349] ) (AndOr children:[(C {(shift)})(C {(usage)} {($ VSub_Name "$progname")})] op_id:Op_DPipe) (Case to_match: {($ VSub_Name "$cmd")} arms: [ (case_arm pat_list: [{(create)}] action: [ (AndOr children: [ (DParen child: (ArithBinary op_id: Arith_GreatEqual left: (ArithWord w:{($ VSub_Pound "$#")}) right: (ArithWord w:{(Lit_Digits 2)}) ) ) (C {(usage)} {($ VSub_Name "$progname")}) ] op_id: Op_DPipe ) (C {(create_release)} {(DQ ($ VSub_At "$@"))}) ] spids: [2371 2372 2400 -1] ) (case_arm pat_list: [{(push)}] action: [(C {(push_release_candidate)})] spids: [2403 2404 2410 -1] ) (case_arm pat_list:[{(release)}] action:[(C {(do_release)})] spids:[241324142420-1]) (case_arm pat_list: [{(abandon)}] action: [(C {(abandon_release)})] spids: [2423 2424 2430 -1] ) (case_arm pat_list: [{(Lit_Other "*")}] action: [(C {(usage)} {($ VSub_Name "$progname")})] spids: [2433 2434 2442 -1] ) ] spids: [2364 2368 2444] ) ] )