Perforce: How to find the source change list number

In perforce, change lists are numbered when submitted. So, for example, when a change list was created, it will be numbered 777, but when presenting a change list, it will be reassigned to say 790.

My question is: how to get a new CL number (790) if I know the old CL number 777 or vice versa?

+3
source share
5 answers

If you really need an original change list, you can get it from Perforce without having to insert the original change list in the description. You can use the -ztag command line option to get it. And you can only get it through the "changes" command (as far as I know):

d:\sandbox>p4 submit -c 24510
Submitting change 24510.
Locking 1 files ...
edit //depot/testfile.txt#2
Change 24510 renamed change 24512 and submitted.

d:\sandbox>p4 -ztag changes -m1 //depot/testfile.txt
... change 24512
... time 1294249178
... user test.user
... client client-test.user
... status submitted
... oldChange 24510
... desc <enter description here>
<saved

As indicated, perhaps this is not so useful. However, I would like to note that this is possible.

+4
source

The only way I can think of is to add the original change list as part of the change list description field. First you need a script to save the original list of changes:

#!/bin/env perl
$id = $ARGV[0];
open (CHANGE_IN, "p4 change -o $id|");
open (CHANGE_OUT, "|p4 change -i $id");
while (<CHANGE_IN>)
{
    if (/^Description:/ and not /ORIGID/)
    {
        s/(^Description:)(.*)$/$1 ORIGID $id. $2/;
    }
    print CHANGE_OUT $_;
}
close (CHANGE_IN);
close (CHANGE_OUT);

Save this as origid.pl on the Perforce server with the executable bit set. Then set the trigger with p4 triggers.

Triggers:
    add_origid change-submit //depot/... /usr/bin/origid.pl %change%
+5

2012.1 Perforce -O (capital oh) p4 , ( , p4 submit).

, , , , , .

, 12300, , , :

p4 describe -s -O 12300

Perforce :

Change 12345 by me@myhost on 2013/10/31 00:00:00

    Fix that thing I wrote that note about

Affected files ...

    ... //Proj/MAIN/foo.c

ztag, , :

> p4 -ztag describe -s 12345 | grep oldChange
... oldChange 12300
+3

Eric Miller , ( ):

1

p4 -ztag describe $ORIG | sed -e 's/^\.\.\. oldChange //;t-ok;d;:-ok'

.

OLD=$(p4 -ztag describe $ORIG | sed -e 's/^\.\.\. oldChange //;t-ok;d;:-ok')

, new old ( "join" ). , .

p4 -ztag describe 782546 782547 ... | sed -e '${x;p};s/^\.\.\. change //;t-keep;b-next;:-keep;x;/./p;g;G;s/\n/ /;x;d;:-next;s/^\.\.\. oldChange //;t-ok;d;:-ok;H;x;s/ .*\n/ /;x;d;'

GNU sed.

+1

- , .

, . , (777), , , , 778.

0

Source: https://habr.com/ru/post/1781573/


All Articles