예제 #1
0
 public PendingChange(HgFileInfo file)
 {
     ShortName = file.ShortName;
     RootName = file.RootName;
     Status = file.Status;
     Name = file.Name;
     FullName = file.FullName;
 }
 public void Synchronize(HgFileInfo[] files)
 {
     pendingChangesControl.Synchronize(files);
 }
예제 #3
0
        private static Dictionary<string, string> GetRenames(HgFileInfo[] files)
        {
            var renames = new Dictionary<string, string>();

            var newFile = files.FirstOrDefault();

            foreach (var file in files)
            {
                if (newFile.Status == HgFileStatus.Added && file.Status == HgFileStatus.None)
                {
                    renames.Add(newFile.FullName, file.FullName);
                }

                newFile = file;
            }

            return renames;
        }
예제 #4
0
        private static HgFileInfo[] ExcludeCaseSensitiveRenames(HgFileInfo[] files)
        {
            var dictionary = new Dictionary<string, HgFileInfo>(StringComparer.InvariantCultureIgnoreCase);

            foreach (var file in files)
            {
                if (!dictionary.ContainsKey(file.FullName) || dictionary[file.FullName].Status != HgFileStatus.Renamed || file.Status != HgFileStatus.Removed)
                {
                    dictionary[file.FullName] = file;
                }
            }

            return dictionary.Values.ToArray();
        }
예제 #5
0
        private static HgFileInfo[] DetectRenames(HgFileInfo[] files)
        {
            var filteredFiles = files.Where(x => x.Status != HgFileStatus.None).ToArray();

            foreach (var item in GetRenames(files))
            {
                var fileName = item.Value;
                var newFileName = item.Key;

                var file = filteredFiles.FirstOrDefault(x => x.FullName == newFileName);

                if (file != null)
                {
                    file.OriginalFile =
                        filteredFiles.FirstOrDefault(x => x.FullName == fileName) ??
                        GetRawFileInfo(fileName).FirstOrDefault();
                }
            }

            return ExcludeCaseSensitiveRenames(filteredFiles);
        }
예제 #6
0
 private static HgFileInfo[] ParseStatusOutput(string root, string[] output)
 {
     return(output.Select(x => HgFileInfo.FromHgOutput(root, x)).ToArray());
 }
예제 #7
0
 public bool Equals(HgFileInfo file)
 {
     return StringComparer.InvariantCultureIgnoreCase.Equals((string)FullName, file.FullName);
 }