using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Perforce.P4 { /// /// Defines triggers on Perforce events. /// public class TriggerTable : List { public TriggerTable ( Trigger entry, FormSpec spec ) { Entry = entry; Spec = spec; } public Trigger Entry {get; set;} public FormSpec Spec {get; set;} } /// /// Describes an individual entry in the trigger table. /// public class Trigger { public Trigger ( string name, int order, TriggerType type, string path, string command ) { Name = name; Order = order; Type = type; Path = path; Command= command; } public string Name { get; set; } public int Order { get; set; } public TriggerType Type { get; set; } public string Path { get; set; } public string Command { get; set; } } /// /// Defines whent he trigger is to execute. /// [Flags] public enum TriggerType { /// /// archive: /// Execute an archive trigger for the server to access /// any file with the +X filetype modifier. /// Archive = 0x0000, /// /// service-check: /// Execute an authentication check trigger to verify a /// user's password against an external password manager /// during login or when setting a new password. /// AuthServiceCheck = 0x0001, /// /// auth-check-sso: /// Facilitate a single sign-on user authentication. This /// configuration requires two programs or scripts to run; /// one on the client, the other on the server. /// AuthCheckSSO = 0x0002, /// /// auth-set: /// Execute an authentication set trigger to send a new /// password to an external password manager. /// AuthSet = 0x0004, /// /// change-submit: /// Execute pre-submit trigger after changelist has been /// created and files locked but prior to file transfer. /// ChangeSubmit = 0x0008, /// /// change-content: /// Execute mid-submit trigger after file transfer but prior /// to commit. Files can be accessed by the 'p4 diff2', /// 'p4 files', 'p4 fstat', and 'p4 print' commands using /// the revision specification '@=change', where 'change' is /// the pending changelist number passed as %changelist%. /// ChangeContent = 0x0010, /// /// change-commit: /// Execute post-submit trigger after changelist commit. /// ChangeCommit = 0x0020, /// /// fix-add: /// Execute fix trigger prior to adding a fix. The special /// variable %jobs% is available for expansion and must be /// the last argument to the trigger as it expands to one /// argument for each job listed on the 'p4 fix' command. /// FixAdd = 0x0040, /// /// fix-delete: /// Execute fix trigger prior to deleting a fix. The special /// variable %jobs% is available for expansion and must be /// the last argument to the trigger as it expands to one /// argument for each job listed on the 'p4 fix -d' command. /// FixDelete = 0x0080, /// /// form-out: /// Execute form trigger on generation of form. Trigger may /// modify form. /// FormOut = 0x0100, /// /// form-in: /// Execute form trigger on input of form before its contents /// are parsed and validated. Trigger may modify form. /// FormIn = 0x0200, /// /// form-save: /// Execute form trigger prior to save of form after its /// contents are parsed. /// FormSave = 0x0400, /// /// form-commit: /// Execute form trigger after it has been committed, allowing /// access to automatically generated fields (jobname, dates /// etc). It cannot modify the form. This trigger for job /// forms is run by 'p4 job' and 'p4 fix' (after the status /// is updated), 'p4 change' (if the job is added or deleted) /// and 'p4 submit' (if the job is associated with the change). /// The 'form-commit' trigger has access to the new job name /// created with 'p4 job', while the 'form-in' and 'form-save' /// triggers are run before the job name is created. The /// special variable %action% is available on the job /// 'form-commit' trigger command line, and is expanded when /// the job is modified by a fix. /// FormCommit = 0x0800, /// /// form-delete: /// Execute form trigger prior to delete of form after its /// contents are parsed. /// FormDelete = 0x1000, /// /// shelve-submit: /// Execute pre-shelve trigger after changelist has been /// created but prior to file transfer. /// ShelveSubmit = 0x2000, /// /// shelve-commit: /// Execute post-shelve trigger after files are shelved. /// ShelveCommit = 0x4000, /// /// shelve-delete: /// Execute shelve trigger prior to discarding shelved files. /// ShelveDelete = 0x8000 } }