(CommandList
  children: [
    (C {(set)} {(-o)} {(errexit)})
    (C {(set)} {(-o)} {(nounset)})
    (C {(set)} {(-o)} {(pipefail)})
    (Assignment
      keyword: Assign_Declare
      flags: [-r]
      pairs: [
        (assign_pair
          lhs: (LhsName name:KUBE_ROOT)
          op: Equal
          rhs: 
            {
              (DQ 
                (CommandSubPart
                  command_list: 
                    (CommandList
                      children: [(C {(dirname)} {(DQ (${ VSub_Name BASH_SOURCE))})]
                    )
                  left_token: <Left_CommandSub '$('>
                  spids: [82 90]
                ) (/..)
              )
            }
          spids: [80]
        )
      ]
      spids: [76]
    )
    (C {(cd)} {(DQ (${ VSub_Name KUBE_ROOT))})
    (Assignment
      keyword: Assign_Declare
      flags: [-r]
      pairs: [
        (assign_pair
          lhs: (LhsName name:STARTINGBRANCH)
          op: Equal
          rhs: 
            {
              (CommandSubPart
                command_list: 
                  (CommandList
                    children: [(C {(git)} {(symbolic-ref)} {(--short)} {(HEAD)})]
                  )
                left_token: <Left_CommandSub '$('>
                spids: [108 116]
              )
            }
          spids: [107]
        )
      ]
      spids: [103]
    )
    (Assignment
      keyword: Assign_Declare
      flags: [-r]
      pairs: [
        (assign_pair
          lhs: (LhsName name:REBASEMAGIC)
          op: Equal
          rhs: {(DQ (${ VSub_Name KUBE_ROOT) (/.git/rebase-apply))}
          spids: [122]
        )
      ]
      spids: [118]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:DRY_RUN)
          op: Equal
          rhs: 
            {
              (BracedVarSub
                token: <VSub_Name DRY_RUN>
                suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(DQ )})
                spids: [131 136]
              )
            }
          spids: [130]
        )
      ]
      spids: [130]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:REGENERATE_DOCS)
          op: Equal
          rhs: 
            {
              (BracedVarSub
                token: <VSub_Name REGENERATE_DOCS>
                suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(DQ )})
                spids: [139 144]
              )
            }
          spids: [138]
        )
      ]
      spids: [138]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:UPSTREAM_REMOTE)
          op: Equal
          rhs: 
            {
              (BracedVarSub
                token: <VSub_Name UPSTREAM_REMOTE>
                suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(upstream)})
                spids: [147 151]
              )
            }
          spids: [146]
        )
      ]
      spids: [146]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:FORK_REMOTE)
          op: Equal
          rhs: 
            {
              (BracedVarSub
                token: <VSub_Name FORK_REMOTE>
                suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(origin)})
                spids: [154 158]
              )
            }
          spids: [153]
        )
      ]
      spids: [153]
    )
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: 
                (DBracket
                  expr: 
                    (BoolUnary
                      op_id: BoolUnary_z
                      child: 
                        {
                          (BracedVarSub
                            token: <VSub_Name GITHUB_USER>
                            suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{})
                            spids: [167 170]
                          )
                        }
                    )
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (C {(echo)} 
              {
                (DQ 
                  (
"Please export GITHUB_USER=<your-user> (or GH organization, if that's where your fork lives)"
                  )
                )
              }
            )
            (C {(exit)} {(1)})
          ]
          spids: [16777215 175]
        )
      ]
      spids: [16777215 189]
    )
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: 
                (Pipeline
                  children: [
                    (SimpleCommand
                      words: [{(which)} {(hub)}]
                      redirects: [
                        (Redir
                          op_id: Redir_Great
                          fd: 16777215
                          arg_word: {(/dev/null)}
                          spids: [200]
                        )
                      ]
                    )
                  ]
                  negated: True
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (C {(echo)} 
              {
                (DQ 
                  (
"Can't find 'hub' tool in PATH, please install from https://github.com/github/hub"
                  )
                )
              }
            )
            (C {(exit)} {(1)})
          ]
          spids: [16777215 205]
        )
      ]
      spids: [16777215 219]
    )
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: 
                (DBracket
                  expr: (BoolBinary op_id:BoolBinary_lt left:{(DQ ($ VSub_Pound '$#'))} right:{(2)})
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (C {(echo)} 
              {
                (DQ (${ VSub_Number 0) 
                  (
' <remote branch> <pr-number>...: cherry pick one or more <pr> onto <remote branch> and leave instructions for proposing pull request'
                  )
                )
              }
            )
            (C {(echo)})
            (C {(echo)} 
              {
                (DQ 
                  (
'  Checks out <remote branch> and handles the cherry-pick of <pr> (possibly multiple) for you.'
                  )
                )
              }
            )
            (C {(echo)} {(DQ ('  Examples:'))})
            (C {(echo)} 
              {
                (DQ ('    ') ($ VSub_Number '$0') 
                  (
' upstream/release-3.14 12345        # Cherry-picks PR 12345 onto upstream/release-3.14 and proposes that as a PR.'
                  )
                )
              }
            )
            (C {(echo)} 
              {
                (DQ ('    ') ($ VSub_Number '$0') 
                  (
' upstream/release-3.14 12345 56789  # Cherry-picks PR 12345, then 56789 and proposes the combination as a single PR.'
                  )
                )
              }
            )
            (C {(echo)})
            (C {(echo)} {(DQ ('  Set the DRY_RUN environment var to skip git push and creating PR.'))})
            (C {(echo)} 
              {
                (DQ 
                  (
'  This is useful for creating patches to a release branch without making a PR.'
                  )
                )
              }
            )
            (C {(echo)} 
              {
                (DQ 
                  (
'  When DRY_RUN is set the script will leave you in a branch containing the commits you cherry-picked.'
                  )
                )
              }
            )
            (C {(echo)})
            (C {(echo)} 
              {
                (DQ 
                  (
'  Set the REGENERATE_DOCS environment var to regenerate documentation for the target branch after picking the specified commits.'
                  )
                )
              }
            )
            (C {(echo)} 
              {
                (DQ 
                  (
'  This is useful when picking commits containing changes to API documentation.'
                  )
                )
              }
            )
            (C {(echo)})
            (C {(echo)} 
              {(DQ (' Set UPSTREAM_REMOTE (default: upstream) and FORK_REMOTE (default: origin)'))}
            )
            (C {(echo)} {(DQ (' To override the default remote names to what you have locally.'))})
            (C {(exit)} {(2)})
          ]
          spids: [16777215 237]
        )
      ]
      spids: [16777215 347]
    )
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: 
                (AndOr
                  children: [
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:git_status)
                          op: Equal
                          rhs: 
                            {
                              (CommandSubPart
                                command_list: 
                                  (CommandList
                                    children: [
                                      (SimpleCommand
                                        words: [
                                          {(git)}
                                          {(status)}
                                          {(--porcelain)}
                                          {(--untracked) (Lit_Other '=') (no)}
                                        ]
                                        redirects: [
                                          (Redir
                                            op_id: Redir_Great
                                            fd: 2
                                            arg_word: {(/dev/null)}
                                            spids: [364]
                                          )
                                        ]
                                      )
                                    ]
                                  )
                                left_token: <Left_CommandSub '$('>
                                spids: [353 366]
                              )
                            }
                          spids: [352]
                        )
                      ]
                      spids: [352]
                    )
                    (DBracket
                      expr: (BoolUnary op_id:BoolUnary_n child:{(DQ (${ VSub_Name git_status))})
                    )
                  ]
                  op_id: Op_DAmp
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [(C {(echo)} {(DQ ('!!! Dirty tree. Clean up and try again.'))}) (C {(exit)} {(1)})]
          spids: [16777215 383]
        )
      ]
      spids: [16777215 397]
    )
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: 
                (DBracket
                  expr: (BoolUnary op_id:BoolUnary_e child:{(DQ (${ VSub_Name REBASEMAGIC))})
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (C {(echo)} {(DQ ("!!! 'git rebase' or 'git am' in progress. Clean up and try again."))})
            (C {(exit)} {(1)})
          ]
          spids: [16777215 415]
        )
      ]
      spids: [16777215 429]
    )
    (Assignment
      keyword: Assign_Declare
      flags: [-r]
      pairs: [
        (assign_pair
          lhs: (LhsName name:BRANCH)
          op: Equal
          rhs: {(DQ ($ VSub_Number '$1'))}
          spids: [436]
        )
      ]
      spids: [432]
    )
    (C {(shift)} {(1)})
    (Assignment
      keyword: Assign_Declare
      flags: [-r]
      pairs: [
        (assign_pair
          lhs: (LhsName name:PULLS)
          op: Equal
          rhs: {(ArrayLiteralPart words:[{(DQ ($ VSub_At '$@'))}])}
          spids: [449]
        )
      ]
      spids: [445]
    )
    (FuncDef
      name: join
      body: 
        (BraceGroup
          children: [
            (Sentence
              child: 
                (Assignment
                  keyword: Assign_Local
                  pairs: [
                    (assign_pair
                      lhs: (LhsName name:IFS)
                      op: Equal
                      rhs: {(DQ ($ VSub_Number '$1'))}
                      spids: [467]
                    )
                  ]
                  spids: [465]
                )
              terminator: <Op_Semi ';'>
            )
            (Sentence child:(C {(shift)}) terminator:<Op_Semi ';'>)
            (Sentence
              child: (C {(echo)} {(DQ ($ VSub_Star '$*'))})
              terminator: <Op_Semi ';'>
            )
          ]
          spids: [463]
        )
      spids: [459 462]
    )
    (Assignment
      keyword: Assign_Declare
      flags: [-r]
      pairs: [
        (assign_pair
          lhs: (LhsName name:PULLDASH)
          op: Equal
          rhs: 
            {
              (CommandSubPart
                command_list: 
                  (CommandList
                    children: [
                      (C {(join)} {(-)} 
                        {
                          (DQ 
                            (BracedVarSub
                              token: <VSub_Name PULLS>
                              bracket_op: (WholeArray op_id:Lit_At)
                              suffix_op: 
                                (PatSub
                                  pat: {}
                                  replace: {(Lit_Pound '#')}
                                  do_all: False
                                  do_prefix: True
                                  do_suffix: False
                                )
                              spids: [496 505]
                            )
                          )
                        }
                      )
                    ]
                  )
                left_token: <Left_CommandSub '$('>
                spids: [490 507]
              )
            }
          spids: [489]
        )
      ]
      spids: [485]
    )
    (Assignment
      keyword: Assign_Declare
      flags: [-r]
      pairs: [
        (assign_pair
          lhs: (LhsName name:PULLSUBJ)
          op: Equal
          rhs: 
            {
              (CommandSubPart
                command_list: 
                  (CommandList
                    children: [
                      (C {(join)} {(DQ (' '))} 
                        {
                          (DQ 
                            (BracedVarSub
                              token: <VSub_Name PULLS>
                              bracket_op: (WholeArray op_id:Lit_At)
                              suffix_op: 
                                (PatSub
                                  pat: {}
                                  replace: {(Lit_Pound '#')}
                                  do_all: False
                                  do_prefix: True
                                  do_suffix: False
                                )
                              spids: [525 534]
                            )
                          )
                        }
                      )
                    ]
                  )
                left_token: <Left_CommandSub '$('>
                spids: [517 536]
              )
            }
          spids: [516]
        )
      ]
      spids: [512]
    )
    (C {(echo)} {(DQ ('+++ Updating remotes...'))})
    (C {(git)} {(remote)} {(update)} {(DQ (${ VSub_Name UPSTREAM_REMOTE))} 
      {(DQ (${ VSub_Name FORK_REMOTE))}
    )
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: 
                (Pipeline
                  children: [
                    (SimpleCommand
                      words: [
                        {(git)}
                        {(log)}
                        {(-n1)}
                        {(--format) (Lit_Other '=') (Lit_Other '%') (H)}
                        {(DQ (${ VSub_Name BRANCH))}
                      ]
                      redirects: [
                        (Redir
                          op_id: Redir_Great
                          fd: 16777215
                          arg_word: {(/dev/null)}
                          spids: [588]
                        )
                        (Redir
                          op_id: Redir_GreatAnd
                          fd: 2
                          arg_word: {(1)}
                          spids: [591]
                        )
                      ]
                    )
                  ]
                  negated: True
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (C {(echo)} 
              {
                (DQ ("!!! '") (${ VSub_Name BRANCH) 
                  ("' not found. The second argument should be something like ") (${ VSub_Name UPSTREAM_REMOTE) (/release-0.21.)
                )
              }
            )
            (C {(echo)} 
              {
                (DQ 
                  (
"    (In particular, it needs to be a valid, existing remote branch that I can 'git checkout'.)"
                  )
                )
              }
            )
            (C {(exit)} {(1)})
          ]
          spids: [16777215 595]
        )
      ]
      spids: [16777215 624]
    )
    (Assignment
      keyword: Assign_Declare
      flags: [-r]
      pairs: [
        (assign_pair
          lhs: (LhsName name:NEWBRANCHREQ)
          op: Equal
          rhs: {(DQ (automated-cherry-pick-of-) (${ VSub_Name PULLDASH))}
          spids: [631]
        )
      ]
      spids: [627]
    )
    (Assignment
      keyword: Assign_Declare
      flags: [-r]
      pairs: [
        (assign_pair
          lhs: (LhsName name:NEWBRANCH)
          op: Equal
          rhs: 
            {
              (DQ 
                (CommandSubPart
                  command_list: 
                    (CommandList
                      children: [
                        (Pipeline
                          children: [
                            (C {(echo)} {(DQ (${ VSub_Name NEWBRANCHREQ) (-) (${ VSub_Name BRANCH))})
                            (C {(sed)} {(SQ <'s/\\//-/g'>)})
                          ]
                          negated: False
                        )
                      ]
                    )
                  left_token: <Left_CommandSub '$('>
                  spids: [648 668]
                )
              )
            }
          spids: [646]
        )
      ]
      spids: [642]
    )
    (Assignment
      keyword: Assign_Declare
      flags: [-r]
      pairs: [
        (assign_pair
          lhs: (LhsName name:NEWBRANCHUNIQ)
          op: Equal
          rhs: 
            {
              (DQ (${ VSub_Name NEWBRANCH) (-) 
                (CommandSubPart
                  command_list: 
                    (CommandList
                      children: [(C {(date)} {(Lit_Other '+') (Lit_Other '%') (s)})]
                    )
                  left_token: <Left_CommandSub '$('>
                  spids: [681 687]
                )
              )
            }
          spids: [675]
        )
      ]
      spids: [671]
    )
    (C {(echo)} {(DQ ('+++ Creating local branch ') (${ VSub_Name NEWBRANCHUNIQ))})
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:cleanbranch) op:Equal rhs:{(DQ )} spids:[700])]
      spids: [700]
    )
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:prtext) op:Equal rhs:{(DQ )} spids:[704])]
      spids: [704]
    )
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:gitamcleanup) op:Equal rhs:{(false)} spids:[708])]
      spids: [708]
    )
    (FuncDef
      name: return_to_kansas
      body: 
        (BraceGroup
          children: [
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (DBracket
                          expr: 
                            (BoolBinary
                              op_id: BoolBinary_GlobDEqual
                              left: {(DQ (${ VSub_Name gitamcleanup))}
                              right: {(DQ (true))}
                            )
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (C {(echo)})
                    (C {(echo)} {(DQ ('+++ Aborting in-progress git am.'))})
                    (AndOr
                      children: [
                        (SimpleCommand
                          words: [{(git)} {(am)} {(--abort)}]
                          redirects: [
                            (Redir
                              op_id: Redir_Great
                              fd: 16777215
                              arg_word: {(/dev/null)}
                              spids: [756]
                            )
                            (Redir
                              op_id: Redir_GreatAnd
                              fd: 2
                              arg_word: {(1)}
                              spids: [759]
                            )
                          ]
                        )
                        (C {(true)})
                      ]
                      op_id: Op_DPipe
                    )
                  ]
                  spids: [16777215 737]
                )
              ]
              spids: [16777215 767]
            )
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (DBracket
                          expr: (BoolUnary op_id:BoolUnary_z child:{(DQ (${ VSub_Name DRY_RUN))})
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (C {(echo)})
                    (C {(echo)} 
                      {
                        (DQ ('+++ Returning you to the ') (${ VSub_Name STARTINGBRANCH) 
                          (' branch and cleaning up.')
                        )
                      }
                    )
                    (AndOr
                      children: [
                        (SimpleCommand
                          words: [{(git)} {(checkout)} {(-f)} {(DQ (${ VSub_Name STARTINGBRANCH))}]
                          redirects: [
                            (Redir
                              op_id: Redir_Great
                              fd: 16777215
                              arg_word: {(/dev/null)}
                              spids: [819]
                            )
                            (Redir
                              op_id: Redir_GreatAnd
                              fd: 2
                              arg_word: {(1)}
                              spids: [822]
                            )
                          ]
                        )
                        (C {(true)})
                      ]
                      op_id: Op_DPipe
                    )
                    (If
                      arms: [
                        (if_arm
                          cond: [
                            (Sentence
                              child: 
                                (DBracket
                                  expr: 
                                    (BoolUnary
                                      op_id: BoolUnary_n
                                      child: {(DQ (${ VSub_Name cleanbranch))}
                                    )
                                )
                              terminator: <Op_Semi ';'>
                            )
                          ]
                          action: [
                            (AndOr
                              children: [
                                (SimpleCommand
                                  words: [{(git)} {(branch)} {(-D)} {(DQ (${ VSub_Name cleanbranch))}]
                                  redirects: [
                                    (Redir
                                      op_id: Redir_Great
                                      fd: 16777215
                                      arg_word: {(/dev/null)}
                                      spids: [860]
                                    )
                                    (Redir
                                      op_id: Redir_GreatAnd
                                      fd: 2
                                      arg_word: {(1)}
                                      spids: [863]
                                    )
                                  ]
                                )
                                (C {(true)})
                              ]
                              op_id: Op_DPipe
                            )
                          ]
                          spids: [16777215 845]
                        )
                      ]
                      spids: [16777215 871]
                    )
                    (If
                      arms: [
                        (if_arm
                          cond: [
                            (Sentence
                              child: 
                                (DBracket
                                  expr: (BoolUnary op_id:BoolUnary_n child:{(DQ (${ VSub_Name prtext))})
                                )
                              terminator: <Op_Semi ';'>
                            )
                          ]
                          action: [(C {(rm)} {(DQ (${ VSub_Name prtext))})]
                          spids: [16777215 889]
                        )
                      ]
                      spids: [16777215 901]
                    )
                  ]
                  spids: [16777215 790]
                )
              ]
              spids: [16777215 904]
            )
          ]
          spids: [715]
        )
      spids: [711 714]
    )
    (C {(trap)} {(return_to_kansas)} {(EXIT)})
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:SUBJECTS) op:Equal rhs:{(ArrayLiteralPart)} spids:[915])]
      spids: [915]
    )
    (FuncDef
      name: make-a-pr
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (LhsName name:rel)
                  op: Equal
                  rhs: 
                    {
                      (DQ 
                        (CommandSubPart
                          command_list: 
                            (CommandList
                              children: [(C {(basename)} {(DQ (${ VSub_Name BRANCH))})]
                            )
                          left_token: <Left_CommandSub '$('>
                          spids: [932 940]
                        )
                      )
                    }
                  spids: [930]
                )
              ]
              spids: [928]
            )
            (C {(echo)})
            (C {(echo)} 
              {
                (DQ ('+++ Creating a pull request on GitHub at ') (${ VSub_Name GITHUB_USER) (':') 
                  (${ VSub_Name NEWBRANCH)
                )
              }
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:prtext)
                  op: Equal
                  rhs: 
                    {
                      (DQ 
                        (CommandSubPart
                          command_list: 
                            (CommandList
                              children: [(C {(mktemp)} {(-t)} {(prtext.XXXX)})]
                            )
                          left_token: <Left_CommandSub '$('>
                          spids: [980 986]
                        )
                      )
                    }
                  spids: [978]
                )
              ]
              spids: [978]
            )
            (SimpleCommand
              words: [{(cat)}]
              redirects: [
                (Redir
                  op_id: Redir_Great
                  fd: 16777215
                  arg_word: {(DQ (${ VSub_Name prtext))}
                  spids: [995]
                )
                (HereDoc
                  op_id: Redir_DLess
                  fd: 16777215
                  body: 
                    {
                      (DQ ('Automated cherry pick of ') (${ VSub_Name PULLSUBJ) ('\n') ('\n') 
                        ('Cherry pick of ') (${ VSub_Name PULLSUBJ) (' on ') (${ VSub_Name rel) ('.\n') ('\n') 
                        (CommandSubPart
                          command_list: 
                            (CommandList
                              children: [
                                (C {(printf)} {(SQ <'%s\\n'>)} 
                                  {
                                    (DQ 
                                      (BracedVarSub
                                        token: <VSub_Name SUBJECTS>
                                        bracket_op: (WholeArray op_id:Lit_At)
                                        spids: [1029 1034]
                                      )
                                    )
                                  }
                                )
                              ]
                            )
                          left_token: <Left_CommandSub '$('>
                          spids: [1021 1036]
                        ) ('\n')
                      )
                    }
                  do_expansion: True
                  here_end: EOF
                  was_filled: True
                  spids: [1002]
                )
              ]
            )
            (C {(hub)} {(pull-request)} {(-F)} {(DQ (${ VSub_Name prtext))} {(-h)} 
              {(DQ (${ VSub_Name GITHUB_USER) (':') (${ VSub_Name NEWBRANCH))} {(-b)} {(DQ ('kubernetes:') (${ VSub_Name rel))}
            )
          ]
          spids: [925]
        )
      spids: [919 924]
    )
    (C {(git)} {(checkout)} {(-b)} {(DQ (${ VSub_Name NEWBRANCHUNIQ))} {(DQ (${ VSub_Name BRANCH))})
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:cleanbranch)
          op: Equal
          rhs: {(DQ (${ VSub_Name NEWBRANCHUNIQ))}
          spids: [1095]
        )
      ]
      spids: [1095]
    )
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:gitamcleanup) op:Equal rhs:{(true)} spids:[1103])]
      spids: [1103]
    )
    (ForEach
      iter_name: pull
      iter_words: [
        {
          (DQ 
            (BracedVarSub
              token: <VSub_Name PULLS>
              bracket_op: (WholeArray op_id:Lit_At)
              spids: [1113 1118]
            )
          )
        }
      ]
      do_arg_iter: False
      body: 
        (DoGroup
          children: [
            (C {(echo)} 
              {
                (DQ ('+++ Downloading patch to /tmp/') (${ VSub_Name pull) 
                  ('.patch (in case you need to do this again)')
                )
              }
            )
            (C {(curl)} {(-o)} {(DQ (/tmp/) (${ VSub_Name pull) (.patch))} {(-sSL)} 
              {(DQ ('http://pr.k8s.io/') (${ VSub_Name pull) (.patch))}
            )
            (C {(echo)})
            (C {(echo)} {(DQ ('+++ About to attempt cherry pick of PR. To reattempt:'))})
            (C {(echo)} {(DQ ('  ') (Lit_Other '$') (' git am -3 /tmp/') (${ VSub_Name pull) (.patch))})
            (C {(echo)})
            (AndOr
              children: [
                (C {(git)} {(am)} {(-3)} {(DQ (/tmp/) (${ VSub_Name pull) (.patch))})
                (BraceGroup
                  children: [
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:conflicts)
                          op: Equal
                          rhs: {(false)}
                          spids: [1204]
                        )
                      ]
                      spids: [1204]
                    )
                    (While
                      cond: [
                        (Sentence
                          child: 
                            (AndOr
                              children: [
                                (Assignment
                                  keyword: Assign_None
                                  pairs: [
                                    (assign_pair
                                      lhs: (LhsName name:unmerged)
                                      op: Equal
                                      rhs: 
                                        {
                                          (CommandSubPart
                                            command_list: 
                                              (CommandList
                                                children: [
                                                  (Pipeline
                                                    children: [
                                                      (C {(git)} {(status)} {(--porcelain)})
                                                      (C {(grep)} {(Lit_Other '^') (U)})
                                                    ]
                                                    negated: False
                                                  )
                                                ]
                                              )
                                            left_token: <Left_CommandSub '$('>
                                            spids: [1211 1224]
                                          )
                                        }
                                      spids: [1210]
                                    )
                                  ]
                                  spids: [1210]
                                )
                                (AndOr
                                  children: [
                                    (DBracket
                                      expr: 
                                        (BoolUnary
                                          op_id: BoolUnary_n
                                          child: {(${ VSub_Name unmerged)}
                                        )
                                    )
                                    (DBracket
                                      expr: 
                                        (BoolUnary
                                          op_id: BoolUnary_e
                                          child: {(DQ (${ VSub_Name REBASEMAGIC))}
                                        )
                                    )
                                  ]
                                  op_id: Op_DPipe
                                )
                              ]
                              op_id: Op_DAmp
                            )
                          terminator: <Op_Semi ';'>
                        )
                      ]
                      body: 
                        (DoGroup
                          children: [
                            (Assignment
                              keyword: Assign_None
                              pairs: [
                                (assign_pair
                                  lhs: (LhsName name:conflicts)
                                  op: Equal
                                  rhs: {(true)}
                                  spids: [1258]
                                )
                              ]
                              spids: [1258]
                            )
                            (C {(echo)})
                            (C {(echo)} {(DQ ('+++ Conflicts detected:'))})
                            (C {(echo)})
                            (AndOr
                              children: [
                                (Subshell
                                  child: 
                                    (Pipeline
                                      children: [
                                        (C {(git)} {(status)} {(--porcelain)})
                                        (C {(grep)} {(Lit_Other '^') (U)})
                                      ]
                                      negated: False
                                    )
                                  spids: [1278 1291]
                                )
                                (C {(echo)} {(DQ ('!!! None. Did you git am --continue?'))})
                              ]
                              op_id: Op_DPipe
                            )
                            (C {(echo)})
                            (C {(echo)} 
                              {
                                (DQ 
                                  (
"+++ Please resolve the conflicts in another window (and remember to 'git add / git am --continue')"
                                  )
                                )
                              }
                            )
                            (C {(read)} {(-p)} 
                              {
                                (DQ ("+++ Proceed (anything but 'y' aborts the cherry-pick)? [y/n] "))
                              } {(-r)}
                            )
                            (C {(echo)})
                            (If
                              arms: [
                                (if_arm
                                  cond: [
                                    (Sentence
                                      child: 
                                        (Pipeline
                                          children: [
                                            (DBracket
                                              expr: 
                                                (BoolBinary
                                                  op_id: BoolBinary_EqualTilde
                                                  left: {(DQ (${ VSub_Name REPLY))}
                                                  right: 
                                                    {(Lit_Other '^') (Lit_Other '[') (yY) 
                                                      (Lit_Other ']') (Lit_Other '$')
                                                    }
                                                )
                                            )
                                          ]
                                          negated: True
                                        )
                                      terminator: <Op_Semi ';'>
                                    )
                                  ]
                                  action: [
                                    (SimpleCommand
                                      words: [{(echo)} {(DQ (Aborting.))}]
                                      redirects: [
                                        (Redir
                                          op_id: Redir_GreatAnd
                                          fd: 16777215
                                          arg_word: {(2)}
                                          spids: [1358]
                                        )
                                      ]
                                    )
                                    (C {(exit)} {(1)})
                                  ]
                                  spids: [16777215 1349]
                                )
                              ]
                              spids: [16777215 1367]
                            )
                          ]
                          spids: [1255 1370]
                        )
                    )
                    (If
                      arms: [
                        (if_arm
                          cond: [
                            (Sentence
                              child: 
                                (DBracket
                                  expr: 
                                    (BoolBinary
                                      op_id: BoolBinary_GlobNEqual
                                      left: {(DQ (${ VSub_Name conflicts))}
                                      right: {(DQ (true))}
                                    )
                                )
                              terminator: <Op_Semi ';'>
                            )
                          ]
                          action: [
                            (C {(echo)} 
                              {
                                (DQ 
                                  (
"!!! git am failed, likely because of an in-progress 'git am' or 'git rebase'"
                                  )
                                )
                              }
                            )
                            (C {(exit)} {(1)})
                          ]
                          spids: [16777215 1393]
                        )
                      ]
                      spids: [16777215 1408]
                    )
                  ]
                  spids: [1201]
                )
              ]
              op_id: Op_DPipe
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:subject)
                  op: Equal
                  rhs: 
                    {
                      (CommandSubPart
                        command_list: 
                          (CommandList
                            children: [
                              (Pipeline
                                children: [
                                  (C {(grep)} {(-m)} {(1)} {(DQ ('^Subject'))} 
                                    {(DQ (/tmp/) (${ VSub_Name pull) (.patch))}
                                  )
                                  (C {(sed)} {(-e)} {(SQ <'s/Subject: \\[PATCH//g'>)})
                                  (C {(sed)} {(SQ <'s/.*] //'>)})
                                ]
                                negated: False
                              )
                            ]
                          )
                        left_token: <Left_CommandSub '$('>
                        spids: [1420 1456]
                      )
                    }
                  spids: [1419]
                )
              ]
              spids: [1419]
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:SUBJECTS)
                  op: PlusEqual
                  rhs: 
                    {
                      (ArrayLiteralPart
                        words: [{(DQ ('#') (${ VSub_Name pull) (': ') (${ VSub_Name subject))}]
                      )
                    }
                  spids: [1459]
                )
              ]
              spids: [1459]
            )
            (C {(rm)} {(-f)} {(DQ (/tmp/) (${ VSub_Name pull) (.patch))})
          ]
          spids: [1122 1491]
        )
      spids: [1111 1120]
    )
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:gitamcleanup) op:Equal rhs:{(false)} spids:[1493])]
      spids: [1493]
    )
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: 
                (DBracket
                  expr: (BoolUnary op_id:BoolUnary_n child:{(DQ (${ VSub_Name REGENERATE_DOCS))})
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (C {(echo)})
            (C {(echo)} {(DQ ('Regenerating docs...'))})
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: (Pipeline children:[(C {(hack/generate-docs.sh)})] negated:True)
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (C {(echo)})
                    (C {(echo)} {(DQ ('hack/generate-docs.sh FAILED to complete.'))})
                    (C {(exit)} {(1)})
                  ]
                  spids: [16777215 1535]
                )
              ]
              spids: [16777215 1553]
            )
          ]
          spids: [16777215 1515]
        )
      ]
      spids: [16777215 1555]
    )
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: (DBracket expr:(BoolUnary op_id:BoolUnary_n child:{(DQ (${ VSub_Name DRY_RUN))}))
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (C {(echo)} {(DQ ('!!! Skipping git push and PR creation because you set DRY_RUN.'))})
            (C {(echo)} {(DQ ('To return to the branch you were in when you invoked this script:'))})
            (C {(echo)})
            (C {(echo)} {(DQ ('  git checkout ') (${ VSub_Name STARTINGBRANCH))})
            (C {(echo)})
            (C {(echo)} {(DQ ('To delete this branch:'))})
            (C {(echo)})
            (C {(echo)} {(DQ ('  git branch -D ') (${ VSub_Name NEWBRANCHUNIQ))})
            (C {(exit)} {(0)})
          ]
          spids: [16777215 1573]
        )
      ]
      spids: [16777215 1630]
    )
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: 
                (Pipeline
                  children: [
                    (C {(git)} {(remote)} {(-v)})
                    (C {(grep)} {(Lit_Other '^') (${ VSub_Name FORK_REMOTE)})
                    (C {(grep)} {(kubernetes/kubernetes.git)})
                  ]
                  negated: False
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (C {(echo)} 
              {
                (DQ ('!!! You have ') (${ VSub_Name FORK_REMOTE) 
                  (' configured as your kubernetes/kubernetes.git')
                )
              }
            )
            (C {(echo)} {(DQ ("This isn't normal. Leaving you with push instructions:"))})
            (C {(echo)})
            (C {(echo)} {(DQ ('+++ First manually push the branch this script created:'))})
            (C {(echo)})
            (C {(echo)} 
              {
                (DQ ('  git push REMOTE ') (${ VSub_Name NEWBRANCHUNIQ) (':') (${ VSub_Name NEWBRANCH))
              }
            )
            (C {(echo)})
            (C {(echo)} 
              {
                (DQ ('where REMOTE is your personal fork (maybe ') (${ VSub_Name UPSTREAM_REMOTE) 
                  ('? Consider swapping those.).')
                )
              }
            )
            (C {(echo)} 
              {(DQ ('OR consider setting UPSTREAM_REMOTE and FORK_REMOTE to different values.'))}
            )
            (C {(echo)})
            (C {(make-a-pr)})
            (Assignment
              keyword: Assign_None
              pairs: [(assign_pair lhs:(LhsName name:cleanbranch) op:Equal rhs:{(DQ )} spids:[1732])]
              spids: [1732]
            )
            (C {(exit)} {(0)})
          ]
          spids: [16777215 1657]
        )
      ]
      spids: [16777215 1741]
    )
    (C {(echo)})
    (C {(echo)} 
      {
        (DQ ("+++ I'm about to do the following to push to GitHub (and I'm assuming ") 
          (${ VSub_Name FORK_REMOTE) (' is your personal fork):')
        )
      }
    )
    (C {(echo)})
    (C {(echo)} 
      {
        (DQ ('  git push ') (${ VSub_Name FORK_REMOTE) (' ') (${ VSub_Name NEWBRANCHUNIQ) (':') 
          (${ VSub_Name NEWBRANCH)
        )
      }
    )
    (C {(echo)})
    (C {(read)} {(-p)} {(DQ ("+++ Proceed (anything but 'y' aborts the cherry-pick)? [y/n] "))} {(-r)})
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: 
                (Pipeline
                  children: [
                    (DBracket
                      expr: 
                        (BoolBinary
                          op_id: BoolBinary_EqualTilde
                          left: {(DQ (${ VSub_Name REPLY))}
                          right: 
                            {(Lit_Other '^') (Lit_Other '[') (yY) (Lit_Other ']') (Lit_Other '$')}
                        )
                    )
                  ]
                  negated: True
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (SimpleCommand
              words: [{(echo)} {(DQ (Aborting.))}]
              redirects: [(Redir op_id:Redir_GreatAnd fd:16777215 arg_word:{(2)} spids:[1819])]
            )
            (C {(exit)} {(1)})
          ]
          spids: [16777215 1810]
        )
      ]
      spids: [16777215 1827]
    )
    (C {(git)} {(push)} {(DQ (${ VSub_Name FORK_REMOTE))} {(-f)} 
      {(DQ (${ VSub_Name NEWBRANCHUNIQ) (':') (${ VSub_Name NEWBRANCH))}
    )
    (C {(make-a-pr)})
  ]
)