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); }
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; }
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(); }
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); }
private static HgFileInfo[] ParseStatusOutput(string root, string[] output) { return(output.Select(x => HgFileInfo.FromHgOutput(root, x)).ToArray()); }
public bool Equals(HgFileInfo file) { return StringComparer.InvariantCultureIgnoreCase.Equals((string)FullName, file.FullName); }