(FuncDef
  name: gethgversion
  body: 
    (BraceGroup
      children: [
        (C {(make)} {(clean)})
        (AndOr
          ops: [Op_DPipe]
          children: [
            (C {(make)} {(Assign_Local local)})
            (C {(make)} {(Assign_Local local)} {(Lit_VarLike 'PURE=') (--pure)})
          ]
        )
        (Assignment
          keyword: Assign_None
          pairs: [
            (assign_pair
              lhs: (LhsName name:HG)
              op: Equal
              rhs: {(DQ ($ VSub_Name '$PWD') (/hg))}
              spids: [26]
            )
          ]
          spids: [26]
        )
        (AndOr
          ops: [Op_DPipe]
          children: [
            (SimpleCommand
              words: [{($ VSub_Name '$HG')} {(version)}]
              redirects: [(Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(/dev/null)})]
            )
            (BraceGroup
              children: [
                (Sentence
                  child: (C {(echo)} {(SQ <'abort: hg version failed!'>)})
                  terminator: <Op_Semi ';'>
                )
                (Sentence
                  child: (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)})
                  terminator: <Op_Semi ';'>
                )
              ]
              spids: [44]
            )
          ]
        )
        (Assignment
          keyword: Assign_None
          pairs: [
            (assign_pair
              lhs: (LhsName name:hgversion)
              op: Equal
              rhs: 
                {
                  (CommandSubPart
                    command_list: 
                      (CommandList
                        children: [
                          (Pipeline
                            children: [
                              (C {($ VSub_Name '$HG')} {(version)})
                              (C {(sed)} {(-ne)} {(SQ <'s/.*(version \\(.*\\))$/\\1/p'>)})
                            ]
                            negated: F
                          )
                        ]
                      )
                    left_token: <Left_Backtick '`'>
                    spids: [64 78]
                  )
                }
              spids: [63]
            )
          ]
          spids: [63]
        )
        (If
          arms: [
            (if_arm
              cond: [
                (Sentence
                  child: 
                    (Pipeline
                      children: [
                        (C {(echo)} {($ VSub_Name '$hgversion')})
                        (SimpleCommand
                          words: [{(grep)} {(--)} {(SQ <->)}]
                          redirects: [
                            (Redir
                              op: <Redir_Great '>'>
                              fd: 16777215
                              arg_word: {(/dev/null)}
                            )
                            (Redir
                              op: <Redir_GreatAnd '2>&'>
                              fd: 2
                              arg_word: {(1)}
                            )
                          ]
                        )
                      ]
                      negated: F
                    )
                  terminator: <Op_Semi ';'>
                )
              ]
              action: [
                (Assignment
                  keyword: Assign_None
                  pairs: [
                    (assign_pair
                      lhs: (LhsName name:version)
                      op: Equal
                      rhs: 
                        {
                          (CommandSubPart
                            command_list: 
                              (CommandList
                                children: [
                                  (Pipeline
                                    children: [
                                      (C {(echo)} {($ VSub_Name '$hgversion')})
                                      (C {(cut)} {(-d-)} {(-f1)})
                                    ]
                                    negated: F
                                  )
                                ]
                              )
                            left_token: <Left_Backtick '`'>
                            spids: [114 126]
                          )
                        }
                      spids: [113]
                    )
                  ]
                  spids: [113]
                )
                (Assignment
                  keyword: Assign_None
                  pairs: [
                    (assign_pair
                      lhs: (LhsName name:release)
                      op: Equal
                      rhs: 
                        {
                          (CommandSubPart
                            command_list: 
                              (CommandList
                                children: [
                                  (Pipeline
                                    children: [
                                      (C {(echo)} {($ VSub_Name '$hgversion')})
                                      (C {(cut)} {(-d-)} {(-f2)})
                                      (C {(sed)} {(-e)} {(SQ <'s/+.*//'>)})
                                    ]
                                    negated: F
                                  )
                                ]
                              )
                            left_token: <Left_Backtick '`'>
                            spids: [130 152]
                          )
                        }
                      spids: [129]
                    )
                  ]
                  spids: [129]
                )
              ]
              spids: [16777215 106]
            )
          ]
          else_action: [
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:version)
                  op: Equal
                  rhs: 
                    {
                      (CommandSubPart
                        command_list: 
                          (CommandList
                            children: [
                              (Pipeline
                                children: [
                                  (C {(echo)} {($ VSub_Name '$hgversion')})
                                  (C {(sed)} {(-e)} {(SQ <'s/+.*//'>)})
                                ]
                                negated: F
                              )
                            ]
                          )
                        left_token: <Left_Backtick '`'>
                        spids: [163 177]
                      )
                    }
                  spids: [162]
                )
              ]
              spids: [162]
            )
            (Assignment
              keyword: Assign_None
              pairs: [(assign_pair lhs:(LhsName name:release) op:Equal rhs:{(SQ <0>)} spids:[180])]
              spids: [180]
            )
          ]
          spids: [155 186]
        )
      ]
      spids: [4]
    )
  spids: [0 3]
)