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);
     }
 }
Esempio n. 2
0
        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;
 }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
        public void Update()
        {
            if (runner != null)
            {
                return;
            }

            temp         = new StatusNode(".", VCItemStatus.Unknown);
            updatingPath = RootPath;
            dirty        = null;
            Run("status -v", updatingPath);
        }
Esempio n. 6
0
 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);
     }
 }
Esempio n. 7
0
        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);
            }
        }
Esempio n. 9
0
        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);
        }
Esempio n. 10
0
        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);
            }
        }
Esempio n. 11
0
        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);
        }
Esempio n. 13
0
        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);
        }
Esempio n. 14
0
        /// <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);
        }
Esempio n. 15
0
        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;
        }
Esempio n. 16
0
        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);
        }