Example #1
0
        /// <summary>
        /// Checks if at least one file in the specified changeset belongs to a watched
        /// project.
        /// </summary>
        /// <param name="details">The changeset details.</param>
        /// <returns>true if none of the files in the changeset belongs to a watched project.</returns>
        private static bool IsIgnoredChangeSet(IResource repository, ChangeSetDetails details)
        {
            string[] pathsToWatch = GetPathsToWatch(repository);
            if (pathsToWatch.Length == 0)
            {
                return(false);
            }

            foreach (FileChangeData fileChange in details.FileChanges)
            {
                string fileChangePath = fileChange.Path.ToLower();
                foreach (string path in pathsToWatch)
                {
                    if (fileChangePath.StartsWith(path.ToLower()))
                    {
                        return(false);
                    }
                }
            }
            return(true);
        }
Example #2
0
        private static void SaveChangeSet(IResource repository, IResource changeSet, ChangeSetDetails details)
        {
            if (changeSet.HasProp(Props.Change))
            {
                return;
            }

            ResourceProxy proxy = new ResourceProxy(changeSet);

            proxy.BeginUpdate();

            SetChangeSetDescription(proxy, details.Description);

            foreach (var fileChangeData in details.FileChanges)
            {
                int    pos        = fileChangeData.Path.LastIndexOf('/');
                string folderName = fileChangeData.Path.Substring(0, pos);
                string fileName   = fileChangeData.Path.Substring(pos + 1);

                IResource folder = FindOrCreateFolder(repository, folderName);
                proxy.AddLink(Props.AffectsFolder, folder);

                var fileChange = FileChange.Create();
                fileChange.Name          = fileName;
                fileChange.AffectsFolder = folder;
                fileChange.ChangeType    = fileChangeData.ChangeType;
                fileChange.Revision      = fileChangeData.Revision;
                fileChange.Diff          = fileChangeData.Diff;
                fileChange.Binary        = fileChangeData.Binary;
                fileChange.Save();

                proxy.AddLink(Props.Change, fileChange.Resource);
            }

            proxy.EndUpdate();
            Core.TextIndexManager.QueryIndexing(proxy.Resource.Id);
        }