(command.CommandList
  children: [
    (command.Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:test_description spids:[12])
          op: Equal
          rhs: {(SQ <'git p4 locked file behavior'>)}
          spids: [12]
        )
      ]
      spids: [12]
    )
    (C {(.)} {(./lib-git-p4.sh)})
    (C {(test_expect_success)} {(SQ <'start p4d'>)} {(SQ <'\n'> <'\tstart_p4d\n'>)})
    (C {(test_expect_success)} {(SQ <'init depot'>)} 
      {
        (SQ <'\n'> <'\t(\n'> <'\t\tcd "$cli" &&\n'> 
          <'\t\techo "TypeMap: +l //depot/..." | p4 typemap -i &&\n'> <'\t\techo file1 >file1 &&\n'> <'\t\tp4 add file1 &&\n'> <'\t\tp4 submit -d "add file1"\n'> <'\t)\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'edit with lock not taken'>)} 
      {
        (SQ <'\n'> <'\ttest_when_finished cleanup_git &&\n'> 
          <'\tgit p4 clone --dest="$git" //depot &&\n'> <'\t(\n'> <'\t\tcd "$git" &&\n'> <'\t\techo line2 >>file1 &&\n'> <'\t\tgit add file1 &&\n'> 
          <'\t\tgit commit -m "line2 in file1" &&\n'> <'\t\tgit config git-p4.skipSubmitEdit true &&\n'> <'\t\tgit p4 submit\n'> <'\t)\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'add with lock not taken'>)} 
      {
        (SQ <'\n'> <'\ttest_when_finished cleanup_git &&\n'> 
          <'\tgit p4 clone --dest="$git" //depot &&\n'> <'\t(\n'> <'\t\tcd "$git" &&\n'> <'\t\techo line1 >>add-lock-not-taken &&\n'> 
          <'\t\tgit add add-lock-not-taken &&\n'> <'\t\tgit commit -m "add add-lock-not-taken" &&\n'> <'\t\tgit config git-p4.skipSubmitEdit true &&\n'> 
          <'\t\tgit p4 submit --verbose\n'> <'\t)\n'>
        )
      }
    )
    (command.FuncDef
      name: lock_in_another_client
      body: 
        (command.BraceGroup
          children: [
            (command.AndOr
              ops: [Op_DAmp Op_DAmp Op_DAmp]
              children: [
                (command.Assignment
                  keyword: Assign_None
                  pairs: [
                    (assign_pair
                      lhs: (lhs_expr.LhsName name:cli2 spids:[118])
                      op: Equal
                      rhs: {(DQ ($ VSub_Name '$TRASH_DIRECTORY') (/cli2))}
                      spids: [118]
                    )
                  ]
                  spids: [118]
                )
                (C {(mkdir)} {(-p)} {(DQ ($ VSub_Name '$cli2'))})
                (C {(test_when_finished)} 
                  {
                    (DQ ('p4 client -f -d client2 && rm -rf ') 
                      (word_part.EscapedLiteralPart
                        token: <Lit_EscapedChar '\\"'>
                      ) ($ VSub_Name '$cli2') (word_part.EscapedLiteralPart token:<Lit_EscapedChar '\\"'>)
                    )
                  }
                )
                (command.Subshell
                  child: 
                    (command.AndOr
                      ops: [Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp]
                      children: [
                        (C {(cd)} {(DQ ($ VSub_Name '$cli2'))})
                        (command.Assignment
                          keyword: Assign_None
                          pairs: [
                            (assign_pair
                              lhs: (lhs_expr.LhsName name:P4CLIENT spids:[162])
                              op: Equal
                              rhs: {(client2)}
                              spids: [162]
                            )
                          ]
                          spids: [162]
                        )
                        (command.Assignment
                          keyword: Assign_None
                          pairs: [
                            (assign_pair
                              lhs: (lhs_expr.LhsName name:cli spids:[168])
                              op: Equal
                              rhs: {(DQ ($ VSub_Name '$cli2'))}
                              spids: [168]
                            )
                          ]
                          spids: [168]
                        )
                        (C {(client_view)} {(DQ ('//depot/... //client2/...'))})
                        (C {(p4)} {(sync)})
                        (C {(p4)} {(open)} {(file1)})
                      ]
                    )
                  spids: [150 199]
                )
              ]
            )
          ]
          spids: [111]
        )
      spids: [107 110]
    )
    (C {(test_expect_failure)} {(SQ <'edit with lock taken'>)} 
      {
        (SQ <'\n'> <'\tlock_in_another_client &&\n'> <'\ttest_when_finished cleanup_git &&\n'> 
          <'\ttest_when_finished "cd \\"$cli\\" && p4 sync -f file1" &&\n'> <'\tgit p4 clone --dest="$git" //depot &&\n'> <'\t(\n'> <'\t\tcd "$git" &&\n'> 
          <'\t\techo line3 >>file1 &&\n'> <'\t\tgit add file1 &&\n'> <'\t\tgit commit -m "line3 in file1" &&\n'> 
          <'\t\tgit config git-p4.skipSubmitEdit true &&\n'> <'\t\tgit p4 submit --verbose\n'> <'\t)\n'>
        )
      }
    )
    (C {(test_expect_failure)} {(SQ <'delete with lock taken'>)} 
      {
        (SQ <'\n'> <'\tlock_in_another_client &&\n'> <'\ttest_when_finished cleanup_git &&\n'> 
          <'\ttest_when_finished "cd \\"$cli\\" && p4 sync -f file1" &&\n'> <'\tgit p4 clone --dest="$git" //depot &&\n'> <'\t(\n'> <'\t\tcd "$git" &&\n'> <'\t\tgit rm file1 &&\n'> 
          <'\t\tgit commit -m "delete file1" &&\n'> <'\t\tgit config git-p4.skipSubmitEdit true &&\n'> <'\t\tgit p4 submit --verbose\n'> <'\t)\n'>
        )
      }
    )
    (C {(test_expect_failure)} {(SQ <'chmod with lock taken'>)} 
      {
        (SQ <'\n'> <'\tlock_in_another_client &&\n'> <'\ttest_when_finished cleanup_git &&\n'> 
          <'\ttest_when_finished "cd \\"$cli\\" && p4 sync -f file1" &&\n'> <'\tgit p4 clone --dest="$git" //depot &&\n'> <'\t(\n'> <'\t\tcd "$git" &&\n'> 
          <'\t\tchmod +x file1 &&\n'> <'\t\tgit add file1 &&\n'> <'\t\tgit commit -m "chmod +x file1" &&\n'> 
          <'\t\tgit config git-p4.skipSubmitEdit true &&\n'> <'\t\tgit p4 submit --verbose\n'> <'\t)\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'copy with lock taken'>)} 
      {
        (SQ <'\n'> <'\tlock_in_another_client &&\n'> <'\ttest_when_finished cleanup_git &&\n'> 
          <'\ttest_when_finished "cd \\"$cli\\" && p4 revert file2 && rm -f file2" &&\n'> <'\tgit p4 clone --dest="$git" //depot &&\n'> <'\t(\n'> <'\t\tcd "$git" &&\n'> 
          <'\t\tcp file1 file2 &&\n'> <'\t\tgit add file2 &&\n'> <'\t\tgit commit -m "cp file1 to file2" &&\n'> 
          <'\t\tgit config git-p4.skipSubmitEdit true &&\n'> <'\t\tgit config git-p4.detectCopies true &&\n'> <'\t\tgit p4 submit --verbose\n'> <'\t)\n'>
        )
      }
    )
    (C {(test_expect_failure)} {(SQ <'move with lock taken'>)} 
      {
        (SQ <'\n'> <'\tlock_in_another_client &&\n'> <'\ttest_when_finished cleanup_git &&\n'> 
          <'\ttest_when_finished "cd \\"$cli\\" && p4 sync file1 && rm -f file2" &&\n'> <'\tgit p4 clone --dest="$git" //depot &&\n'> <'\t(\n'> <'\t\tcd "$git" &&\n'> 
          <'\t\tgit mv file1 file3 &&\n'> <'\t\tgit commit -m "mv file1 to file3" &&\n'> <'\t\tgit config git-p4.skipSubmitEdit true &&\n'> 
          <'\t\tgit config git-p4.detectRenames true &&\n'> <'\t\tgit p4 submit --verbose\n'> <'\t)\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'kill p4d'>)} {(SQ <'\n'> <'\tkill_p4d\n'>)})
    (C {(test_done)})
  ]
)