I want to programmatically find out if a workspace has the latest files. I don't want to do a Workspace.Get()
, because that performs the equivalent of "Get Latest". I just want to know if my workspace needs a "Get Latest" or not.
I'm doing this check during a Build.I plan on having a method like so:
public static bool HasLatestFiles(Workspace ws)
{
bool hasChanges = false;
/* need correct code to query if ws has latest files */
return hasChanges;
}
What is the correct code to use?
Use Workspace.Get(LatestVersionSpec.Instance, GetOptions.Preview)
then check the GetStatus.NoActionNeeded
that is yielded by the Get
operation.
So:
public static bool HasLatestFiles(Workspace ws)
{
GetStatus result = ws.Get(LatestVersionSpec.Instance, GetOptions.Preview);
bool hasLatestFiles = result.NoActionNeeded;
return hasLatestFiles;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With