(command.CommandList
  children: [
    (command.ShFunction
      name: primary_type
      body: 
        (BraceGroup
          left: <Id.Lit_LBrace '{'>
          children: [
            (C {<typeset>} {<scmid>})
            (command.AndOr
              ops: [Id.Op_DAmp]
              children: [
                (C {<Id.Lit_LBracket '['>} {<-d>} {(DQ ($ Id.VSub_Number 1) <'/Codemgr_wsdata'>)} 
                  {<Id.Lit_RBracket ']'>}
                )
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'scmid='> name:scmid)
                      op: assign_op.Equal
                      rhs: {(DQ ($ Id.VSub_DollarName scmid) <' teamware'>)}
                      spids: [163]
                    )
                  ]
                  redirects: []
                )
              ]
            )
            (command.AndOr
              ops: [Id.Op_DAmp]
              children: [
                (C {<Id.Lit_LBracket '['>} {<-d>} {(DQ ($ Id.VSub_Number 1) <'/.hg'>)} 
                  {<Id.Lit_RBracket ']'>}
                )
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'scmid='> name:scmid)
                      op: assign_op.Equal
                      rhs: {(DQ ($ Id.VSub_DollarName scmid) <' mercurial'>)}
                      spids: [183]
                    )
                  ]
                  redirects: []
                )
              ]
            )
            (command.AndOr
              ops: [Id.Op_DAmp]
              children: [
                (C {<Id.Lit_LBracket '['>} {<-d>} {(DQ ($ Id.VSub_Number 1) <'/CVS'>)} 
                  {<Id.Lit_RBracket ']'>}
                )
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'scmid='> name:scmid)
                      op: assign_op.Equal
                      rhs: {(DQ ($ Id.VSub_DollarName scmid) <' cvs'>)}
                      spids: [203]
                    )
                  ]
                  redirects: []
                )
              ]
            )
            (command.AndOr
              ops: [Id.Op_DAmp]
              children: [
                (C {<Id.Lit_LBracket '['>} {<-d>} {(DQ ($ Id.VSub_Number 1) <'/.svn'>)} 
                  {<Id.Lit_RBracket ']'>}
                )
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'scmid='> name:scmid)
                      op: assign_op.Equal
                      rhs: {(DQ ($ Id.VSub_DollarName scmid) <' subversion'>)}
                      spids: [223]
                    )
                  ]
                  redirects: []
                )
              ]
            )
            (command.AndOr
              ops: [Id.Op_DAmp]
              children: [
                (C {<Id.Lit_LBracket '['>} {<-d>} {(DQ ($ Id.VSub_Number 1) <'/.git'>)} 
                  {<Id.Lit_RBracket ']'>}
                )
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'scmid='> name:scmid)
                      op: assign_op.Equal
                      rhs: {(DQ ($ Id.VSub_DollarName scmid) <' git'>)}
                      spids: [243]
                    )
                  ]
                  redirects: []
                )
              ]
            )
            (C {<echo>} {($ Id.VSub_DollarName scmid)})
          ]
          redirects: []
          right: <Id.Lit_RBrace '}'>
        )
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (command.DBracket
                      expr: 
                        (bool_expr.Unary
                          op_id: Id.BoolUnary_n
                          child: {(DQ ($ Id.VSub_DollarName CODEMGR_WS))}
                        )
                      redirects: []
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (command.If
              arms: [
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.Sentence
                          child: 
                            (command.DBracket
                              expr: 
                                (bool_expr.LogicalNot
                                  child: 
                                    (bool_expr.Unary
                                      op_id: Id.BoolUnary_d
                                      child: {(DQ ($ Id.VSub_DollarName CODEMGR_WS))}
                                    )
                                )
                              redirects: []
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                    )
                  action: [
                    (C {<print>} {<-u2>} 
                      {
                        (DQ <'which_scm: '> ($ Id.VSub_DollarName CODEMGR_WS) <' is not a directory.'>)
                      }
                    )
                    (command.ControlFlow
                      token: <Id.ControlFlow_Exit exit>
                      arg_word: {<1>}
                    )
                  ]
                  spids: [273 288]
                )
              ]
              else_action: []
              redirects: []
            )
            (C {<set>} {<-->} 
              {
                (command_sub
                  left_token: <Id.Left_DollarParen '$('>
                  child: (C {<primary_type>} {(DQ ($ Id.VSub_DollarName CODEMGR_WS))})
                  right: <Id.Eof_RParen _>
                )
              }
            )
            (command.If
              arms: [
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.Sentence
                          child: 
                            (command.DBracket
                              expr: 
                                (bool_expr.Binary
                                  op_id: Id.BoolBinary_GlobNEqual
                                  left: {($ Id.VSub_Pound '#')}
                                  right: {<1>}
                                )
                              redirects: []
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                    )
                  action: [(C {<set>} {<-->} {<unknown>})]
                  spids: [323 336]
                )
              ]
              else_action: []
              redirects: []
            )
            (C {<echo>} {(DQ ($ Id.VSub_Number 1) <' '> ($ Id.VSub_DollarName CODEMGR_WS))})
            (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<0>})
          ]
          spids: [257 270]
        )
      ]
      else_action: []
      redirects: []
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'ORIG_CWD='> name:ORIG_CWD)
          op: assign_op.Equal
          rhs: 
            {
              (command_sub
                left_token: <Id.Left_DollarParen '$('>
                child: (C {<pwd>})
                right: <Id.Eof_RParen _>
              )
            }
          spids: [365]
        )
      ]
      redirects: []
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (command.DBracket
                      expr: (bool_expr.Unary op_id:Id.BoolUnary_d child:{<RCS>})
                      redirects: []
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (C {<echo>} {(DQ <'rcs '> ($ Id.VSub_DollarName ORIG_CWD))})
            (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<0>})
          ]
          spids: [371 382]
        )
      ]
      else_action: []
      redirects: []
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'LOCAL_TYPE='> name:LOCAL_TYPE)
          op: assign_op.Equal
          rhs: (rhs_word.Empty)
          spids: [403]
        )
      ]
      redirects: []
    )
    (command.AndOr
      ops: [Id.Op_DAmp]
      children: [
        (command.DBracket
          expr: (bool_expr.Unary op_id:Id.BoolUnary_d child:{<SCCS>})
          redirects: []
        )
        (command.ShAssignment
          pairs: [
            (assign_pair
              lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'LOCAL_TYPE='> name:LOCAL_TYPE)
              op: assign_op.Equal
              rhs: {(DQ <sccs>)}
              spids: [415]
            )
          ]
          redirects: []
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'DIR='> name:DIR)
          op: assign_op.Equal
          rhs: {($ Id.VSub_DollarName ORIG_CWD)}
          spids: [424]
        )
      ]
      redirects: []
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'CWD_TYPE='> name:CWD_TYPE)
          op: assign_op.Equal
          rhs: 
            {
              (command_sub
                left_token: <Id.Left_DollarParen '$('>
                child: (C {<primary_type>} {(DQ ($ Id.VSub_DollarName DIR))})
                right: <Id.Eof_RParen _>
              )
            }
          spids: [427]
        )
      ]
      redirects: []
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'SCM_TYPE='> name:SCM_TYPE)
          op: assign_op.Equal
          rhs: (rhs_word.Empty)
          spids: [436]
        )
      ]
      redirects: []
    )
    (command.WhileUntil
      keyword: <Id.KW_While while>
      cond: 
        (condition.Shell
          commands: [
            (command.Sentence
              child: 
                (command.DBracket
                  expr: 
                    (bool_expr.Binary
                      op_id: Id.BoolBinary_GlobNEqual
                      left: {(DQ ($ Id.VSub_DollarName DIR))}
                      right: {<'/'>}
                    )
                  redirects: []
                )
              terminator: <Id.Op_Semi _>
            )
          ]
        )
      body: 
        (command.DoGroup
          children: [
            (C {<set>} {<-->} 
              {
                (command_sub
                  left_token: <Id.Left_DollarParen '$('>
                  child: (C {<primary_type>} {(DQ ($ Id.VSub_DollarName DIR))})
                  right: <Id.Eof_RParen _>
                )
              }
            )
            (command.If
              arms: [
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.Sentence
                          child: 
                            (command.DBracket
                              expr: 
                                (bool_expr.Binary
                                  op_id: Id.Op_Great
                                  left: {($ Id.VSub_Pound '#')}
                                  right: {<1>}
                                )
                              redirects: []
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                    )
                  action: [
                    (C {<echo>} {(DQ <'unknown '> ($ Id.VSub_DollarName ORIG_CWD))})
                    (command.ControlFlow
                      token: <Id.ControlFlow_Exit exit>
                      arg_word: {<0>}
                    )
                  ]
                  spids: [469 482]
                )
              ]
              else_action: []
              redirects: []
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'SCM_TYPE='> name:SCM_TYPE)
                  op: assign_op.Equal
                  rhs: {(DQ ($ Id.VSub_Number 1))}
                  spids: [501]
                )
              ]
              redirects: []
            )
            (command.If
              arms: [
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.Sentence
                          child: 
                            (command.DBracket
                              expr: 
                                (bool_expr.LogicalOr
                                  left: 
                                    (bool_expr.Binary
                                      op_id: Id.BoolBinary_GlobNEqual
                                      left: {(DQ ($ Id.VSub_DollarName SCM_TYPE))}
                                      right: {(DQ ($ Id.VSub_DollarName CWD_TYPE))}
                                    )
                                  right: 
                                    (bool_expr.LogicalOr
                                      left: 
                                        (bool_expr.Binary
                                          op_id: Id.BoolBinary_GlobDEqual
                                          left: {(DQ ($ Id.VSub_DollarName SCM_TYPE))}
                                          right: {<git>}
                                        )
                                      right: 
                                        (bool_expr.LogicalOr
                                          left: 
                                            (bool_expr.Binary
                                              op_id: Id.BoolBinary_GlobDEqual
                                              left: {(DQ ($ Id.VSub_DollarName SCM_TYPE))}
                                              right: {<mercurial>}
                                            )
                                          right: 
                                            (bool_expr.Binary
                                              op_id: Id.BoolBinary_GlobDEqual
                                              left: {(DQ ($ Id.VSub_DollarName SCM_TYPE))}
                                              right: {<teamware>}
                                            )
                                        )
                                    )
                                )
                              redirects: []
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                    )
                  action: [(command.ControlFlow token:<Id.ControlFlow_Break break>)]
                  spids: [515 564]
                )
              ]
              else_action: []
              redirects: []
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'PREVDIR='> name:PREVDIR)
                  op: assign_op.Equal
                  rhs: {(DQ ($ Id.VSub_DollarName DIR))}
                  spids: [573]
                )
              ]
              redirects: []
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'DIR='> name:DIR)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (command_sub
                        left_token: <Id.Left_DollarParen '$('>
                        child: (C {<dirname>} {(DQ ($ Id.VSub_DollarName DIR))})
                        right: <Id.Eof_RParen _>
                      )
                    }
                  spids: [579]
                )
              ]
              redirects: []
            )
          ]
        )
      redirects: []
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (command.DBracket
                      expr: 
                        (bool_expr.LogicalOr
                          left: 
                            (bool_expr.Binary
                              op_id: Id.BoolBinary_GlobDEqual
                              left: {(DQ ($ Id.VSub_DollarName CWD_TYPE))}
                              right: {<cvs>}
                            )
                          right: 
                            (bool_expr.Binary
                              op_id: Id.BoolBinary_GlobDEqual
                              left: {(DQ ($ Id.VSub_DollarName CWD_TYPE))}
                              right: {<subversion>}
                            )
                        )
                      redirects: []
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (C {<echo>} {(DQ ($ Id.VSub_DollarName CWD_TYPE) <' '> ($ Id.VSub_DollarName PREVDIR))})
            (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<0>})
          ]
          spids: [604 629]
        )
      ]
      else_action: []
      redirects: []
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (command.DBracket
                      expr: 
                        (bool_expr.Unary
                          op_id: Id.BoolUnary_z
                          child: {(DQ ($ Id.VSub_DollarName SCM_TYPE))}
                        )
                      redirects: []
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (command.If
              arms: [
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.Sentence
                          child: 
                            (command.DBracket
                              expr: 
                                (bool_expr.Unary
                                  op_id: Id.BoolUnary_z
                                  child: {(DQ ($ Id.VSub_DollarName LOCAL_TYPE))}
                                )
                              redirects: []
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                    )
                  action: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'SCM_TYPE='> name:SCM_TYPE)
                          op: assign_op.Equal
                          rhs: {<unknown>}
                          spids: [686]
                        )
                      ]
                      redirects: []
                    )
                  ]
                  spids: [670 683]
                )
              ]
              else_action: [
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'SCM_TYPE='> name:SCM_TYPE)
                      op: assign_op.Equal
                      rhs: {($ Id.VSub_DollarName LOCAL_TYPE)}
                      spids: [693]
                    )
                  ]
                  redirects: []
                )
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'DIR='> name:DIR)
                      op: assign_op.Equal
                      rhs: {($ Id.VSub_DollarName ORIG_CWD)}
                      spids: [697]
                    )
                  ]
                  redirects: []
                )
              ]
              redirects: []
            )
          ]
          spids: [654 667]
        )
      ]
      else_action: []
      redirects: []
    )
    (C {<echo>} {(DQ ($ Id.VSub_DollarName SCM_TYPE) <' '> ($ Id.VSub_DollarName DIR))})
    (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<0>})
  ]
)