AcUtils
A high performance abstraction layer for AccuRev
List of all members
AcUtils.AcRules Class Reference

A container of AcRule objects that define the attributes of stream and workspace include and exclude rules. More...

Collaboration diagram for AcUtils.AcRules:
Collaboration graph
[legend]

Public Member Functions

Two-part object construction:
 AcRules (bool explicitOnly=false)
 A container of AcRule objects that define the attributes of stream and workspace include and exclude rules. More...
 
async Task< bool > initAsync (AcStream stream)
 Populate this container with AcRule objects for stream as per constructor parameter explicitOnly. More...
 
async Task< bool > initAsync (AcDepot depot, IProgress< int > progress=null)
 Populate this container with AcRule objects for all streams in depot as per constructor parameter explicitOnly. More...
 
async Task< bool > initAsync (StreamsCollection streamsCol, IProgress< int > progress=null)
 Populate this container with AcRule objects for all streams in streamsCol as per constructor parameter explicitOnly. More...
 
async Task< bool > initAsync (DepotsCollection depotsCol, IProgress< int > progress=null)
 Populate this container with AcRule objects for all streams in depotsCol as per constructor parameter explicitOnly. More...
 

Detailed Description

A container of AcRule objects that define the attributes of stream and workspace include and exclude rules.

AccuNote:

The lsrules -t option to display the rules set that existed as of a specified time does not work. AccuRev defect 22659.

The -l <file> option for mkrules will crash the server when the file argument contains bad XML. AccuRev defect 26252.

Definition at line 284 of file AcRules.cs.

Constructor & Destructor Documentation

AcUtils.AcRules.AcRules ( bool  explicitOnly = false)
inline

A container of AcRule objects that define the attributes of stream and workspace include and exclude rules.

Parameters
explicitOnlyfalse to include rules inherited from higher-level streams, true to include only rules that were explicitly set for the workspace or stream and not those inherited from higher level streams.
// show rules explicitly set on dynamic streams in depot name
public static async Task<bool> showRulesAsync(string name)
{
AcDepot depot = new AcDepot(name, dynamicOnly: true); // dynamic streams only
if (!(await depot.initAsync())) return false;
AcRules rules = new AcRules(explicitOnly: true); // exclude rules inherited from higher-level streams
if (!(await rules.initAsync(depot))) return false;
foreach(AcRule rule in rules.OrderBy(n => n))
Console.WriteLine(rule);
return true;
}
See also
Default comparer, ShowRules.cs

Definition at line 317 of file AcRules.cs.

Member Function Documentation

async Task<bool> AcUtils.AcRules.initAsync ( AcStream  stream)
inline

Populate this container with AcRule objects for stream as per constructor parameter explicitOnly.

Parameters
streamThe stream to query for rules.
Returns
true if no failure occurred and list was initialized successfully, false otherwise.
Exceptions
AcUtilsExceptioncaught and logged in %LOCALAPPDATA%\AcTools\Logs\<prog_name>-YYYY-MM-DD.log on lsrules command failure.
Exceptioncaught and logged in same on failure to handle a range of exceptions.
lsrules command:
lsrules -s <stream> [-d] -fx
<!-- accurev lsrules -s "PG_DEV1" -fx -->
<AcResponse
Command="lscomp"
TaskId="54394">
<element
kind="incl"
elemType="dir"
dir="yes" // Not used as its redundant. We use ElementType.Dir instead.
location="\.\Iconic"
setInStream="PG_DEV1"
xlinkToStream="IC_DEV1"
options="1"/> // Obsolete. Was used for compatibility of rules in version 4.5.3 and earlier. Will always be a value of 1.
<element
kind="incl"
elemType="dir"
dir="yes"
location="\.\"
setInStream="PlayGround"
options="1"/>
</AcResponse>

Definition at line 354 of file AcRules.cs.

Referenced by AcUtils.AcRules.initAsync().

async Task<bool> AcUtils.AcRules.initAsync ( AcDepot  depot,
IProgress< int >  progress = null 
)
inline

Populate this container with AcRule objects for all streams in depot as per constructor parameter explicitOnly.

Parameters
depotAll streams in depot to query for rules.
progressOptionally report progress back to the caller.
Returns
true if no failure occurred and list was initialized successfully, false otherwise.
Exceptions
Exceptioncaught and logged in %LOCALAPPDATA%\AcTools\Logs\<prog_name>-YYYY-MM-DD.log on failure to handle a range of exceptions.

Definition at line 403 of file AcRules.cs.

async Task<bool> AcUtils.AcRules.initAsync ( StreamsCollection  streamsCol,
IProgress< int >  progress = null 
)
inline

Populate this container with AcRule objects for all streams in streamsCol as per constructor parameter explicitOnly.

Parameters
streamsColThe list of streams to query for rules.
progressOptionally report progress back to the caller.
Returns
true if no failure occurred and list was initialized successfully, false otherwise.
Exceptions
Exceptioncaught and logged in %LOCALAPPDATA%\AcTools\Logs\<prog_name>-YYYY-MM-DD.log on failure to handle a range of exceptions.

Definition at line 444 of file AcRules.cs.

async Task<bool> AcUtils.AcRules.initAsync ( DepotsCollection  depotsCol,
IProgress< int >  progress = null 
)
inline

Populate this container with AcRule objects for all streams in depotsCol as per constructor parameter explicitOnly.

Parameters
depotsColThe list of depots to query for rules.
progressOptionally report progress back to the caller.
Returns
true if no failure occurred and list was initialized successfully, false otherwise.
Exceptions
Exceptioncaught and logged in %LOCALAPPDATA%\AcTools\Logs\<prog_name>-YYYY-MM-DD.log on failure to handle a range of exceptions.

Definition at line 499 of file AcRules.cs.