#!/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) sys.exit(0)
Removing Deprecated folder - if people want it they can look at past history!
All functions have been replaced with standard functionality such as built in LDAP,
or default change type.
Documentation added for the contents of Unsupported folder.
Changes to scripts/triggers are usually to insert tags for inclusion in ASCII Doctor docs.
This is Tom's change:
Introduced new 'Unsupported' directory to clarify that some files
in the SDP are not officially supported. These files are samples for
illustration, to provide examples, or are deprecated but not yet
ready for removal from the package.
The Maintenance and many SDP triggers have been moved under here,
along with other SDP scripts and triggers.
Added comments to p4_vars indicating that it should not be edited
directly. Added reference to an optional site_global_vars file that,
if it exists, will be sourced to provide global user settings
without needing to edit p4_vars.
As an exception to the refactoring, the totalusers.py Maintenance
script will be moved to indicate that it is supported.
Removed settings to support long-sunset P4Web from supported structure.
Structure under new .../Unsupported folder is:
Samples/bin Sample scripts.
Samples/triggers Sample trigger scripts.
Samples/triggers/tests Sample trigger script tests.
Samples/broker Sample broker filter scripts.
Deprecated/triggers Deprecated triggers.
To Do in a subsequent change: Make corresponding doc changes.
De-emphasizing changeType=restricted, including deprecating
New trigger to force change to be type restricted to avoid by-passing the
default type using p4 change -i < form_without_restricted_set