Jump to content


Override Submit action

p4v custom submit

  • Please log in to reply
4 replies to this topic

#1 S1L3nCe

S1L3nCe

    Newbie

  • Members
  • Pip
  • 3 posts
  • LocationFr

Posted 12 September 2019 - 12:42 PM

Hello,

I am currently looking for a way to automatically update comment fields such as LastDate/LastAuthor in header files of a CL when submitting it.

I already tried triggers and specifically change-content ones. But this is server side and I didn't find how to update the content of the files.
So another solution could be to make my own script to submit client side. This script could update files content locally and then calling p4 submit command.

So is there a way to override p4v Submit action (Ctrl+S) to execute my script instead of the default command ?

Thanks

#2 Sambwise

Sambwise

    Advanced Member

  • Members
  • PipPipPip
  • 979 posts

Posted 13 September 2019 - 02:44 PM

Sounds like you might want to just use the +k filetype with the $Date$ and $Author$ keywords?

https://www.perforce...s.keywords.html

#3 S1L3nCe

S1L3nCe

    Newbie

  • Members
  • Pip
  • 3 posts
  • LocationFr

Posted 18 September 2019 - 07:50 PM

Thanks for your answer but if I'm right those keywords are to be used with triggers. This is server-side and does not allow to update files content.
That's why I'm looking for a way to substitute p4v Submit action with a call to a local script.

#4 Sambwise

Sambwise

    Advanced Member

  • Members
  • PipPipPip
  • 979 posts

Posted 18 September 2019 - 09:37 PM

View PostS1L3nCe, on 18 September 2019 - 07:50 PM, said:

Thanks for your answer but if I'm right those keywords are to be used with triggers.

Nope, you just give the files the +k filetype, put those magic keywords in them, and every time you submit the server atomically updates the content for you.  Exactly the thing you want to do with your trigger, except you don't need a trigger OR a client side tool if you do it this way.

#5 S1L3nCe

S1L3nCe

    Newbie

  • Members
  • Pip
  • 3 posts
  • LocationFr

Posted 03 October 2019 - 08:55 AM

Hey there,

I finally found the time to fix my problem, +k filetype is indeed the thing to use.

For those who wondering:
Use p4 typemap to set +k by default on files you want (*.cpp, *.h, etc, p4 doc give the way to do it)
It will not affect existing files so you have to do it yourself (can be done client-side with p4 edit and -t text+k option)
Then every files with +k filetype on a submitted CL will be parsed by p4 server and RCS keywords will be updated with the relevant value.

(see also https://community.pe.../s/article/3482 )

Not perfect because $keyword : value$ format in documentation isn't that aesthetic but don't really care in my case.

Thanks to Sambwise !





Also tagged with one or more of these keywords: p4v, custom submit

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users