예제 #1
0
        /// <summary>
        /// Scans the Project Item for deleted files and removes their local
        /// copies from the local image of the project. Obeys the recursive setting
        /// (and thus optionally calls itself recursively).
        /// </summary>
        /// <param name="item">The VSS Item (project) to check for deletions</param>
        /// <param name="localPathPrefix">The path to the folder of the item being processed</param>
        public void RemoveDeletedFromLocalImage(IVSSItem item, string localPathPrefix)
        {
            IVSSItems items = item.get_Items(true);

            Hashtable deletedTable = BuildDeletedTable(items);

            IEnumerator ie = items.GetEnumerator();

            while (ie.MoveNext())
            {
                IVSSItem i         = (IVSSItem)ie.Current;
                string   localPath = System.IO.Path.Combine(localPathPrefix, i.Name);

                if (IsTrulyDeleted(deletedTable, i) && Exists(localPath))
                {
                    SetToWriteable(localPath);
                    Delete(localPath);
                }
                else
                {
                    if (IsProject(i) && Recursive)
                    {
                        RemoveDeletedFromLocalImage(i, System.IO.Path.Combine(localPathPrefix, i.Name));
                    }
                }
            }
        }
예제 #2
0
        private static void BuildFileList(IVSSItem fromVssProject)
        {
            string spec = fromVssProject.Spec;

            if (vssFolderExclusionRegex != null && vssFolderExclusionRegex.IsMatch(spec))
            {
                searchLog.DebugFormat("Skipping project [Matched folder exclusion regex] {0}", spec);
                return;
            }
            if (vssFolderInclusionRegex != null && !vssFolderInclusionRegex.IsMatch(spec))
            {
                searchLog.DebugFormat("Skipping file [Failed folder inclusion regex] {0}", spec);
                return;
            }
            //still used to generate the project/directories at the beginning of the migration

            /*if (!projList.Exists(proj => string.Compare(proj.Spec, spec, true) == 0))
             * {
             *  projList.Add(fromVssProject);
             * }*/

            IVSSItems   childItems = fromVssProject.get_Items(true);
            IEnumerator enumerator = childItems.GetEnumerator();

            while (enumerator.MoveNext())
            {
                var childItem = (IVSSItem)enumerator.Current;
                if (childItem != null)
                {
                    if (childItem.Type == (int)VSSItemType.VSSITEM_PROJECT)
                    {
                        searchLog.InfoFormat("Scanning Project {0}", childItem.Spec);
                        BuildRevisionList(childItem);
                        BuildFileList(childItem);
                    }
                    else
                    {
                        // skip VSS metadata files.
                        if (!Path.GetExtension(childItem.Name).Contains("scc"))
                        {
                            string fileSpec = childItem.Spec;
                            if (vssFileExclusionRegex != null && vssFileExclusionRegex.IsMatch(fileSpec))
                            {
                                searchLog.DebugFormat("Skipping file [Matched file exclusion regex] {0}", fileSpec);
                                continue;
                            }
                            if (vssFileInclusionRegex != null && !vssFileInclusionRegex.IsMatch(fileSpec))
                            {
                                searchLog.DebugFormat("Skipping file [Failed file inclusion regex] {0}", fileSpec);
                                continue;
                            }
                            //fileList still used for internal checks
                            fileList.Add(childItem);
                            BuildRevisionList(childItem);
                        }
                    }
                }
            }
        }
예제 #3
0
        public Hashtable BuildDeletedTable(IVSSItems items)
        {
            Hashtable result = new Hashtable(new CaseInsensitiveHashCodeProvider(), new CaseInsensitiveComparer());

            IEnumerator ie = items.GetEnumerator();

            while (ie.MoveNext())
            {
                IVSSItem item         = (IVSSItem)ie.Current;
                bool     currentState = result[item.Name] == null ? true : (bool)result[item.Name];
                result[item.Name] = currentState & item.Deleted;
            }

            return(result);
        }
예제 #4
0
        private void ProjectDiff(string project)
        {
            // Recursively loop through our vss projects
            Log.LogMessage(MessageImportance.Low, "Processing project " + project);
            IVSSItem  ssProj     = this.Database.get_VSSItem(project, false);
            IVSSItems ssSubItems = ssProj.get_Items(false);

            foreach (IVSSItem subItem in ssSubItems)
            {
                if (subItem.Type == 0)
                {
                    //Type=0 is a Project
                    ProjectDiff(project + "/" + subItem.Name);
                }
                else
                {
                    ItemDiff(subItem);
                }
            }
        }
예제 #5
0
        protected void ProjectDiff(string Project)
        {
            // Recursively loop through our vss projects
            if (this.Verbose)
            {
                Log(Level.Info, "Processing project " + Project);
            }
            IVSSItem  ssProj     = this.Database.get_VSSItem(Project, false);
            IVSSItems ssSubItems = ssProj.get_Items(false);

            foreach (IVSSItem subItem in ssSubItems)
            {
                if (subItem.Type == 0)
                {
                    //Type=0 is a Project
                    ProjectDiff(Project + "/" + subItem.Name);
                }
                else
                {
                    ItemDiff(subItem);
                }
            }
        }
예제 #6
0
 public void SetItems(IVSSItems items) {
     _items = items;
 }
		void WalkItems(IVSSItems items)
		{
			foreach (IVSSItem item in items)
			{
				WalkItem(item);
			}
		}
예제 #8
0
        public Hashtable BuildDeletedTable(IVSSItems items) {
            Hashtable result = new Hashtable(new CaseInsensitiveHashCodeProvider(), new CaseInsensitiveComparer());

            IEnumerator ie = items.GetEnumerator();
            while (ie.MoveNext()) {
                IVSSItem item = (IVSSItem) ie.Current;
                bool currentState = result[item.Name] == null ? true : (bool) result[item.Name];
                result[item.Name] = currentState & item.Deleted;
            }

            return result;
        }
예제 #9
0
 public void SetItems(IVSSItems items)
 {
     _items = items;
 }