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

The list of Element objects from the stat command. More...

Static Public Member Functions

static void clear ()
 Remove all elements from the (static) element's list. More...
 
static bool init (string xml)
 Populate this list with elements from the XML emitted by the stat command. More...
 
static Element getElement (XElement version)
 Get the stat command's Element object from this list that corresponds to the version element in a transaction from the hist command. More...
 

Properties

static List< ElementElements [get, private set]
 The list of Element objects. More...
 

Detailed Description

The list of Element objects from the stat command.

try {
AcResult result = await AcCommand.runAsync(@"stat -foix -B -d -s ""NEPTUNE_DEV2_barnyrd""");
if (result == null || result.RetVal != 0) return false; // error occurred, check log file
if (Stat.init(result.CmdResult)) // populate list using XML from the stat command
foreach (Element elem in Stat.Elements.OrderBy(n => n.Location).ThenByDescending(n => n.ModTime))
Console.WriteLine(elem.ToString("LV"));
}
catch (AcUtilsException ecx)
{
Console.WriteLine($"AcUtilsException caught in Program.show{Environment.NewLine}{ecx.Message}");
}
catch (Exception ecx)
{
Console.WriteLine($"Exception caught in Program.show{Environment.NewLine}{ecx.Message}");
}

Definition at line 447 of file Stat.cs.

Member Function Documentation

static void AcUtils.Stat.clear ( )
inlinestatic

Remove all elements from the (static) element's list.

Definition at line 466 of file Stat.cs.

static Element AcUtils.Stat.getElement ( XElement  version)
inlinestatic

Get the stat command's Element object from this list that corresponds to the version element in a transaction from the hist command.

Parameters
versionThe version element to query.
<version path="\.\foo.java" eid="65" virtual="11/8" real="19/5" virtualNamedVersion="MARS_DEV2/8" realNamedVersion="MARS_DEV2_barnyrd/5" elem_type="text" dir="no" />
Returns
The Element object that corresponds to the version element if found, otherwise null.

The Element object and version element relate when all of the following conditions are true:

  • Their element ID's match.
  • Their respective virtual and real stream/version numbers match.
  • The Element.NamedVersion stream name matches the version's virtualNamedVersion or realNamedVersion stream name.
See also
LatestPromotions.cs, LatestOverlaps.cs

Definition at line 553 of file Stat.cs.

static bool AcUtils.Stat.init ( string  xml)
inlinestatic

Populate this list with elements from the XML emitted by the stat command.

Parameters
xmlXML from the AccuRev stat command.
Returns
true if parsing was successful, 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 479 of file Stat.cs.

Property Documentation

List<Element> AcUtils.Stat.Elements
staticgetprivate set

The list of Element objects.

Definition at line 458 of file Stat.cs.