#!/usr/bin/env python
#==============================================================================
# Copyright and license info is available in the LICENSE file included with
# the Server Deployment Package (SDP), and also available online:
# https://swarm.workshop.perforce.com/projects/perforce-software-sdp/view/main/LICENSE
#------------------------------------------------------------------------------
"""
Usage:
setchange form-in change "/p4/common/bin/triggers/SetChangeRestricted.py %formfile%"
This script is designed to run as a form-in trigger. It will add Type: restricted to the
change form if it isn't already there.
"""
from __future__ import print_function
import re
import sys
def set_changetype(formfile):
with open(formfile) as f:
content = f.read()
if(not re.search("Type:\trestricted", content)):
content = content + "\nType:\trestricted\n"
with open(formfile, "w") as f:
f.write(content)
if __name__ == "__main__":
if len(sys.argv) < 2:
print("Usage: SetLabelOptions.py <formfile>")
sys.exit(0)
set_changetype(sys.argv[1])
sys.exit(0)
| # | Change | User | Description | Committed | |
|---|---|---|---|---|---|
| #2 | 20726 | Robert Cowham | Catch up from dev | ||
| #1 | 18586 | Robert Cowham | Branching using cowhamr.sdp.dev | ||
| //guest/perforce_software/sdp/dev/Server/Unix/p4/common/bin/triggers/SetChangeRestricted.py | |||||
| #1 | 18449 | Russell C. Jackson (Rusty) |
New trigger to force change to be type restricted to avoid by-passing the default type using p4 change -i < form_without_restricted_set #review-18296 |
||