(command.CommandList
  children: [
    (C {(.)} {(./test-lib.sh)})
    (command.If
      arms: [
        (if_arm
          cond: [(C {(test)} {(-n)} {(DQ ($ Id.VSub_DollarName '$NO_SVN_TESTS'))})]
          action: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:skip_all)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (SQ 
                        (Token
                          id: Id.Lit_Chars
                          val: 'skipping git svn tests, NO_SVN_TESTS defined'
                          span_id: 20
                        )
                      )
                    }
                  spids: [18]
                )
              ]
            )
            (C {(test_done)})
          ]
          spids: [5 15]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: (command.Pipeline children:[(C {(test_have_prereq)} {(PERL)})] negated:T)
              terminator: (Token id:Id.Op_Semi val:';' span_id:35)
            )
          ]
          action: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:skip_all)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (SQ 
                        (Token
                          id: Id.Lit_Chars
                          val: 'skipping git svn tests, perl not available'
                          span_id: 42
                        )
                      )
                    }
                  spids: [40]
                )
              ]
            )
            (C {(test_done)})
          ]
          spids: [28 37]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:GIT_DIR)
          op: assign_op.Equal
          rhs: {($ Id.VSub_DollarName '$PWD') (/.git)}
          spids: [51]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:GIT_SVN_DIR)
          op: assign_op.Equal
          rhs: {($ Id.VSub_DollarName '$GIT_DIR') (/svn/refs/remotes/git-svn)}
          spids: [55]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:SVN_TREE)
          op: assign_op.Equal
          rhs: {($ Id.VSub_DollarName '$GIT_SVN_DIR') (/svn-tree)}
          spids: [59]
        )
      ]
    )
    (command.Simple
      words: [{(svn)}]
      redirects: [
        (redir.Redir
          op: (Token id:Id.Redir_Great val:'>' span_id:66)
          fd: -1
          arg_word: {(/dev/null)}
        )
        (redir.Redir op:(Token id:Id.Redir_GreatAnd val:'2>&' span_id:69) fd:2 arg_word:{(1)})
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [(C {(test)} {($ Id.VSub_QMark '$?')} {(-ne)} {(1)})]
          action: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:skip_all)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (SQ 
                        (Token
                          id: Id.Lit_Chars
                          val: 'skipping git svn tests, svn not found'
                          span_id: 87
                        )
                      )
                    }
                  spids: [85]
                )
              ]
            )
            (C {(test_done)})
          ]
          spids: [72 82]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:svnrepo)
          op: assign_op.Equal
          rhs: {($ Id.VSub_DollarName '$PWD') (/svnrepo)}
          spids: [96]
        )
      ]
    )
    (C {(export)} {(svnrepo)})
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:svnconf)
          op: assign_op.Equal
          rhs: {($ Id.VSub_DollarName '$PWD') (/svnconf)}
          spids: [104]
        )
      ]
    )
    (C {(export)} {(svnconf)})
    (command.Simple
      words: [
        {(perl)}
        {(-w)}
        {(-e)}
        {
          (DQ ('\n') ('use SVN::Core;\n') ('use SVN::Repos;\n') 
            (word_part.EscapedLiteral
              token: (Token id:Id.Lit_EscapedChar val:'\\$' span_id:123)
            ) ("SVN::Core::VERSION gt '1.1.0' or exit(42);\n") ('system(qw/svnadmin create --fs-type fsfs/, ') 
            (word_part.EscapedLiteral
              token: (Token id:Id.Lit_EscapedChar val:'\\$' span_id:126)
            ) ('ENV{svnrepo}) == 0 or exit(41);\n')
          )
        }
      ]
      redirects: [
        (redir.Redir op:(Token id:Id.Redir_GreatAnd val:'>&' span_id:130) fd:-1 arg_word:{(3)})
        (redir.Redir op:(Token id:Id.Redir_GreatAnd val:'2>&' span_id:133) fd:2 arg_word:{(4)})
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:x)
          op: assign_op.Equal
          rhs: {($ Id.VSub_QMark '$?')}
          spids: [136]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [(C {(test)} {($ Id.VSub_DollarName '$x')} {(-ne)} {(0)})]
          action: [
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: (C {(test)} {($ Id.VSub_DollarName '$x')} {(-eq)} {(42)})
                      terminator: (Token id:Id.Op_Semi val:';' span_id:161)
                    )
                  ]
                  action: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:skip_all)
                          op: assign_op.Equal
                          rhs: 
                            {
                              (SQ 
                                (Token
                                  id: Id.Lit_Chars
                                  val: 'Perl SVN libraries must be >= 1.1.0'
                                  span_id: 168
                                )
                              )
                            }
                          spids: [166]
                        )
                      ]
                    )
                  ]
                  spids: [152 163]
                )
                (if_arm
                  cond: [
                    (command.Sentence
                      child: (C {(test)} {($ Id.VSub_DollarName '$x')} {(-eq)} {(41)})
                      terminator: (Token id:Id.Op_Semi val:';' span_id:181)
                    )
                  ]
                  action: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:skip_all)
                          op: assign_op.Equal
                          rhs: 
                            {
                              (SQ 
                                (Token
                                  id: Id.Lit_Chars
                                  val: 'svnadmin failed to create fsfs repository'
                                  span_id: 188
                                )
                              )
                            }
                          spids: [186]
                        )
                      ]
                    )
                  ]
                  spids: [172 183]
                )
              ]
              else_action: [
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name name:skip_all)
                      op: assign_op.Equal
                      rhs: 
                        {
                          (SQ 
                            (Token
                              id: Id.Lit_Chars
                              val: 'Perl SVN libraries not found or unusable'
                              span_id: 197
                            )
                          )
                        }
                      spids: [195]
                    )
                  ]
                )
              ]
            )
            (C {(test_done)})
          ]
          spids: [139 149]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:rawsvnrepo)
          op: assign_op.Equal
          rhs: {(DQ ($ Id.VSub_DollarName '$svnrepo'))}
          spids: [209]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:svnrepo)
          op: assign_op.Equal
          rhs: {(DQ ('file://') ($ Id.VSub_DollarName '$svnrepo'))}
          spids: [214]
        )
      ]
    )
    (command.ShFunction
      name: poke
      body: 
        (command.BraceGroup
          children: [(C {(test-chmtime)} {(Id.Lit_Other '+') (1)} {(DQ ($ Id.VSub_Number '$1'))})]
        )
    )
    (command.ShFunction
      name: svn_cmd
      body: 
        (command.BraceGroup
          children: [
            (command.AndOr
              ops: [Id.Op_DPipe]
              children: [
                (C {(Id.Lit_LBracket '[')} {(-d)} {(DQ ($ Id.VSub_DollarName '$svnconf'))} 
                  {(Id.Lit_RBracket ']')}
                )
                (C {(mkdir)} {(DQ ($ Id.VSub_DollarName '$svnconf'))})
              ]
            )
            (command.Sentence
              child: 
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name name:orig_svncmd)
                      op: assign_op.Equal
                      rhs: {(DQ ($ Id.VSub_Number '$1'))}
                      spids: [276]
                    )
                  ]
                )
              terminator: (Token id:Id.Op_Semi val:';' span_id:280)
            )
            (C {(shift)})
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (C {(Id.Lit_LBracket '[')} {(-z)} {(DQ ($ Id.VSub_DollarName '$orig_svncmd'))} 
                          {(Id.Lit_RBracket ']')}
                        )
                      terminator: (Token id:Id.Op_Semi val:';' span_id:296)
                    )
                  ]
                  action: [
                    (C {(svn)})
                    (command.ControlFlow
                      token: (Token id:Id.ControlFlow_Return val:return span_id:304)
                    )
                  ]
                  spids: [285 298]
                )
              ]
            )
            (C {(svn)} {(DQ ($ Id.VSub_DollarName '$orig_svncmd'))} {(--config-dir)} 
              {(DQ ($ Id.VSub_DollarName '$svnconf'))} {(DQ ($ Id.VSub_At '$@'))}
            )
          ]
        )
    )
    (command.ShFunction
      name: maybe_start_httpd
      body: 
        (command.BraceGroup
          children: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:loc)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (braced_var_sub
                        token: (Token id:Id.VSub_Number val:1 span_id:339)
                        suffix_op: (suffix_op.Unary op_id:Id.VTest_Hyphen arg_word:{(svn)})
                      )
                    }
                  spids: [337]
                )
              ]
            )
            (C {(test_tristate)} {(GIT_SVN_TEST_HTTPD)})
            (command.Case
              to_match: {($ Id.VSub_DollarName '$GIT_SVN_TEST_HTTPD')}
              arms: [
                (case_arm
                  pat_list: [{(true)}]
                  action: [
                    (C {(.)} {(DQ ($ Id.VSub_DollarName '$TEST_DIRECTORY')) (/lib-httpd.sh)})
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:LIB_HTTPD_SVN)
                          op: assign_op.Equal
                          rhs: {(DQ ($ Id.VSub_DollarName '$loc'))}
                          spids: [370]
                        )
                      ]
                    )
                    (C {(start_httpd)})
                  ]
                  spids: [358 359 379 -1]
                )
                (case_arm
                  pat_list: [{(Id.Lit_Star '*')}]
                  action: [
                    (command.ShFunction
                      name: stop_httpd
                      body: (command.BraceGroup children:[(C {(Id.Lit_Other ':')} {(noop)})])
                    )
                  ]
                  spids: [382 383 402 -1]
                )
              ]
            )
          ]
        )
    )
    (command.ShFunction
      name: convert_to_rev_db
      body: 
        (command.BraceGroup
          children: [
            (command.Simple
              words: [{(perl)} {(-w)} {(--)} {(-)} {(DQ ($ Id.VSub_At '$@'))}]
              redirects: [
                (redir.HereDoc
                  op: (Token id:Id.Redir_DLess val:'<<' span_id:430)
                  fd: -1
                  here_begin: 
                    {
                      (word_part.EscapedLiteral
                        token: (Token id:Id.Lit_EscapedChar val:'\\E' span_id:431)
                      ) (OF)
                    }
                  here_end_span_id: 455
                  stdin_parts: [
                    ('use strict;\n')
                    ('@ARGV == 2 or die "usage: convert_to_rev_db <input> <output>";\n')
                    ('open my $wr, \'+>\', $ARGV[1] or die "$!: couldn\'t open: $ARGV[1]";\n')
                    ('open my $rd, \'<\', $ARGV[0] or die "$!: couldn\'t open: $ARGV[0]";\n')
                    ('my $size = (stat($rd))[7];\n')
                    ('($size % 24) == 0 or die "Inconsistent size: $size";\n')
                    ('while (sysread($rd, my $buf, 24) == 24) {\n')
                    ("\tmy ($r, $c) = unpack('NH40', $buf);\n")
                    ('\tmy $offset = $r * 41;\n')
                    ('\tseek $wr, 0, 2 or die $!;\n')
                    ('\tmy $pos = tell $wr;\n')
                    ('\tif ($pos < $offset) {\n')
                    ('\t\tfor (1 .. (($offset - $pos) / 41)) {\n')
                    ('\t\t\tprint $wr ((\'0\' x 40),"\\n") or die $!;\n')
                    ('\t\t}\n')
                    ('\t}\n')
                    ('\tseek $wr, $offset, 0 or die $!;\n')
                    ('\tprint $wr $c,"\\n" or die $!;\n')
                    ('}\n')
                    ('close $wr or die $!;\n')
                    ('close $rd or die $!;\n')
                  ]
                )
              ]
            )
          ]
        )
    )
    (command.ShFunction
      name: require_svnserve
      body: 
        (command.BraceGroup
          children: [
            (command.If
              arms: [
                (if_arm
                  cond: [(C {(test)} {(-z)} {(DQ ($ Id.VSub_DollarName '$SVNSERVE_PORT'))})]
                  action: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:skip_all)
                          op: assign_op.Equal
                          rhs: 
                            {
                              (SQ 
                                (Token
                                  id: Id.Lit_Chars
                                  val: 'skipping svnserve test. (set $SVNSERVE_PORT to enable)'
                                  span_id: 483
                                )
                              )
                            }
                          spids: [481]
                        )
                      ]
                    )
                    (C {(test_done)})
                  ]
                  spids: [467 478]
                )
              ]
            )
          ]
        )
    )
    (command.ShFunction
      name: start_svnserve
      body: 
        (command.BraceGroup
          children: [
            (command.Sentence
              child: 
                (C {(svnserve)} {(--listen-port)} {($ Id.VSub_DollarName '$SVNSERVE_PORT')} {(--root)} 
                  {(DQ ($ Id.VSub_DollarName '$rawsvnrepo'))} {(--listen-once)} {(--listen-host)} {(127.0.0.1)}
                )
              terminator: (Token id:Id.Op_Amp val:'&' span_id:527)
            )
          ]
        )
    )
    (command.ShFunction
      name: prepare_a_utf8_locale
      body: 
        (command.BraceGroup
          children: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:a_utf8_locale)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (command_sub
                        left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:541)
                        command_list: 
                          (command.CommandList
                            children: [
                              (command.Pipeline
                                children: [
                                  (C {(locale)} {(-a)})
                                  (C {(sed)} {(-n)} 
                                    {
                                      (SQ 
                                        (Token
                                          id: Id.Lit_Chars
                                          val: '/\\.[uU][tT][fF]-*8$/{\n'
                                          span_id: 553
                                        ) (Token id:Id.Lit_Chars val:'\tp\n' span_id:554) (Token id:Id.Lit_Chars val:'\tq\n' span_id:555) 
                                        (Token
                                          id: Id.Lit_Chars
                                          val: '}'
                                          span_id: 556
                                        )
                                      )
                                    }
                                  )
                                ]
                                negated: F
                              )
                            ]
                          )
                      )
                    }
                  spids: [540]
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: [(C {(test)} {(-n)} {(DQ ($ Id.VSub_DollarName '$a_utf8_locale'))})]
                  action: [(C {(test_set_prereq)} {(UTF8)})]
                  spids: [561 572]
                )
              ]
              else_action: [(C {(say)} {(DQ ('# UTF-8 locale not available, some tests are skipped'))})]
            )
          ]
        )
    )
  ]
)