public override ObservableList <SourceControlFileInfo> GetPathFilesStatus(string Path) { if (client == null) { Init(); } ObservableList <SourceControlFileInfo> files = new ObservableList <SourceControlFileInfo>(); System.Collections.ObjectModel.Collection <SvnStatusEventArgs> statuses; try { client.GetStatus(Path, out statuses); foreach (SvnStatusEventArgs arg in statuses) { //TODO: removes saving veriosn to folder under Source control, meahnwhile ignore files with Prev if (arg.FullPath.Contains("PrevVersions")) { continue; } if (arg.FullPath.Contains("RecentlyUsed.dat")) { continue; } SourceControlFileInfo SCFI = new SourceControlFileInfo(); SCFI.Path = arg.FullPath; SCFI.SolutionPath = arg.FullPath.Replace(App.UserProfile.Solution.Folder, @"~\"); SCFI.Status = SourceControlFileInfo.eRepositoryItemStatus.Unknown; SCFI.Selected = true; SCFI.Diff = ""; if (arg.LocalContentStatus == SvnStatus.Modified) { SCFI.Status = SourceControlFileInfo.eRepositoryItemStatus.Modified; SCFI.Diff = Diff(arg.FullPath, arg.Uri); } if (arg.LocalContentStatus == SvnStatus.NotVersioned) { SCFI.Status = SourceControlFileInfo.eRepositoryItemStatus.New; } if (arg.LocalContentStatus == SvnStatus.Missing) { SCFI.Status = SourceControlFileInfo.eRepositoryItemStatus.Deleted; } if (SCFI.Status != SourceControlFileInfo.eRepositoryItemStatus.Unknown) { files.Add(SCFI); } } } catch (Exception ex) { Reporter.ToLog(eLogLevel.ERROR, "Failed to comunicate with SVN server through path " + Path + " got error " + ex.Message); return(files); } return(files); }
public override ObservableList <SourceControlFileInfo> GetPathFilesStatus(string Path, ref string error, List <string> PathsToIgnore = null, bool includLockedFiles = false) { if (client == null) { Init(); } ObservableList <SourceControlFileInfo> files = new ObservableList <SourceControlFileInfo>(); System.Collections.ObjectModel.Collection <SvnStatusEventArgs> statuses; try { client.GetStatus(Path, out statuses); foreach (SvnStatusEventArgs arg in statuses) { if (PathsToIgnore != null) { bool pathToIgnoreFound = false; foreach (string pathToIgnore in PathsToIgnore) { if (System.IO.Path.GetFullPath(arg.FullPath).Contains(System.IO.Path.GetFullPath(pathToIgnore)) || arg.FullPath.Contains(pathToIgnore)) { pathToIgnoreFound = true; break; } } if (pathToIgnoreFound) { continue; } } if (System.IO.Path.GetExtension(arg.FullPath) == ".ldb" || System.IO.Path.GetExtension(arg.FullPath) == ".ignore") { continue; } SourceControlFileInfo SCFI = new SourceControlFileInfo(); SCFI.Path = arg.FullPath; SCFI.SolutionPath = arg.FullPath.Replace(SolutionFolder, @"~\"); SCFI.Status = SourceControlFileInfo.eRepositoryItemStatus.Unknown; SCFI.Selected = true; SCFI.Diff = ""; if (arg.LocalContentStatus == SvnStatus.Modified) { SCFI.Status = SourceControlFileInfo.eRepositoryItemStatus.Modified; Task.Run(() => SCFI.Diff = Diff(arg.FullPath, arg.Uri)); } if (arg.LocalContentStatus == SvnStatus.NotVersioned) { SCFI.Status = SourceControlFileInfo.eRepositoryItemStatus.New; } if (arg.LocalContentStatus == SvnStatus.Missing) { SCFI.Status = SourceControlFileInfo.eRepositoryItemStatus.Deleted; } if (includLockedFiles) { Collection <SvnListEventArgs> ListEventArgs; Task.Run(() => { GetRemoteUriFromPath(arg.FullPath, out ListEventArgs); if (ListEventArgs != null && ListEventArgs[0].Lock != null) { SCFI.Locked = true; SCFI.LockedOwner = ListEventArgs[0].Lock.Owner; SCFI.LockComment = ListEventArgs[0].Lock.Comment; } else { SCFI.Locked = false; } }); } if (SCFI.Status != SourceControlFileInfo.eRepositoryItemStatus.Unknown) { files.Add(SCFI); } } } catch (Exception ex) { error = ex.Message + Environment.NewLine + ex.InnerException; Reporter.ToLog(eLogLevel.ERROR, "Failed to communicate with SVN server through path " + Path + " got error " + ex.Message); return(files); } return(files); }
private void CheckInFilesGrid_grdMain_MouseDoubleClick(object sender, EventArgs e) { SourceControlFileInfo a = (SourceControlFileInfo)CheckInFilesGrid.CurrentItem; openDiff(a.Diff); }
public override ObservableList <SourceControlFileInfo> GetPathFilesStatus(string Path, ref string error, bool includLockedFiles = false) { Console.WriteLine("GITHub - GetPathFilesStatus"); ObservableList <SourceControlFileInfo> list = new ObservableList <SourceControlFileInfo>(); try { string relativePath = System.IO.Path.GetFullPath(Path); relativePath = relativePath.Substring(RepositoryRootFolder.Count()); if (relativePath.StartsWith(@"\")) { relativePath = relativePath.Substring(1); } using (var repo = new LibGit2Sharp.Repository(RepositoryRootFolder)) { foreach (var item in repo.RetrieveStatus()) { if (WorkSpace.Instance.SolutionRepository.IsSolutionPathToAvoid(System.IO.Path.Combine(RepositoryRootFolder, item.FilePath))) { continue; } if (System.IO.Path.GetExtension(item.FilePath) == ".ldb" || System.IO.Path.GetExtension(item.FilePath) == ".ignore") { continue; } //sometimes remote file path uses / otherwise \ our code should be path independent if (relativePath == string.Empty || System.IO.Path.GetFullPath(System.IO.Path.Combine(RepositoryRootFolder, item.FilePath)).StartsWith(System.IO.Path.GetFullPath(Path))) { SourceControlFileInfo SCFI = new SourceControlFileInfo(); SCFI.Path = RepositoryRootFolder + @"\" + item.FilePath; SCFI.SolutionPath = @"~\" + item.FilePath; SCFI.Status = SourceControlFileInfo.eRepositoryItemStatus.Unknown; SCFI.Selected = true; SCFI.Diff = ""; if (item.State == FileStatus.ModifiedInWorkdir) { SCFI.Status = SourceControlFileInfo.eRepositoryItemStatus.Modified; } if (item.State == FileStatus.ModifiedInIndex) { SCFI.Status = SourceControlFileInfo.eRepositoryItemStatus.ModifiedAndResolved; } if (item.State == FileStatus.NewInWorkdir) { SCFI.Status = SourceControlFileInfo.eRepositoryItemStatus.New; } if (item.State == FileStatus.DeletedFromWorkdir) { SCFI.Status = SourceControlFileInfo.eRepositoryItemStatus.Deleted; } if (SCFI.Status != SourceControlFileInfo.eRepositoryItemStatus.Unknown) { list.Add(SCFI); } } } } return(list); } catch (Exception ex) { error = ex.Message + Environment.NewLine + ex.InnerException; return(list); } }
public override ObservableList <SourceControlFileInfo> GetPathFilesStatus(string Path, ref string error, List <string> PathsToIgnore = null, bool includLockedFiles = false) { Console.WriteLine("GITHub - GetPathFilesStatus"); ObservableList <SourceControlFileInfo> list = new ObservableList <SourceControlFileInfo>(); try { string relativePath = System.IO.Path.GetFullPath(Path); relativePath = relativePath.Substring(RepositoryRootFolder.Count()); if (relativePath.StartsWith(@"\")) { relativePath = relativePath.Substring(1); } using (var repo = new LibGit2Sharp.Repository(RepositoryRootFolder)) { foreach (var item in repo.RetrieveStatus()) { if (PathsToIgnore != null) { bool pathToIgnoreFound = false; foreach (string pathToIgnore in PathsToIgnore) { if (System.IO.Path.GetFullPath(RepositoryRootFolder + @"\" + item.FilePath).Contains(System.IO.Path.GetFullPath(pathToIgnore)) || item.FilePath.Contains(pathToIgnore)) { pathToIgnoreFound = true; break; } } if (pathToIgnoreFound) { continue; } } if (System.IO.Path.GetExtension(item.FilePath) == ".ldb" || System.IO.Path.GetExtension(item.FilePath) == ".ignore") { continue; } if (relativePath == string.Empty || item.FilePath.StartsWith(relativePath)) { SourceControlFileInfo SCFI = new SourceControlFileInfo(); SCFI.Path = RepositoryRootFolder + @"\" + item.FilePath; SCFI.SolutionPath = @"~\" + item.FilePath; SCFI.Status = SourceControlFileInfo.eRepositoryItemStatus.Unknown; SCFI.Selected = true; SCFI.Diff = ""; if (item.State == FileStatus.ModifiedInWorkdir) { SCFI.Status = SourceControlFileInfo.eRepositoryItemStatus.Modified; } if (item.State == FileStatus.ModifiedInIndex) { SCFI.Status = SourceControlFileInfo.eRepositoryItemStatus.ModifiedAndResolved; } if (item.State == FileStatus.NewInWorkdir) { SCFI.Status = SourceControlFileInfo.eRepositoryItemStatus.New; } if (item.State == FileStatus.DeletedFromWorkdir) { SCFI.Status = SourceControlFileInfo.eRepositoryItemStatus.Deleted; } if (SCFI.Status != SourceControlFileInfo.eRepositoryItemStatus.Unknown) { list.Add(SCFI); } } } } return(list); } catch (Exception ex) { error = ex.Message + Environment.NewLine + ex.InnerException; return(list); } }