static void CheckoutIfControlled(string[] paths, IPlasticAPI api) { List <string> fullPaths = new List <string>(); foreach (string path in paths) { string fullPath = Path.GetFullPath(path); string fullPathMeta = MetaPath.GetMetaPath(fullPath); if (api.GetWorkspaceTreeNode(fullPath) != null) { fullPaths.Add(fullPath); } if (api.GetWorkspaceTreeNode(fullPathMeta) != null) { fullPaths.Add(fullPathMeta); } } if (fullPaths.Count == 0) { return; } api.Checkout( fullPaths.ToArray(), CheckoutModifiers.None); }
static void CheckoutIfControlledAndChanged(string[] paths, IPlasticAPI api) { List <string> fullPaths = new List <string>(); foreach (string path in paths) { string fullPath = Path.GetFullPath(path); string fullPathMeta = MetaPath.GetMetaPath(fullPath); WorkspaceTreeNode node = api.GetWorkspaceTreeNode(fullPath); WorkspaceTreeNode nodeMeta = api.GetWorkspaceTreeNode(fullPathMeta); if (node != null && ChangedFileChecker.IsChanged( node.LocalInfo, fullPath, false)) { fullPaths.Add(fullPath); } if (nodeMeta != null && ChangedFileChecker.IsChanged( nodeMeta.LocalInfo, fullPathMeta, false)) { fullPaths.Add(fullPathMeta); } } if (fullPaths.Count == 0) { return; } api.Checkout( fullPaths.ToArray(), CheckoutModifiers.None); }