Show all workspaces whose names do not match their corresponding stream name. Aids in troubleshooting a scenario that exists where chws
can complete without its corresponding chstream
completing successfully. The fix is to run accurev chws -s <workspace name from the output> <stream name from the output>
. Run the program again to confirm. If still found, run the chws
command again with the new output; occasionally it must be run twice. Ignore any messages or warnings that appear. AccuRev defects 22175 and 27372.
namespace StreamWkspaceMismatch
{
class Program
{
static int Main()
{
Task<bool> init = streamWkspaceMismatchAsync();
return (init.Result) ? 0 : 1;
}
public static async Task<bool> streamWkspaceMismatchAsync()
{
bool ret = false;
try
{
AcDepots depots = new AcDepots(dynamicOnly: false, includeHidden: true);
if (!(await depots.initAsync())) return false;
AcWorkspaces wkspaces = new AcWorkspaces(depots, allWSpaces: true, includeHidden: true);
if (!(await wkspaces.initAsync())) return false;
foreach (AcDepot
depot in depots.OrderBy(n => n))
{
var query =
from AcStream s in depot.Streams
join AcWorkspace w in wkspaces on s.Depot equals w.Depot
where w.ID == s.ID && !string.Equals(s.Name, w.Name)
orderby w.Name
select new
{
Hidden = w.Hidden,
WorkspaceName = w.Name,
StreamName = s.Name
};
foreach (var f in query)
Console.WriteLine($"{(f.Hidden ? "Hidden" : "Visible")} wspace: {f.WorkspaceName}, stream: {f.StreamName}");
}
ret = true;
}
catch (Exception ecx)
{
Console.WriteLine($"Exception caught and logged in Program.streamWkspaceMismatchAsync{Environment.NewLine}{ecx.Message}");
}
return ret;
}
}
}