[p4] Mapping between changesets

G Barthelemy gb.perforce at googlemail.com
Tue Sep 5 16:33:04 PDT 2006


On 9/5/06, David Ferguson <daf at vmware.com> wrote:
> I've got a user who wants a mapping between the changeset number that he
> manipulated for weeks, and the changeset number it became at submit time.  Is
> there any way to do this other than a post-submit trigger that keeps track in
> a table somewhere?

I don't see how you could avoid using a trigger, but there are
alternatives to using a "table somewhere" (and I guess that the
external table is what you really want to avoid ?). The alternative
would be of course to embed the existing changelist number into
metadata, somewhere. The aim is to be able to query and find the
relation between old change and new change number. What springs to
mind is jobs, as their relation with changelists is easily queried.

Some quick suggestions:

1- maybe you already enforce the association of jobs with changelists
upon submission (say because Perforce at your shop is tied to a defect
tracking system by using jobs). In this case, why not mofify the
jobspec, add a "original-changelist" field which would be filled in
automatically by a form-out trigger on submit, using p4 fixes (I
assume here that the new changelist number hasn't taken the place of
the old one at that point: that needs to be verified).

2- a variation would be to automatically produce a "pseudo" job for
each change that is created (with a form trigger), with a name like
OC-98765 (98765 being the current changelist number) and that would be
associated with the changelist itself. When your changelist gets
finaly submited and changes number, that same job (with the old
number) goes with it.

What this is crying out for is the possibility of using custom fields
in the change spec ! There is that undocumented p4 spec <type>
command: it doesn't do much yet, but maybe this is an indication that
this will be coming in a future version ?

Well then, here's another one: have a form-out trigger on submit that
would automatically fill in a comment line in the submit form ("this
was changelist 98765"), with that comment line tagged or formatted in
such a way that it is machine parsable.

-- 
Guillaume


More information about the perforce-user mailing list