use P4::test; use P4::TM { DATA_DIR => 'self', EXTRA_TESTS => 2 }; use File::Copy::Recursive 'dircopy'; P4::TM::add_mask_func sub { s,/objects/[a-f0-9]{2}/[a-f0-9]{38},/objects/SH/AMASK,gi; s/[a-f0-9]{40}/SHAMASK/gi; # s/\d{10}/TSMASK/g; s/manuals\/v[0-9]{2}\.[0-9]{1}\/extensions/manuals\/vYY.H\/extensions/g; $_ }; # Shows the jobs owned by a user and their status, along with the changelists `p4 configure set server.extensions.allow.unsigned=1`; `p4 user -o sampleExtensionsUser | p4 user -i -f`; `p4 user -o alice | p4 user -i -f`; `p4 user -o bob | p4 user -i -f`; dircopy $script_abspath =~ s/\.t$//r . '/*', 'JobInfoExt'; tm `p4 extension --package JobInfoExt`; tm `p4 extension --install JobInfoExt.p4-extension -y`; `p4 extension --configure ExampleInc::JobInfoExt -o | p4 extension --configure ExampleInc::JobInfoExt -i`; `p4 extension --configure ExampleInc::JobInfoExt --name jobinfo -o | p4 extension --configure ExampleInc::JobInfoExt --name jobinfo -i`; # setup list of jobs, changes and fixes # job1 - bob - fixed # job2 - bob - open - change # job3 - bob - open - no change # job4 - alice - fixed # job5 - alice - open - change my $bobjob1; my $bobjob2; my $bobjob3; my $bobjob4; my $alicejob5; my $alicejob6; # Create the jobs ( $stdin = `p4 -ubob job -o` ) =~ s,^Description:.*,Description: this is bob job 1,gm; ( $_, $bobjob1 )= split ' ', `p4 -ubob job -i`; ( $stdin = `p4 -ubob job -o` ) =~ s,^Description:.*,Description: this is bob job 2,gm; ( $_, $bobjob2 )= split ' ', `p4 -ubob job -i`; ( $stdin = `p4 -ubob job -o` ) =~ s,^Description:.*,Description: this is bob job 3,gm; ( $_, $bobjob3 )= split ' ', `p4 -ubob job -i`; ( $stdin = `p4 -ubob job -o` ) =~ s,^Description:.*,Description: this is bob job 4,gm; ( $_, $bobjob4 )= split ' ', `p4 -ubob job -i`; ( $stdin = `p4 -ualice job -o` ) =~ s,^Description:.*,Description: this is alice job 5,gm; ( $_, $alicejob5 )= split ' ', `p4 -ualice job -i`; ( $stdin = `p4 -ualice job -o` ) =~ s,^Description:.*,Description: this is alice job 6,gm; ( $_, $alicejob6 )= split ' ', `p4 -ualice job -i`; my $cbob = newClient( $server, P4CLIENT=>'cbob', P4USER=>'bob' ); mkdir $cbob->GetRoot; chdir $cbob->GetRoot; `$cbob client -o | $cbob client -i`; write_file "file1.c", "First line of file1.c\n"; write_file "file2.c", "First line of file2.c\n"; write_file "file3.c", "First line of file3.c\n"; `$cbob add file*.c`; # job1 assigned to change and submitted by bob my $chg1; ( $stdin = `$cbob change -o` ) =~ s/<enter.*>/Bob's change for job1/gm; $stdin .= "Jobs:\n $bobjob1\n"; ( $_, $chg1 )= split ' ', `$cbob change -i`; tm `$cbob submit -c $chg1`; # job6 assigned to change and submitted by alice my $chg2; my $calice = newClient( $server, P4CLIENT=>'calice', P4USER=>'alice' ); mkdir $calice->GetRoot; chdir $calice->GetRoot; `$calice client -o | $calice client -i`; my $msg = `$calice sync`; like $msg, qr/added as/; tm `$calice edit file1.c`; append_file "file1.c", "more of file1.c for job6\n"; ( $stdin = `$calice change -o` ) =~ s/<enter.*>/Alice's change for job6/gm; $stdin .= "Jobs:\n $alicejob6\n"; ( $_, $chg2 )= split ' ', `$calice change -i`; tm `$calice submit -c $chg2`; # job2 assigned to change and shelved chdir $cbob->GetRoot; my $chg3; $msg = `$cbob sync`; like $msg, qr/updating/; tm `$cbob edit file1.c`; append_file "file1.c", "more of file1.c for job2\n"; ( $stdin = `$cbob change -o` ) =~ s/<enter.*>/Bob's change for job2/gm; $stdin .= "Jobs:\n $bobjob2\n"; ( $_, $chg3 )= split ' ', `$cbob change -i`; tm `$cbob shelve -c $chg3`; # job3 assigned to a change only my $chg4; tm `$cbob edit file2.c`; append_file "file2.c", "more of file2.c for job3\n"; ( $stdin = `$cbob change -o` ) =~ s/<enter.*>/Bob's change for job3/gm; $stdin .= "Jobs:\n $bobjob3\n"; ( $_, $chg4 )= split ' ', `$cbob change -i`; # job4 will not be assigned to a change # job5 - for alice assigned to a change and shelved chdir $calice->GetRoot; my $chg6; tm `$calice sync`; tm `$calice edit file3.c`; append_file "file3.c", "more of file3.c for job6\n"; ( $stdin = `$calice change -o` ) =~ s/<enter.*>/Alice's change for job6/gm; $stdin .= "Jobs:\n $alicejob5\n"; ( $_, $chg6 )= split ' ', `$calice change -i`; tm `$calice shelve -c $chg6`; tm `p4 jobs`; tm `p4 fixes`; tm `p4 -ubob extension --run jobinfo joblist`; tm `p4 -ualice extension --run jobinfo joblist`; tm `p4 extension --run jobinfo joblist`; __DATA__ [[21,22,68,78,83,90,95,99,110,111,116,118,119,121,123,125], [ 'p4 extension --package JobInfoExt', 'Extension packaged successfully. ', 0, 'p4 extension --install JobInfoExt.p4-extension -y', ' Extension \'ExampleInc::JobInfoExt\' version \'1.0\' installed successfully. Perform the following steps to turn on the Extension: # Create a global configuration if one doesn\'t already exist. p4 extension --configure ExampleInc::JobInfoExt # Create an instance configuration to enable the Extension. p4 extension --configure ExampleInc::JobInfoExt --name ExampleInc::JobInfoExt-instanceName For more information, visit: https://www.perforce.com/manuals/vYY.H/extensions/Content/Extensions/Home-extensions.html ', 0, 'submit -c ', ' Submitting change 3. Locking 3 files ... add //depot/file1.c#1 add //depot/file2.c#1 add //depot/file3.c#1 Change 3 submitted. ', 0, 'edit file1.c', '//depot/file1.c#1 - opened for edit ', 0, 'submit -c ', ' Submitting change 4. Locking 1 files ... edit //depot/file1.c#2 Change 4 submitted. ', 0, 'edit file1.c', '//depot/file1.c#2 - opened for edit ', 0, 'shelve -c ', ' Shelving files for change 5. edit //depot/file1.c#2 Change 5 files shelved. ', 0, 'edit file2.c', '//depot/file2.c#1 - opened for edit ', 0, 'sync', 'File(s) up-to-date. ', 0, 'edit file3.c', '//depot/file3.c#1 - opened for edit ', 0, 'shelve -c ', ' Shelving files for change 7. edit //depot/file3.c#1 Change 7 files shelved. ', 0, 'p4 jobs', ' job000001 on */*/* by bob *closed* \'this is bob job 1 <enter descri\' job000002 on */*/* by bob *open* \'this is bob job 2 <enter descri\' job000003 on */*/* by bob *open* \'this is bob job 3 <enter descri\' job000004 on */*/* by bob *open* \'this is bob job 4 <enter descri\' job000005 on */*/* by alice *open* \'this is alice job 5 <enter desc\' job000006 on */*/* by alice *closed* \'this is alice job 6 <enter desc\' ', 0, 'p4 fixes', ' job000001 fixed by change 3 on */*/* by bob@cbob (closed) job000002 fixed by change 5 on */*/* by bob@cbob (closed) job000003 fixed by change 6 on */*/* by bob@cbob (closed) job000005 fixed by change 7 on */*/* by alice@calice (closed) job000006 fixed by change 4 on */*/* by alice@calice (closed) ', 0, 'p4 -ubob extension --run jobinfo joblist', ' Job job000001, Status: closed, associated with change 3 Job job000002, Status: open, associated with change 5 Job job000003, Status: open, associated with change 6 Job job000004, Status: open, not associated to a change number ', 0, 'p4 -ualice extension --run jobinfo joblist', ' Job job000005, Status: open, associated with change 7 Job job000006, Status: closed, associated with change 4 ', 0, 'p4 extension --run jobinfo joblist', 'No jobs with user user ', 0 ] ]
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 30809 | C. Thomas Tyler |
Code drop with newer versions of Extensions. Thanks to @jason_gibon. #review-30810 @jabson_gibson |