AcUtils
A high performance abstraction layer for AccuRev
Public Member Functions | List of all members
AcUtils.AcDepots Class Reference

A container of AcDepot objects that define AccuRev depots in the repository. More...

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

Public Member Functions

async Task< string > canViewAsync (AcUser user)
 Get the list of depots user has permission to view based on their principal name and group membership access control list (ACL) entries. More...
 
AcDepot getDepot (string name)
 Get the AcDepot object for depot name. More...
 
AcDepot getDepot (int ID)
 Get the AcDepot object for depot ID number. More...
 
AcDepot getDepotForStream (string name)
 Get the AcDepot object for stream name. More...
 
AcStream getStream (string name)
 Get the AcStream object for stream name. More...
 
Two-part object construction:
 AcDepots (bool dynamicOnly=false, bool includeHidden=false)
 A container of AcDepot objects that define AccuRev depots in the repository. More...
 
async Task< bool > initAsync (DepotsCollection depotsCol=null, IProgress< int > progress=null)
 Populate this container with AcDepot objects as per constructor parameters. More...
 

Detailed Description

A container of AcDepot objects that define AccuRev depots in the repository.

Definition at line 622 of file AcDepots.cs.

Constructor & Destructor Documentation

AcUtils.AcDepots.AcDepots ( bool  dynamicOnly = false,
bool  includeHidden = false 
)
inline

A container of AcDepot objects that define AccuRev depots in the repository.

Parameters
dynamicOnlytrue for dynamic streams only, false for all stream types.
includeHiddentrue to include hidden (removed) streams, otherwise do not include hidden streams.
// list all depots in the repository that are case-sensitive
AcDepots depots = new AcDepots(dynamicOnly: true); // two-part object construction
if (!(await depots.initAsync())) return false; // operation failed, check log file
foreach(AcDepot depot in depots.Where(n => n.Case == CaseSensitivity.sensitive).OrderBy(n => n)) // use default comparer
Console.WriteLine(depot);
See also
initAsync, default comparer, ListDynStreams.cs, AcDepot.listFile

Definition at line 652 of file AcDepots.cs.

Member Function Documentation

async Task<string> AcUtils.AcDepots.canViewAsync ( AcUser  user)
inline

Get the list of depots user has permission to view based on their principal name and group membership access control list (ACL) entries.

A plus sign (+) appended to the depot name denotes the Inheritable attribute.

Parameters
userUser for which to query.
Returns
The list of depots as an ordered formatted comma-delimited string, otherwise null on failure.
Precondition
Assumes user's group membership list was initialized via AcUsers includeGroupsList constructor parameter.
See also
AcPermissions

Definition at line 785 of file AcDepots.cs.

AcDepot AcUtils.AcDepots.getDepot ( string  name)
inline

Get the AcDepot object for depot name.

Parameters
nameDepot name to query.
Returns
AcDepot object for depot name, otherwise null if not found.

Definition at line 873 of file AcDepots.cs.

AcDepot AcUtils.AcDepots.getDepot ( int  ID)
inline

Get the AcDepot object for depot ID number.

Parameters
IDDepot ID number to query.
Returns
AcDepot object for depot ID number, otherwise null if not found.

Definition at line 883 of file AcDepots.cs.

AcDepot AcUtils.AcDepots.getDepotForStream ( string  name)
inline

Get the AcDepot object for stream name.

Parameters
nameStream name to query.
Returns
AcDepot object for stream name, otherwise null if not found.

Definition at line 893 of file AcDepots.cs.

AcStream AcUtils.AcDepots.getStream ( string  name)
inline

Get the AcStream object for stream name.

Parameters
nameStream name to query.
Returns
AcStream object for stream name, otherwise null if not found.

Definition at line 906 of file AcDepots.cs.

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

Populate this container with AcDepot objects as per constructor parameters.

Parameters
depotsColList of depots to create, otherwise null for all depots.
progressOptionally report progress back to the caller.
Returns
true if initialization succeeded, false otherwise.
Exceptions
AcUtilsExceptioncaught and logged in %LOCALAPPDATA%\AcTools\Logs\<prog_name>-YYYY-MM-DD.log on show command failure.
Exceptioncaught and logged in same on failure to handle a range of exceptions.
DepotsSection ds = ConfigurationManager.GetSection("Depots") as DepotsSection;
DepotsCollection _dcol = ds.Depots; // list of depots from FooApp.exe.config
...
private async Task<bool> initComboBoxDepotsAsync()
{
bool ret = false; // assume failure
try
{
toolStripStatusLabel.Text = "Initializing...";
toolStripProgressBar.Visible = true;
toolStripProgressBar.Maximum = _dcol.Count;
Progress<int> progress = new Progress<int>(i => toolStripProgressBar.Value = i);
AcDepots depots = new AcDepots(dynamicOnly: true);
if (await depots.initAsync(_dcol, progress)) // if initialization succeeds
{
foreach (AcDepot depot in depots)
toolStripComboBoxDepot.Items.Add(depot); // a ToolStripComboBox control
ret = true; // operation succeeded
}
else
{
AcDebug.Log("Failure in FooApp.initComboBoxDepotsAsync");
MessageBox.Show($"Depots list initialization failed. See log file:{Environment.NewLine}{AcDebug.getLogFile()}",
"FooApp", MessageBoxButtons.OK, MessageBoxIcon.Hand);
}
}
catch (Exception ecx)
{
AcDebug.Log($"Exception caught and logged in FooApp.initComboBoxDepotsAsync{Environment.NewLine}{ecx.Message}");
}
finally
{
toolStripStatusLabel.Text = "Ready";
toolStripProgressBar.Visible = false;
}
return ret;
}
See also
AcDepots constructor, DepotsCollection, AcGroups.initAsync
show command:
show -fx depots
AccuNote:
The XML attribute locWidth from show -fx depots is obsolete. It's an AccuRev 4.x artifact and should be removed. RPI defect 1112042, SupportLine AR3325.

Definition at line 714 of file AcDepots.cs.

Referenced by AcUtils.AcLocks.initAsync(), and AcUtils.AcRules.initAsync().