private void GetChildren(StatusNode node, List<StatusNode> result) { if (node.Children == null) return; foreach (StatusNode child in node.Children.Values) { result.Add(child); GetChildren(child, result); } }
public void Update() { if (runner != null) return; temp = new StatusNode(".", VCItemStatus.Unknown); updatingPath = RootPath; dirty = null; Run("status -v", updatingPath); }
private string GetNodePath(StatusNode child, string rootPath) { char S = Path.DirectorySeparatorChar; string path = ""; while (child != null && child.Name != ".") { path = S + child.Name + path; child = child.Parent; } return rootPath + S + path; }
override protected void Runner_ProcessEnded(object sender, int exitCode) { runner = null; if (exitCode != 0) { String label = TextHelper.GetString("SourceControl.Label.UnableToGetRepoStatus"); TraceManager.AddAsync(label + " (" + exitCode + ")"); } if (updatingPath == RootPath) root = temp; if (OnResult != null) OnResult(this); }
public void Update() { if (runner != null) { return; } temp = new StatusNode(".", VCItemStatus.Unknown); updatingPath = RootPath; dirty = null; Run("status -v", updatingPath); }
private void GetChildren(StatusNode node, List <StatusNode> result) { if (node.Children == null) { return; } foreach (StatusNode child in node.Children.Values) { result.Add(child); GetChildren(child, result); } }
private string GetNodePath(StatusNode child, string rootPath) { char S = Path.DirectorySeparatorChar; string path = ""; while (child != null && child.Name != ".") { path = S + child.Name + path; child = child.Parent; } return(rootPath + S + path); }
public VCItemStatus GetOverlay(string path, string rootPath) { StatusNode snode = FindNode(path, rootPath); if (snode != null) { return(snode.Status); } else { return(VCItemStatus.Unknown); } }
public void Update() { if (runner != null) return; temp = new StatusNode(".", VCItemStatus.Unknown); updatingPath = RootPath; if (dirty != null) { /*if (File.Exists(dirty)) dirty = Path.GetDirectoryName(dirty); StatusNode dirtyNode = root.FindPath(dirty); if (dirtyNode != null) updatingPath = dirty;*/ dirty = null; } Run("status -v", updatingPath); }
override protected void Runner_ProcessEnded(object sender, int exitCode) { runner = null; if (exitCode != 0) { String label = TextHelper.GetString("SourceControl.Label.UnableToGetRepoStatus"); TraceManager.AddAsync(label + " (" + exitCode + ")"); } if (updatingPath == RootPath) { root = temp; } if (OnResult != null) { OnResult(this); } }
private StatusNode AddChild(string name, VCItemStatus status, bool isLeaf) { if (name == ".") { if (status != VCItemStatus.Unknown) { Status = status; } return(this); } // inherit child status if (Status < status && status > VCItemStatus.UpToDate) { Status = status == VCItemStatus.Conflicted ? status : VCItemStatus.Modified; } // add/retrieve child if (!isLeaf && status > VCItemStatus.UpToDate && status != VCItemStatus.Conflicted) { status = VCItemStatus.Modified; } StatusNode node = new StatusNode(name, status); node.Parent = this; if (!HasChildren) { HasChildren = true; Children = new Dictionary <string, StatusNode>(); Children.Add(name, node); } else if (Children.ContainsKey(name)) { return(Children[name]); } else { Children.Add(name, node); } return(node); }
public List <VCStatusReport> GetAllOverlays(string path, string rootPath) { StatusNode root = FindNode(path, rootPath); if (root == null) { return(null); } List <StatusNode> children = new List <StatusNode>(); GetChildren(root, children); List <VCStatusReport> result = new List <VCStatusReport>(); foreach (StatusNode child in children) { result.Add(new VCStatusReport(GetNodePath(child, rootPath), child.Status)); } return(result); }
public void Update() { if (runner != null) { return; } temp = new StatusNode(".", VCItemStatus.Unknown); updatingPath = RootPath; if (dirty != null) { /*if (File.Exists(dirty)) dirty = Path.GetDirectoryName(dirty); * StatusNode dirtyNode = root.FindPath(dirty); * if (dirtyNode != null) * updatingPath = dirty;*/ dirty = null; } Run("status -v", updatingPath); }
/// <summary> /// Recursively find a path in the tree /// </summary> /// <returns>Last node of the path</returns> public StatusNode FindPath(string path) { if (path == ".") { return(this); } int p = path.IndexOf(Path.DirectorySeparatorChar); string childName = p < 0 ? path : path.Substring(0, p); if (HasChildren && Children.ContainsKey(childName)) { StatusNode child = Children[childName]; if (p > 0) { return(child.FindPath(path.Substring(p + 1))); } else { return(child); } } return(null); }
private StatusNode AddChild(string name, VCItemStatus status, bool isLeaf) { if (name == ".") { if (status != VCItemStatus.Unknown) Status = status; return this; } // inherit child status if (Status < status && status > VCItemStatus.UpToDate) Status = status == VCItemStatus.Conflicted ? status : VCItemStatus.Modified; // add/retrieve child if (!isLeaf && status > VCItemStatus.UpToDate && status != VCItemStatus.Conflicted) status = VCItemStatus.Modified; StatusNode node = new StatusNode(name, status); node.Parent = this; if (!HasChildren) { HasChildren = true; Children = new Dictionary<string, StatusNode>(); Children.Add(name, node); } else if (Children.ContainsKey(name)) { return Children[name]; } else Children.Add(name, node); return node; }
protected override void runner_ProcessEnded(object sender, int exitCode) { runner = null; if (exitCode != 0) { String label = TextHelper.GetString("SourceControl.Label.UnableToGetRepoStatus"); TraceManager.AddAsync(label + " (" + exitCode + ")"); } if (updatingPath == RootPath) root = temp; /*else { StatusNode updateNode = root.FindPath(Path.GetDirectoryName(updatingPath)); if (updateNode != null) { if (updateNode.Parent == null) root = temp; else { string name = Path.GetFileName(updatingPath); if (updateNode.Children.ContainsKey(name)) updateNode.Children.Remove(name); updateNode.Children.Add(name, temp); } } }*/ if (OnResult != null) OnResult(this); }