(CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: {(SQ <"git p4 submit">)} spids: [4] ) ] spids: [4] ) (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 file1 >file1 &&\n"> <"\t\tp4 add file1 &&\n"> <"\t\tp4 submit -d \"change 1\"\n"> <"\t)\n"> ) } ) (C {(test_expect_success)} {(SQ <"is_cli_file_writeable function">)} { (SQ <"\n"> <"\t(\n"> <"\t\tcd \"$cli\" &&\n"> <"\t\techo a >a &&\n"> <"\t\tis_cli_file_writeable a &&\n"> <"\t\t! is_cli_file_writeable file1 &&\n"> <"\t\trm a\n"> <"\t)\n"> ) } ) (C {(test_expect_success)} {(SQ <"submit with no client dir">)} { (SQ <"\n"> <"\ttest_when_finished cleanup_git &&\n"> <"\tgit p4 clone --dest=\"$git\" //depot &&\n"> <"\t(\n"> <"\t\tcd \"$git\" &&\n"> <"\t\techo file2 >file2 &&\n"> <"\t\tgit add file2 &&\n"> <"\t\tgit commit -m \"git commit 2\" &&\n"> <"\t\trm -rf \"$cli\" &&\n"> <"\t\tgit config git-p4.skipSubmitEdit true &&\n"> <"\t\tgit p4 submit\n"> <"\t) &&\n"> <"\t(\n"> <"\t\tcd \"$cli\" &&\n"> <"\t\ttest_path_is_file file1 &&\n"> <"\t\ttest_path_is_file file2\n"> <"\t)\n"> ) } ) (C {(test_expect_success)} {(SQ <"submit --origin">)} { (SQ <"\n"> <"\ttest_when_finished cleanup_git &&\n"> <"\tgit p4 clone --dest=\"$git\" //depot &&\n"> <"\t(\n"> <"\t\tcd \"$git\" &&\n"> <"\t\ttest_commit \"file3\" &&\n"> <"\t\ttest_commit \"file4\" &&\n"> <"\t\tgit config git-p4.skipSubmitEdit true &&\n"> <"\t\tgit p4 submit --origin=HEAD^\n"> <"\t) &&\n"> <"\t(\n"> <"\t\tcd \"$cli\" &&\n"> <"\t\ttest_path_is_missing \"file3.t\" &&\n"> <"\t\ttest_path_is_file \"file4.t\"\n"> <"\t)\n"> ) } ) (C {(test_expect_success)} {(SQ <"submit --dry-run">)} { (SQ <"\n"> <"\ttest_when_finished cleanup_git &&\n"> <"\tgit p4 clone --dest=\"$git\" //depot &&\n"> <"\t(\n"> <"\t\tcd \"$git\" &&\n"> <"\t\ttest_commit \"dry-run1\" &&\n"> <"\t\ttest_commit \"dry-run2\" &&\n"> <"\t\tgit p4 submit --dry-run >out &&\n"> <"\t\ttest_i18ngrep \"Would apply\" out\n"> <"\t) &&\n"> <"\t(\n"> <"\t\tcd \"$cli\" &&\n"> <"\t\ttest_path_is_missing \"dry-run1.t\" &&\n"> <"\t\ttest_path_is_missing \"dry-run2.t\"\n"> <"\t)\n"> ) } ) (C {(test_expect_success)} {(SQ <"submit --dry-run --export-labels">)} { (SQ <"\n"> <"\ttest_when_finished cleanup_git &&\n"> <"\tgit p4 clone --dest=\"$git\" //depot &&\n"> <"\t(\n"> <"\t\tcd \"$git\" &&\n"> <"\t\techo dry-run1 >dry-run1 &&\n"> <"\t\tgit add dry-run1 &&\n"> <"\t\tgit commit -m \"dry-run1\" dry-run1 &&\n"> <"\t\tgit config git-p4.skipSubmitEdit true &&\n"> <"\t\tgit p4 submit &&\n"> <"\t\techo dry-run2 >dry-run2 &&\n"> <"\t\tgit add dry-run2 &&\n"> <"\t\tgit commit -m \"dry-run2\" dry-run2 &&\n"> <"\t\tgit tag -m \"dry-run-tag1\" dry-run-tag1 HEAD^ &&\n"> <"\t\tgit p4 submit --dry-run --export-labels >out &&\n"> <"\t\ttest_i18ngrep \"Would create p4 label\" out\n"> <"\t) &&\n"> <"\t(\n"> <"\t\tcd \"$cli\" &&\n"> <"\t\ttest_path_is_file \"dry-run1\" &&\n"> <"\t\ttest_path_is_missing \"dry-run2\"\n"> <"\t)\n"> ) } ) (C {(test_expect_success)} {(SQ <"submit with allowSubmit">)} { (SQ <"\n"> <"\ttest_when_finished cleanup_git &&\n"> <"\tgit p4 clone --dest=\"$git\" //depot &&\n"> <"\t(\n"> <"\t\tcd \"$git\" &&\n"> <"\t\ttest_commit \"file5\" &&\n"> <"\t\tgit config git-p4.skipSubmitEdit true &&\n"> <"\t\tgit config git-p4.allowSubmit \"nobranch\" &&\n"> <"\t\ttest_must_fail git p4 submit &&\n"> <"\t\tgit config git-p4.allowSubmit \"nobranch,master\" &&\n"> <"\t\tgit p4 submit\n"> <"\t)\n"> ) } ) (C {(test_expect_success)} {(SQ <"submit with master branch name from argv">)} { (SQ <"\n"> <"\ttest_when_finished cleanup_git &&\n"> <"\tgit p4 clone --dest=\"$git\" //depot &&\n"> <"\t(\n"> <"\t\tcd \"$git\" &&\n"> <"\t\ttest_commit \"file6\" &&\n"> <"\t\tgit config git-p4.skipSubmitEdit true &&\n"> <"\t\ttest_must_fail git p4 submit nobranch &&\n"> <"\t\tgit branch otherbranch &&\n"> <"\t\tgit reset --hard HEAD^ &&\n"> <"\t\ttest_commit \"file7\" &&\n"> <"\t\tgit p4 submit otherbranch\n"> <"\t) &&\n"> <"\t(\n"> <"\t\tcd \"$cli\" &&\n"> <"\t\ttest_path_is_file \"file6.t\" &&\n"> <"\t\ttest_path_is_missing \"file7.t\"\n"> <"\t)\n"> ) } ) (C {(test_expect_success)} {(SQ <"submit modify">)} { (SQ <"\n"> <"\ttest_when_finished cleanup_git &&\n"> <"\tgit p4 clone --dest=\"$git\" //depot &&\n"> <"\t(\n"> <"\t\tcd \"$git\" &&\n"> <"\t\tgit config git-p4.skipSubmitEdit true &&\n"> <"\t\techo line >>file1 &&\n"> <"\t\tgit add file1 &&\n"> <"\t\tgit commit -m file1 &&\n"> <"\t\tgit p4 submit\n"> <"\t) &&\n"> <"\t(\n"> <"\t\tcd \"$cli\" &&\n"> <"\t\ttest_path_is_file file1 &&\n"> <"\t\ttest_line_count = 2 file1\n"> <"\t)\n"> ) } ) (C {(test_expect_success)} {(SQ <"submit add">)} { (SQ <"\n"> <"\ttest_when_finished cleanup_git &&\n"> <"\tgit p4 clone --dest=\"$git\" //depot &&\n"> <"\t(\n"> <"\t\tcd \"$git\" &&\n"> <"\t\tgit config git-p4.skipSubmitEdit true &&\n"> <"\t\techo file13 >file13 &&\n"> <"\t\tgit add file13 &&\n"> <"\t\tgit commit -m file13 &&\n"> <"\t\tgit p4 submit\n"> <"\t) &&\n"> <"\t(\n"> <"\t\tcd \"$cli\" &&\n"> <"\t\ttest_path_is_file file13\n"> <"\t)\n"> ) } ) (C {(test_expect_success)} {(SQ <"submit delete">)} { (SQ <"\n"> <"\ttest_when_finished cleanup_git &&\n"> <"\tgit p4 clone --dest=\"$git\" //depot &&\n"> <"\t(\n"> <"\t\tcd \"$git\" &&\n"> <"\t\tgit config git-p4.skipSubmitEdit true &&\n"> <"\t\tgit rm file4.t &&\n"> <"\t\tgit commit -m \"delete file4.t\" &&\n"> <"\t\tgit p4 submit\n"> <"\t) &&\n"> <"\t(\n"> <"\t\tcd \"$cli\" &&\n"> <"\t\ttest_path_is_missing file4.t\n"> <"\t)\n"> ) } ) (C {(test_expect_success)} {(SQ <"submit copy">)} { (SQ <"\n"> <"\ttest_when_finished cleanup_git &&\n"> <"\tgit p4 clone --dest=\"$git\" //depot &&\n"> <"\t(\n"> <"\t\tcd \"$git\" &&\n"> <"\t\tgit config git-p4.skipSubmitEdit true &&\n"> <"\t\tgit config git-p4.detectCopies true &&\n"> <"\t\tgit config git-p4.detectCopiesHarder true &&\n"> <"\t\tcp file5.t file5.ta &&\n"> <"\t\tgit add file5.ta &&\n"> <"\t\tgit commit -m \"copy to file5.ta\" &&\n"> <"\t\tgit p4 submit\n"> <"\t) &&\n"> <"\t(\n"> <"\t\tcd \"$cli\" &&\n"> <"\t\ttest_path_is_file file5.ta &&\n"> <"\t\t! is_cli_file_writeable file5.ta\n"> <"\t)\n"> ) } ) (C {(test_expect_success)} {(SQ <"submit rename">)} { (SQ <"\n"> <"\ttest_when_finished cleanup_git &&\n"> <"\tgit p4 clone --dest=\"$git\" //depot &&\n"> <"\t(\n"> <"\t\tcd \"$git\" &&\n"> <"\t\tgit config git-p4.skipSubmitEdit true &&\n"> <"\t\tgit config git-p4.detectRenames true &&\n"> <"\t\tgit mv file6.t file6.ta &&\n"> <"\t\tgit commit -m \"rename file6.t to file6.ta\" &&\n"> <"\t\tgit p4 submit\n"> <"\t) &&\n"> <"\t(\n"> <"\t\tcd \"$cli\" &&\n"> <"\t\ttest_path_is_missing file6.t &&\n"> <"\t\ttest_path_is_file file6.ta &&\n"> <"\t\t! is_cli_file_writeable file6.ta\n"> <"\t)\n"> ) } ) (C {(test_expect_success)} {(SQ <"simple one-line description">)} { (SQ <"\n"> <"\ttest_when_finished cleanup_git &&\n"> <"\tgit p4 clone --dest=\"$git\" //depot &&\n"> <"\t(\n"> <"\t\tcd \"$git\" &&\n"> <"\t\techo desc2 >desc2 &&\n"> <"\t\tgit add desc2 &&\n"> <"\t\tcat >msg <<-EOF &&\n"> <"\t\tOne-line description line for desc2.\n"> <"\t\tEOF\n"> <"\t\tgit commit -F - <msg &&\n"> <"\t\tgit config git-p4.skipSubmitEdit true &&\n"> <"\t\tgit p4 submit &&\n"> <"\t\tchange=$(p4 -G changes -m 1 //depot/... | \\\n"> <"\t\t\t marshal_dump change) &&\n"> <"\t\t# marshal_dump always adds a newline\n"> <"\t\tp4 -G describe $change | marshal_dump desc | sed \\$d >pmsg &&\n"> <"\t\ttest_cmp msg pmsg\n"> <"\t)\n"> ) } ) (C {(test_expect_success)} {(SQ <"description with odd formatting">)} { (SQ <"\n"> <"\ttest_when_finished cleanup_git &&\n"> <"\tgit p4 clone --dest=\"$git\" //depot &&\n"> <"\t(\n"> <"\t\tcd \"$git\" &&\n"> <"\t\techo desc3 >desc3 &&\n"> <"\t\tgit add desc3 &&\n"> <"\t\t(\n"> <"\t\t\tprintf \"subject line\\n\\n\\tExtra tab\\nline.\\n\\n\" &&\n"> <"\t\t\tprintf \"Description:\\n\\tBogus description marker\\n\\n\" &&\n"> <"\t\t\t# git commit eats trailing newlines; only use one\n"> <"\t\t\tprintf \"Files:\\n\\tBogus descs marker\\n\"\n"> <"\t\t) >msg &&\n"> <"\t\tgit commit -F - <msg &&\n"> <"\t\tgit config git-p4.skipSubmitEdit true &&\n"> <"\t\tgit p4 submit &&\n"> <"\t\tchange=$(p4 -G changes -m 1 //depot/... | \\\n"> <"\t\t\t marshal_dump change) &&\n"> <"\t\t# marshal_dump always adds a newline\n"> <"\t\tp4 -G describe $change | marshal_dump desc | sed \\$d >pmsg &&\n"> <"\t\ttest_cmp msg pmsg\n"> <"\t)\n"> ) } ) (FuncDef name: make_job body: (BraceGroup children: [ (AndOr children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:name) op: Equal rhs: {(DQ ($ VSub_Number "$1"))} spids: [444] ) ] spids: [444] ) (AndOr children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:tab) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [ (C {(printf)} {(EscapedLiteralPart token:<Lit_EscapedChar "\\\\">) (t)} ) ] ) left_token: <Left_CommandSub "$("> spids: [454 459] ) ) } spids: [452] ) ] spids: [452] ) (Pipeline children: [ (C {(p4)} {(job)} {(-o)}) (C {(sed)} {(-e)} {(DQ ("/^Job:/s/.*/Job: ") ($ VSub_Name "$name") (/))} {(-e)} {(DQ ("/^Description/{ n; s/.*/") ($ VSub_Name "$tab") (" job text/; }"))} ) (C {(p4)} {(job)} {(-i)}) ] negated: False ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] spids: [441] ) spids: [437 440] ) (C {(test_expect_success)} {(SQ <"description with Jobs section at end">)} { (SQ <"\n"> <"\ttest_when_finished cleanup_git &&\n"> <"\tgit p4 clone --dest=\"$git\" //depot &&\n"> <"\t(\n"> <"\t\tcd \"$git\" &&\n"> <"\t\techo desc4 >desc4 &&\n"> <"\t\tgit add desc4 &&\n"> <"\t\techo 6060842 >jobname &&\n"> <"\t\t(\n"> <"\t\t\tprintf \"subject line\\n\\n\\tExtra tab\\nline.\\n\\n\" &&\n"> <"\t\t\tprintf \"Files:\\n\\tBogus files marker\\n\" &&\n"> <"\t\t\tprintf \"Junk: 3164175\\n\" &&\n"> <"\t\t\tprintf \"Jobs: $(cat jobname)\\n\"\n"> <"\t\t) >msg &&\n"> <"\t\tgit commit -F - <msg &&\n"> <"\t\tgit config git-p4.skipSubmitEdit true &&\n"> <"\t\t# build a job\n"> <"\t\tmake_job $(cat jobname) &&\n"> <"\t\tgit p4 submit &&\n"> <"\t\tchange=$(p4 -G changes -m 1 //depot/... | \\\n"> <"\t\t\t marshal_dump change) &&\n"> <"\t\t# marshal_dump always adds a newline\n"> <"\t\tp4 -G describe $change | marshal_dump desc | sed \\$d >pmsg &&\n"> <"\t\t# make sure Jobs line and all following is gone\n"> <"\t\tsed \"/^Jobs:/,\\$d\" msg >jmsg &&\n"> <"\t\ttest_cmp jmsg pmsg &&\n"> <"\t\t# make sure p4 knows about job\n"> <"\t\tp4 -G describe $change | marshal_dump job0 >job0 &&\n"> <"\t\ttest_cmp jobname job0\n"> <"\t)\n"> ) } ) (C {(test_expect_success)} {(SQ <"description with Jobs and values on separate lines">)} { (SQ <"\n"> <"\ttest_when_finished cleanup_git &&\n"> <"\tgit p4 clone --dest=\"$git\" //depot &&\n"> <"\t(\n"> <"\t\tcd \"$git\" &&\n"> <"\t\techo desc5 >desc5 &&\n"> <"\t\tgit add desc5 &&\n"> <"\t\techo PROJ-6060842 >jobname1 &&\n"> <"\t\techo PROJ-6060847 >jobname2 &&\n"> <"\t\t(\n"> <"\t\t\tprintf \"subject line\\n\\n\\tExtra tab\\nline.\\n\\n\" &&\n"> <"\t\t\tprintf \"Files:\\n\\tBogus files marker\\n\" &&\n"> <"\t\t\tprintf \"Junk: 3164175\\n\" &&\n"> <"\t\t\tprintf \"Jobs:\\n\" &&\n"> <"\t\t\tprintf \"\\t$(cat jobname1)\\n\" &&\n"> <"\t\t\tprintf \"\\t$(cat jobname2)\\n\"\n"> <"\t\t) >msg &&\n"> <"\t\tgit commit -F - <msg &&\n"> <"\t\tgit config git-p4.skipSubmitEdit true &&\n"> <"\t\t# build two jobs\n"> <"\t\tmake_job $(cat jobname1) &&\n"> <"\t\tmake_job $(cat jobname2) &&\n"> <"\t\tgit p4 submit &&\n"> <"\t\tchange=$(p4 -G changes -m 1 //depot/... | \\\n"> <"\t\t\t marshal_dump change) &&\n"> <"\t\t# marshal_dump always adds a newline\n"> <"\t\tp4 -G describe $change | marshal_dump desc | sed \\$d >pmsg &&\n"> <"\t\t# make sure Jobs line and all following is gone\n"> <"\t\tsed \"/^Jobs:/,\\$d\" msg >jmsg &&\n"> <"\t\ttest_cmp jmsg pmsg &&\n"> <"\t\t# make sure p4 knows about the two jobs\n"> <"\t\tp4 -G describe $change >change &&\n"> <"\t\t(\n"> <"\t\t\tmarshal_dump job0 <change &&\n"> <"\t\t\tmarshal_dump job1 <change\n"> <"\t\t) | sort >jobs &&\n"> <"\t\tcat jobname1 jobname2 | sort >expected &&\n"> <"\t\ttest_cmp expected jobs\n"> <"\t)\n"> ) } ) (C {(test_expect_success)} {(SQ <"description with Jobs section and bogus following text">)} { (SQ <"\n"> <"\ttest_when_finished cleanup_git &&\n"> <"\tgit p4 clone --dest=\"$git\" //depot &&\n"> <"\t(\n"> <"\t\tcd \"$git\" &&\n"> <"\t\techo desc6 >desc6 &&\n"> <"\t\tgit add desc6 &&\n"> <"\t\techo 6060843 >jobname &&\n"> <"\t\t(\n"> <"\t\t\tprintf \"subject line\\n\\n\\tExtra tab\\nline.\\n\\n\" &&\n"> <"\t\t\tprintf \"Files:\\n\\tBogus files marker\\n\" &&\n"> <"\t\t\tprintf \"Junk: 3164175\\n\" &&\n"> <"\t\t\tprintf \"Jobs: $(cat jobname)\\n\" &&\n"> <"\t\t\tprintf \"MoreJunk: 3711\\n\"\n"> <"\t\t) >msg &&\n"> <"\t\tgit commit -F - <msg &&\n"> <"\t\tgit config git-p4.skipSubmitEdit true &&\n"> <"\t\t# build a job\n"> <"\t\tmake_job $(cat jobname) &&\n"> <"\t\ttest_must_fail git p4 submit 2>err &&\n"> <"\t\ttest_i18ngrep \"Unknown field name\" err\n"> <"\t) &&\n"> <"\t(\n"> <"\t\tcd \"$cli\" &&\n"> <"\t\tp4 revert desc6 &&\n"> <"\t\trm -f desc6\n"> <"\t)\n"> ) } ) (C {(test_expect_success)} {(SQ <"submit --prepare-p4-only">)} { (SQ <"\n"> <"\ttest_when_finished cleanup_git &&\n"> <"\tgit p4 clone --dest=\"$git\" //depot &&\n"> <"\t(\n"> <"\t\tcd \"$git\" &&\n"> <"\t\techo prep-only-add >prep-only-add &&\n"> <"\t\tgit add prep-only-add &&\n"> <"\t\tgit commit -m \"prep only add\" &&\n"> <"\t\tgit p4 submit --prepare-p4-only >out &&\n"> <"\t\ttest_i18ngrep \"prepared for submission\" out &&\n"> <"\t\ttest_i18ngrep \"must be deleted\" out &&\n"> <"\t\ttest_i18ngrep ! \"everything below this line is just the diff\" out\n"> <"\t) &&\n"> <"\t(\n"> <"\t\tcd \"$cli\" &&\n"> <"\t\ttest_path_is_file prep-only-add &&\n"> <"\t\tp4 fstat -T action prep-only-add | grep -w add\n"> <"\t)\n"> ) } ) (C {(test_expect_success)} {(SQ <"kill p4d">)} {(SQ <"\n"> <"\tkill_p4d\n">)}) (C {(test_done)}) ] )