[p4] Change-content trigger help

Jeff A. Bowles jab at pobox.com
Thu Mar 13 11:47:58 PDT 2008


It is worth reminding you that even if you get "p4 describe" or "p4 diff2"
to give you the behavior you want, files that are added/deleted won't print
out in the 'diffs'.
I'd bark up the "p4 print -q" tree, myself.

Only, I'd do it this way:
    (1)  Don't loop through the file list, calling Perforce. It's messy, in
terms of performance.
    (2)  Instead, perhaps do the 'print -q' using the '@=change' trick.
    (3)  ... but use something like P4Ruby to parse the blame thing.  You
might have to piece together blocks of the files as they come in, but that's
not awful.

It should be, in all, perhaps 2-3 calls to Perforce for the entire trigger.
(Be stingy with 'em.)

   -Jeff Bowles

On Thu, Mar 13, 2008 at 3:37 AM, Rui Casais <ruic at funcom.com> wrote:

> Hi
>
> I'm trying to use a change-content trigger to refuse commits if the
> changed files have calls to a specific function. Looping over the file
> list using "p4 print -q file@=change" to do pattern matching on the full
> content of each file works, but seems like a large unnecessary overhead.
>
> Ideally I'd like to use "p4 describe change", but that doesn't seem to
> work. The documentation for change-content triggers suggests using
> diff2 on each submitted file, but I can't get it to work:
>
> "p4 diff2 file@=change2 file@=change1" complains that I can't use a
> revision range with diff2.
>
> "p4 diff2 file#rev2 file#rev1", "p4 diff2 file at cange2 file at change1" and
> other variations mixing revision and change list numbers show the files
> as identical.
>
> What am I doing wrong?
>
> Rui
>
>
> _______________________________________________
> perforce-user mailing list  -  perforce-user at perforce.com
> http://maillist.perforce.com/mailman/listinfo/perforce-user
>
>


-- 
---
Jeff Bowles - jeff.a.bowles at gmail.com



More information about the perforce-user mailing list