Introduction
This script keeps a slave branch synchronised with a master branch based
on the contents of a branch view. This could mean a single file, or an
entire tree - it's up to you. There are two ways to limit the scope of
the script:
1. Use a limited mapping in the trigger specification
2. Use a limited mapping in the branch specification
As you can see, the methods are similar.
Requirements
Ruby
http://www.ruby-lang.org
P4Ruby
http://public.perforce.com/guest/tony_smith/perforce/API/Ruby/index.html
Rubymail
http://raa.ruby-lang.org/project/rubymail/
Trigger Specification
An suitable trigger specification might look like this:
autointeg commit //depot/master/... "t/autointeg.rb -b ms -c %changelist%"
This would cause all changes to files under //depot/master/... that are
mapped by the branch specification 'ms' (master-slave) to be propagated
immediately to the slave copy.
Required files
P4
getoptlong
net/smtp
rmail/message
Constants
ADMIN_EMAIL |
= |
"perforce@localhost" |
|
Email address of the Perforce administrator - notifications will be sent to
this user if EMAIL_REPORTS is true
|
EMAIL_REPORTS |
= |
false |
|
If true, reports of the integrations performed will be emailed to the
address above. Default: false.
|
SMTP_SERVER |
= |
"localhost" |
|
The name of your SMTP server. The script uses SMTP to send notifications by
email if EMAIL_REPORTS is true.
|
FROM_ADDRESS |
= |
"perforce@localhost" |
|
The email address messages from this script should appear to come from
|
MSG_SUBJECT |
= |
"Automatic integration report" |
|
The subject line for the messages
|
DEBUG |
= |
false |
|
Causes the text of the email that would be sent to be dumped to stderr -
which in the case of a trigger means it goes to the client.
|
P4USER |
= |
nil |
|
Perforce environment. Unless these values are explicitly specified here,
all the Perforce settings will be taken from the calling environment. This
means you can use it with P4CONFIG files, and with ‘p4 login’
tickets if you want to. If you use tickets, make sure the script user is in
a group with a really, really long ticket timeout.
|
P4PORT |
= |
nil |
P4CLIENT |
= |
nil |
P4PASSWD |
= |
nil |