(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:test_description) op: assign_op.Equal rhs: {(SQ (Token id:Id.Lit_Chars val:'git p4 rename' span_id:6))} spids: [4] ) ] ) (C {(.)} {(./lib-git-p4.sh)}) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'start p4d' span_id:18))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:22) (Token id:Id.Lit_Chars val:'\tstart_p4d\n' span_id:23) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'p4 help unknown returns 1' span_id:33))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:37) (Token id:Id.Lit_Chars val:'\t(\n' span_id:38) (Token id:Id.Lit_Chars val:'\t\tcd "$cli" &&\n' span_id:39) (Token id:Id.Lit_Chars val:'\t\t(\n' span_id:40) (Token id:Id.Lit_Chars val:'\t\t\tp4 help client >errs 2>&1\n' span_id:41) (Token id:Id.Lit_Chars val:'\t\t\techo $? >retval\n' span_id:42) (Token id:Id.Lit_Chars val:'\t\t)\n' span_id:43) (Token id:Id.Lit_Chars val:'\t\techo 0 >expected &&\n' span_id:44) (Token id:Id.Lit_Chars val:'\t\ttest_cmp expected retval &&\n' span_id:45) (Token id:Id.Lit_Chars val:'\t\trm retval &&\n' span_id:46) (Token id:Id.Lit_Chars val:'\t\t(\n' span_id:47) (Token id:Id.Lit_Chars val:'\t\t\tp4 help nosuchcommand >errs 2>&1\n' span_id:48) (Token id:Id.Lit_Chars val:'\t\t\techo $? >retval\n' span_id:49) (Token id:Id.Lit_Chars val:'\t\t)\n' span_id:50) (Token id:Id.Lit_Chars val:'\t\techo 1 >expected &&\n' span_id:51) (Token id:Id.Lit_Chars val:'\t\ttest_cmp expected retval &&\n' span_id:52) (Token id:Id.Lit_Chars val:'\t\trm retval\n' span_id:53) (Token id:Id.Lit_Chars val:'\t)\n' span_id:54) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'create files' span_id:61))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:65) (Token id:Id.Lit_Chars val:'\t(\n' span_id:66) (Token id:Id.Lit_Chars val:'\t\tcd "$cli" &&\n' span_id:67) (Token id: Id.Lit_Chars val: '\t\tp4 client -o | sed "/LineEnd/s/:.*/:unix/" | p4 client -i &&\n' span_id: 68 ) (Token id:Id.Lit_Chars val:'\t\tcat >file1 <<-EOF &&\n' span_id:69) (Token id:Id.Lit_Chars val:'\t\tA large block of text\n' span_id:70) (Token id:Id.Lit_Chars val:'\t\tin file1 that will generate\n' span_id:71) (Token id:Id.Lit_Chars val:'\t\tenough context so that rename\n' span_id:72) (Token id:Id.Lit_Chars val:'\t\tand copy detection will find\n' span_id:73) (Token id:Id.Lit_Chars val:'\t\tsomething interesting to do.\n' span_id:74) (Token id:Id.Lit_Chars val:'\t\tEOF\n' span_id:75) (Token id:Id.Lit_Chars val:'\t\tcat >file2 <<-EOF &&\n' span_id:76) (Token id:Id.Lit_Chars val:'\t\t/*\n' span_id:77) (Token id:Id.Lit_Chars val:'\t\t * This blob looks a bit\n' span_id:78) (Token id:Id.Lit_Chars val:'\t\t * different.\n' span_id:79) (Token id:Id.Lit_Chars val:'\t\t */\n' span_id:80) (Token id:Id.Lit_Chars val:'\t\tint main(int argc, char **argv)\n' span_id:81) (Token id:Id.Lit_Chars val:'\t\t{\n' span_id:82) (Token id:Id.Lit_Chars val:'\t\t\tchar text[200];\n' span_id:83) (Token id:Id.Lit_Chars val:'\n' span_id:84) (Token id:Id.Lit_Chars val:'\t\t\tstrcpy(text, "copy/rename this");\n' span_id:85) (Token id:Id.Lit_Chars val:'\t\t\tprintf("text is %s\\n", text);\n' span_id:86) (Token id:Id.Lit_Chars val:'\t\t\treturn 0;\n' span_id:87) (Token id:Id.Lit_Chars val:'\t\t}\n' span_id:88) (Token id:Id.Lit_Chars val:'\t\tEOF\n' span_id:89) (Token id:Id.Lit_Chars val:'\t\tp4 add file1 file2 &&\n' span_id:90) (Token id:Id.Lit_Chars val:'\t\tp4 submit -d "add files"\n' span_id:91) (Token id:Id.Lit_Chars val:'\t)\n' span_id:92) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'detect renames' span_id:120))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:124) (Token id: Id.Lit_Chars val: '\tgit p4 clone --dest="$git" //depot@all &&\n' span_id: 125 ) (Token id:Id.Lit_Chars val:'\ttest_when_finished cleanup_git &&\n' span_id:126) (Token id:Id.Lit_Chars val:'\t(\n' span_id:127) (Token id:Id.Lit_Chars val:'\t\tcd "$git" &&\n' span_id:128) (Token id: Id.Lit_Chars val: '\t\tgit config git-p4.skipSubmitEdit true &&\n' span_id: 129 ) (Token id:Id.Lit_Chars val:'\n' span_id:130) (Token id:Id.Lit_Chars val:'\t\tgit mv file1 file4 &&\n' span_id:131) (Token id:Id.Lit_Chars val:'\t\tgit commit -a -m "Rename file1 to file4" &&\n' span_id:132) (Token id:Id.Lit_Chars val:'\t\tgit diff-tree -r -M HEAD &&\n' span_id:133) (Token id:Id.Lit_Chars val:'\t\tgit p4 submit &&\n' span_id:134) (Token id: Id.Lit_Chars val: '\t\tp4 filelog //depot/file4 >filelog &&\n' span_id: 135 ) (Token id:Id.Lit_Chars val:'\t\t! grep " from //depot" filelog &&\n' span_id:136) (Token id:Id.Lit_Chars val:'\n' span_id:137) (Token id:Id.Lit_Chars val:'\t\tgit mv file4 file5 &&\n' span_id:138) (Token id: Id.Lit_Chars val: '\t\tgit commit -a -m "Rename file4 to file5" &&\n' span_id: 139 ) (Token id:Id.Lit_Chars val:'\t\tgit diff-tree -r -M HEAD &&\n' span_id:140) (Token id: Id.Lit_Chars val: '\t\tgit config git-p4.detectRenames true &&\n' span_id: 141 ) (Token id:Id.Lit_Chars val:'\t\tgit p4 submit &&\n' span_id:142) (Token id: Id.Lit_Chars val: '\t\tp4 filelog //depot/file5 >filelog &&\n' span_id: 143 ) (Token id:Id.Lit_Chars val:'\t\tgrep " from //depot/file4" filelog &&\n' span_id:144) (Token id:Id.Lit_Chars val:'\n' span_id:145) (Token id:Id.Lit_Chars val:'\t\tgit mv file5 file6 &&\n' span_id:146) (Token id:Id.Lit_Chars val:'\t\techo update >>file6 &&\n' span_id:147) (Token id:Id.Lit_Chars val:'\t\tgit add file6 &&\n' span_id:148) (Token id: Id.Lit_Chars val: '\t\tgit commit -a -m "Rename file5 to file6 with changes" &&\n' span_id: 149 ) (Token id:Id.Lit_Chars val:'\t\tgit diff-tree -r -M HEAD &&\n' span_id:150) (Token id: Id.Lit_Chars val: '\t\tlevel=$(git diff-tree -r -M HEAD | sed 1d | cut -f1 | cut -d" " -f5 | sed "s/R0*//") &&\n' span_id: 151 ) (Token id: Id.Lit_Chars val: '\t\ttest -n "$level" && test "$level" -gt 0 && test "$level" -lt 98 &&\n' span_id: 152 ) (Token id:Id.Lit_Chars val:'\t\tgit config git-p4.detectRenames $(($level + 2)) &&\n' span_id:153) (Token id:Id.Lit_Chars val:'\t\tgit p4 submit &&\n' span_id:154) (Token id:Id.Lit_Chars val:'\t\tp4 filelog //depot/file6 >filelog &&\n' span_id:155) (Token id:Id.Lit_Chars val:'\t\t! grep " from //depot" filelog &&\n' span_id:156) (Token id:Id.Lit_Chars val:'\n' span_id:157) (Token id:Id.Lit_Chars val:'\t\tgit mv file6 file7 &&\n' span_id:158) (Token id:Id.Lit_Chars val:'\t\techo update >>file7 &&\n' span_id:159) (Token id:Id.Lit_Chars val:'\t\tgit add file7 &&\n' span_id:160) (Token id: Id.Lit_Chars val: '\t\tgit commit -a -m "Rename file6 to file7 with changes" &&\n' span_id: 161 ) (Token id:Id.Lit_Chars val:'\t\tgit diff-tree -r -M HEAD &&\n' span_id:162) (Token id: Id.Lit_Chars val: '\t\tlevel=$(git diff-tree -r -M HEAD | sed 1d | cut -f1 | cut -d" " -f5 | sed "s/R0*//") &&\n' span_id: 163 ) (Token id: Id.Lit_Chars val: '\t\ttest -n "$level" && test "$level" -gt 2 && test "$level" -lt 100 &&\n' span_id: 164 ) (Token id:Id.Lit_Chars val:'\t\tgit config git-p4.detectRenames $(($level - 2)) &&\n' span_id:165) (Token id:Id.Lit_Chars val:'\t\tgit p4 submit &&\n' span_id:166) (Token id:Id.Lit_Chars val:'\t\tp4 filelog //depot/file7 >filelog &&\n' span_id:167) (Token id: Id.Lit_Chars val: '\t\tgrep " from //depot/file6" filelog\n' span_id: 168 ) (Token id:Id.Lit_Chars val:'\t)\n' span_id:169) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'detect copies' span_id:209))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:213) (Token id: Id.Lit_Chars val: '\tgit p4 clone --dest="$git" //depot@all &&\n' span_id: 214 ) (Token id:Id.Lit_Chars val:'\ttest_when_finished cleanup_git &&\n' span_id:215) (Token id:Id.Lit_Chars val:'\t(\n' span_id:216) (Token id:Id.Lit_Chars val:'\t\tcd "$git" &&\n' span_id:217) (Token id: Id.Lit_Chars val: '\t\tgit config git-p4.skipSubmitEdit true &&\n' span_id: 218 ) (Token id:Id.Lit_Chars val:'\n' span_id:219) (Token id:Id.Lit_Chars val:'\t\techo "file8" >>file2 &&\n' span_id:220) (Token id:Id.Lit_Chars val:'\t\tgit commit -a -m "Differentiate file2" &&\n' span_id:221) (Token id:Id.Lit_Chars val:'\t\tgit p4 submit &&\n' span_id:222) (Token id:Id.Lit_Chars val:'\t\tcp file2 file8 &&\n' span_id:223) (Token id:Id.Lit_Chars val:'\t\tgit add file8 &&\n' span_id:224) (Token id:Id.Lit_Chars val:'\t\tgit commit -a -m "Copy file2 to file8" &&\n' span_id:225) (Token id:Id.Lit_Chars val:'\t\tgit diff-tree -r -C HEAD &&\n' span_id:226) (Token id:Id.Lit_Chars val:'\t\tgit p4 submit &&\n' span_id:227) (Token id:Id.Lit_Chars val:'\t\tp4 filelog //depot/file8 &&\n' span_id:228) (Token id: Id.Lit_Chars val: '\t\tp4 filelog //depot/file8 | test_must_fail grep -q "branch from" &&\n' span_id: 229 ) (Token id:Id.Lit_Chars val:'\n' span_id:230) (Token id:Id.Lit_Chars val:'\t\techo "file9" >>file2 &&\n' span_id:231) (Token id:Id.Lit_Chars val:'\t\tgit commit -a -m "Differentiate file2" &&\n' span_id:232) (Token id:Id.Lit_Chars val:'\t\tgit p4 submit &&\n' span_id:233) (Token id:Id.Lit_Chars val:'\n' span_id:234) (Token id:Id.Lit_Chars val:'\t\tcp file2 file9 &&\n' span_id:235) (Token id:Id.Lit_Chars val:'\t\tgit add file9 &&\n' span_id:236) (Token id: Id.Lit_Chars val: '\t\tgit commit -a -m "Copy file2 to file9" &&\n' span_id: 237 ) (Token id:Id.Lit_Chars val:'\t\tgit diff-tree -r -C HEAD &&\n' span_id:238) (Token id: Id.Lit_Chars val: '\t\tgit config git-p4.detectCopies true &&\n' span_id: 239 ) (Token id:Id.Lit_Chars val:'\t\tgit p4 submit &&\n' span_id:240) (Token id:Id.Lit_Chars val:'\t\tp4 filelog //depot/file9 &&\n' span_id:241) (Token id: Id.Lit_Chars val: '\t\tp4 filelog //depot/file9 | test_must_fail grep -q "branch from" &&\n' span_id: 242 ) (Token id:Id.Lit_Chars val:'\n' span_id:243) (Token id:Id.Lit_Chars val:'\t\techo "file10" >>file2 &&\n' span_id:244) (Token id:Id.Lit_Chars val:'\t\tgit commit -a -m "Differentiate file2" &&\n' span_id:245) (Token id:Id.Lit_Chars val:'\t\tgit p4 submit &&\n' span_id:246) (Token id:Id.Lit_Chars val:'\n' span_id:247) (Token id:Id.Lit_Chars val:'\t\techo "file2" >>file2 &&\n' span_id:248) (Token id:Id.Lit_Chars val:'\t\tcp file2 file10 &&\n' span_id:249) (Token id:Id.Lit_Chars val:'\t\tgit add file2 file10 &&\n' span_id:250) (Token id:Id.Lit_Chars val:'\t\tgit commit -a -m "Modify and copy file2 to file10" &&\n' span_id:251) (Token id:Id.Lit_Chars val:'\t\tgit diff-tree -r -C HEAD &&\n' span_id:252) (Token id: Id.Lit_Chars val: '\t\tsrc=$(git diff-tree -r -C HEAD | sed 1d | sed 2d | cut -f2) &&\n' span_id: 253 ) (Token id:Id.Lit_Chars val:'\t\ttest "$src" = file2 &&\n' span_id:254) (Token id:Id.Lit_Chars val:'\t\tgit p4 submit &&\n' span_id:255) (Token id:Id.Lit_Chars val:'\t\tp4 filelog //depot/file10 &&\n' span_id:256) (Token id: Id.Lit_Chars val: '\t\tp4 filelog //depot/file10 | grep -q "branch from //depot/file2" &&\n' span_id: 257 ) (Token id:Id.Lit_Chars val:'\n' span_id:258) (Token id:Id.Lit_Chars val:'\t\techo "file11" >>file2 &&\n' span_id:259) (Token id:Id.Lit_Chars val:'\t\tgit commit -a -m "Differentiate file2" &&\n' span_id:260) (Token id:Id.Lit_Chars val:'\t\tgit p4 submit &&\n' span_id:261) (Token id:Id.Lit_Chars val:'\n' span_id:262) (Token id:Id.Lit_Chars val:'\t\tcp file2 file11 &&\n' span_id:263) (Token id:Id.Lit_Chars val:'\t\tgit add file11 &&\n' span_id:264) (Token id: Id.Lit_Chars val: '\t\tgit commit -a -m "Copy file2 to file11" &&\n' span_id: 265 ) (Token id:Id.Lit_Chars val:'\t\tgit diff-tree -r -C --find-copies-harder HEAD &&\n' span_id:266) (Token id: Id.Lit_Chars val: '\t\tsrc=$(git diff-tree -r -C --find-copies-harder HEAD | sed 1d | cut -f2) &&\n' span_id: 267 ) (Token id:Id.Lit_Chars val:'\t\ttest "$src" = file2 &&\n' span_id:268) (Token id: Id.Lit_Chars val: '\t\tgit config git-p4.detectCopiesHarder true &&\n' span_id: 269 ) (Token id:Id.Lit_Chars val:'\t\tgit p4 submit &&\n' span_id:270) (Token id:Id.Lit_Chars val:'\t\tp4 filelog //depot/file11 &&\n' span_id:271) (Token id: Id.Lit_Chars val: '\t\tp4 filelog //depot/file11 | grep -q "branch from //depot/file2" &&\n' span_id: 272 ) (Token id:Id.Lit_Chars val:'\n' span_id:273) (Token id:Id.Lit_Chars val:'\t\techo "file12" >>file2 &&\n' span_id:274) (Token id:Id.Lit_Chars val:'\t\tgit commit -a -m "Differentiate file2" &&\n' span_id:275) (Token id:Id.Lit_Chars val:'\t\tgit p4 submit &&\n' span_id:276) (Token id:Id.Lit_Chars val:'\n' span_id:277) (Token id:Id.Lit_Chars val:'\t\tcp file2 file12 &&\n' span_id:278) (Token id:Id.Lit_Chars val:'\t\techo "some text" >>file12 &&\n' span_id:279) (Token id:Id.Lit_Chars val:'\t\tgit add file12 &&\n' span_id:280) (Token id: Id.Lit_Chars val: '\t\tgit commit -a -m "Copy file2 to file12 with changes" &&\n' span_id: 281 ) (Token id:Id.Lit_Chars val:'\t\tgit diff-tree -r -C --find-copies-harder HEAD &&\n' span_id:282) (Token id: Id.Lit_Chars val: '\t\tlevel=$(git diff-tree -r -C --find-copies-harder HEAD | sed 1d | cut -f1 | cut -d" " -f5 | sed "s/C0*//") &&\n' span_id: 283 ) (Token id: Id.Lit_Chars val: '\t\ttest -n "$level" && test "$level" -gt 0 && test "$level" -lt 98 &&\n' span_id: 284 ) (Token id: Id.Lit_Chars val: '\t\tsrc=$(git diff-tree -r -C --find-copies-harder HEAD | sed 1d | cut -f2) &&\n' span_id: 285 ) (Token id:Id.Lit_Chars val:'\t\ttest "$src" = file2 &&\n' span_id:286) (Token id: Id.Lit_Chars val: '\t\tgit config git-p4.detectCopies $(($level + 2)) &&\n' span_id: 287 ) (Token id:Id.Lit_Chars val:'\t\tgit p4 submit &&\n' span_id:288) (Token id:Id.Lit_Chars val:'\t\tp4 filelog //depot/file12 &&\n' span_id:289) (Token id: Id.Lit_Chars val: '\t\tp4 filelog //depot/file12 | test_must_fail grep -q "branch from" &&\n' span_id: 290 ) (Token id:Id.Lit_Chars val:'\n' span_id:291) (Token id:Id.Lit_Chars val:'\t\techo "file13" >>file2 &&\n' span_id:292) (Token id:Id.Lit_Chars val:'\t\tgit commit -a -m "Differentiate file2" &&\n' span_id:293) (Token id:Id.Lit_Chars val:'\t\tgit p4 submit &&\n' span_id:294) (Token id:Id.Lit_Chars val:'\n' span_id:295) (Token id:Id.Lit_Chars val:'\t\tcp file2 file13 &&\n' span_id:296) (Token id:Id.Lit_Chars val:'\t\techo "different text" >>file13 &&\n' span_id:297) (Token id:Id.Lit_Chars val:'\t\tgit add file13 &&\n' span_id:298) (Token id: Id.Lit_Chars val: '\t\tgit commit -a -m "Copy file2 to file13 with changes" &&\n' span_id: 299 ) (Token id:Id.Lit_Chars val:'\t\tgit diff-tree -r -C --find-copies-harder HEAD &&\n' span_id:300) (Token id: Id.Lit_Chars val: '\t\tlevel=$(git diff-tree -r -C --find-copies-harder HEAD | sed 1d | cut -f1 | cut -d" " -f5 | sed "s/C0*//") &&\n' span_id: 301 ) (Token id: Id.Lit_Chars val: '\t\ttest -n "$level" && test "$level" -gt 2 && test "$level" -lt 100 &&\n' span_id: 302 ) (Token id: Id.Lit_Chars val: '\t\tsrc=$(git diff-tree -r -C --find-copies-harder HEAD | sed 1d | cut -f2) &&\n' span_id: 303 ) (Token id:Id.Lit_Chars val:'\t\ttest "$src" = file2 &&\n' span_id:304) (Token id: Id.Lit_Chars val: '\t\tgit config git-p4.detectCopies $(($level - 2)) &&\n' span_id: 305 ) (Token id:Id.Lit_Chars val:'\t\tgit p4 submit &&\n' span_id:306) (Token id:Id.Lit_Chars val:'\t\tp4 filelog //depot/file13 &&\n' span_id:307) (Token id: Id.Lit_Chars val: '\t\tp4 filelog //depot/file13 | grep -q "branch from //depot/file2"\n' span_id: 308 ) (Token id:Id.Lit_Chars val:'\t)\n' span_id:309) ) } ) (C {(test_lazy_prereq)} {(P4D_HAVE_CONFIGURABLE_RUN_MOVE_ALLOW)} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:324) (Token id: Id.Lit_Chars val: '\tp4 configure show run.move.allow >out &&\n' span_id: 325 ) (Token id:Id.Lit_Chars val:'\tegrep ^run.move.allow: out\n' span_id:326) ) } ) (C {(test_expect_success)} {(P4D_HAVE_CONFIGURABLE_RUN_MOVE_ALLOW)} { (SQ (Token id: Id.Lit_Chars val: 'do not use p4 move when administratively disabled' span_id: 340 ) ) } { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:344) (Token id: Id.Lit_Chars val: '\ttest_when_finished "p4 configure set run.move.allow=1" &&\n' span_id: 345 ) (Token id:Id.Lit_Chars val:'\tp4 configure set run.move.allow=0 &&\n' span_id:346) (Token id:Id.Lit_Chars val:'\t(\n' span_id:347) (Token id:Id.Lit_Chars val:'\t\tcd "$cli" &&\n' span_id:348) (Token id: Id.Lit_Chars val: '\t\techo move-disallow-file >move-disallow-file &&\n' span_id: 349 ) (Token id:Id.Lit_Chars val:'\t\tp4 add move-disallow-file &&\n' span_id:350) (Token id: Id.Lit_Chars val: '\t\tp4 submit -d "add move-disallow-file"\n' span_id: 351 ) (Token id:Id.Lit_Chars val:'\t) &&\n' span_id:352) (Token id:Id.Lit_Chars val:'\ttest_when_finished cleanup_git &&\n' span_id:353) (Token id:Id.Lit_Chars val:'\tgit p4 clone --dest="$git" //depot &&\n' span_id:354) (Token id:Id.Lit_Chars val:'\t(\n' span_id:355) (Token id:Id.Lit_Chars val:'\t\tcd "$git" &&\n' span_id:356) (Token id: Id.Lit_Chars val: '\t\tgit config git-p4.skipSubmitEdit true &&\n' span_id: 357 ) (Token id:Id.Lit_Chars val:'\t\tgit config git-p4.detectRenames true &&\n' span_id:358) (Token id: Id.Lit_Chars val: '\t\tgit mv move-disallow-file move-disallow-file-moved &&\n' span_id: 359 ) (Token id:Id.Lit_Chars val:'\t\tgit commit -m "move move-disallow-file" &&\n' span_id:360) (Token id:Id.Lit_Chars val:'\t\tgit p4 submit\n' span_id:361) (Token id:Id.Lit_Chars val:'\t)\n' span_id:362) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'kill p4d' span_id:369))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:373) (Token id:Id.Lit_Chars val:'\tkill_p4d\n' span_id:374) ) } ) (C {(test_done)}) ] )