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;
 }
示例#3
0
        public void Update()
        {
            if (runner != null) return;

            temp = new StatusNode(".", VCItemStatus.Undefined);
            updatingPath = RootPath;
            if (dirty != null) dirty = null;
            ignores.Update();

            Run("status -A", updatingPath);
        }
示例#4
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);
        }
示例#5
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);
     }
 }
示例#6
0
        public VCItemStatus GetOverlay(string path, string rootPath)
        {
            StatusNode snode = FindNode(path, rootPath);

            if (snode != null)
            {
                return(snode.Status);
            }
            else
            {
                return(VCItemStatus.Unknown);
            }
        }
示例#7
0
        public void Update()
        {
            if (runner != null)
            {
                return;
            }

            temp         = new StatusNode(".", VCItemStatus.Undefined);
            updatingPath = RootPath;
            dirty        = null;
            ignores.Update();

            Run("status -A", updatingPath);
        }
示例#8
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)
            {
                if (status > VCItemStatus.UpToDate && status != VCItemStatus.Conflicted)
                {
                    status = VCItemStatus.Modified;
                }
                else
                {
                    status = VCItemStatus.UpToDate;
                }
            }

            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);
        }
示例#9
0
 public StatusNode Get(string path)
 {
     StatusNode found = root.FindPath(path);
     if (found == null)
     {
         foreach (IgnoreEntry ignore in ignores)
         {
             if ((ignore.path == "" || path.StartsWith(ignore.path)) && ignore.regex.IsMatch(path))
             {
                 found = root.MapPath(path.Substring(ignore.path.Length), VCItemStatus.Ignored);
                 return found;
             }
         }
         found = new StatusNode(Path.GetFileName(path), VCItemStatus.Unknown);
     }
     return found;
 }
示例#10
0
        public void Update()
        {
            if (runner != null) return;

            temp = new StatusNode(".", VCItemStatus.Undefined);
            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 -A", updatingPath);
        }
示例#11
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);
            }
        }
示例#12
0
        public StatusNode Get(string path)
        {
            StatusNode found = root.FindPath(path);

            if (found == null)
            {
                foreach (IgnoreEntry ignore in ignores)
                {
                    if ((ignore.path == "" || path.StartsWith(ignore.path)) && ignore.regex.IsMatch(path))
                    {
                        found = root.MapPath(path.Substring(ignore.path.Length), VCItemStatus.Ignored);
                        return(found);
                    }
                }
                found = new StatusNode(Path.GetFileName(path), VCItemStatus.Unknown);
            }
            return(found);
        }
示例#13
0
        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);
        }
示例#14
0
        public void Update()
        {
            if (runner != null)
            {
                return;
            }

            temp         = new StatusNode(".", VCItemStatus.Undefined);
            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 -A", updatingPath);
        }
示例#15
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);
        }
示例#16
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)
            {
                if (status > VCItemStatus.UpToDate && status != VCItemStatus.Conflicted)
                    status = VCItemStatus.Modified;
                else status = VCItemStatus.UpToDate;
            }

            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;
        }
示例#17
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);
        }