public ChangeSieve(IChangeset changeset, PathResolver resolver) { _resolver = resolver; _namedChanges = changeset.Changes.Select(c => new NamedChange { Info = _resolver.GetGitObject(c.Item.ServerItem), Change = c, }); }
public LogEntry Apply(string lastCommit, IGitTreeModifier treeBuilder, ITfsWorkspace workspace) { var initialTree = Summary.Remote.Repository.GetObjects(lastCommit); var resolver = new PathResolver(Summary.Remote, initialTree); var sieve = new ChangeSieve(_changeset, resolver); workspace.Get(_changeset.ChangesetId, sieve.GetChangesToFetch()); foreach (var change in sieve.GetChangesToApply()) { Apply(change, treeBuilder, workspace, initialTree); } return MakeNewLogEntry(); }
public LogEntry Apply(string lastCommit, IGitTreeModifier treeBuilder, ITfsWorkspace workspace, IDictionary<string, GitObject> initialTree, Action<Exception> ignorableErrorHandler) { if (initialTree.Empty()) Summary.Remote.Repository.GetObjects(lastCommit, initialTree); var resolver = new PathResolver(Summary.Remote, initialTree); var sieve = new ChangeSieve(_changeset, resolver); _changeset.Get(workspace, sieve.GetChangesToFetch(), ignorableErrorHandler); foreach (var change in sieve.GetChangesToApply()) { ignorableErrorHandler.Catch(() => { Apply(change, treeBuilder, workspace, initialTree); }); } return MakeNewLogEntry(); }
public LogEntry Apply(string lastCommit, IGitTreeModifier treeBuilder, ITfsWorkspace workspace, IDictionary<string, GitObject> initialTree, Action<Exception> ignorableErrorHandler) { if (initialTree.Empty()) Summary.Remote.Repository.GetObjects(lastCommit, initialTree); var remoteRelativeLocalPath = GetPathRelativeToWorkspaceLocalPath(workspace); var resolver = new PathResolver(Summary.Remote, remoteRelativeLocalPath, initialTree); var sieve = new ChangeSieve(_changeset, resolver); if (sieve.RenameBranchCommmit) { IsRenameChangeset = true; } _changeset.Get(workspace, sieve.GetChangesToFetch(), ignorableErrorHandler); var forceGetChanges = lastCommit == null; foreach (var change in sieve.GetChangesToApply(forceGetChanges)) { ignorableErrorHandler.Catch(() => { Apply(change, treeBuilder, workspace, initialTree); }); } return MakeNewLogEntry(); }
public ChangeSieve(IChangeset changeset, PathResolver resolver) { _changeset = changeset; _resolver = resolver; }
public IEnumerable<TfsTreeEntry> GetFullTree() { var treeInfo = Summary.Remote.Repository.CreateObjectsDictionary(); var resolver = new PathResolver(Summary.Remote, treeInfo); IItem[] tfsItems; if(Summary.Remote.TfsRepositoryPath != null) { tfsItems = _changeset.VersionControlServer.GetItems(Summary.Remote.TfsRepositoryPath, _changeset.ChangesetId, TfsRecursionType.Full); } else { tfsItems = Summary.Remote.TfsSubtreePaths.SelectMany(x => _changeset.VersionControlServer.GetItems(x, _changeset.ChangesetId, TfsRecursionType.Full)).ToArray(); } var tfsItemsWithGitPaths = tfsItems.Select(item => new { item, gitPath = resolver.GetPathInGitRepo(item.ServerItem) }); return tfsItemsWithGitPaths.Where(x => x.gitPath != null).Select(x => new TfsTreeEntry(x.gitPath, x.item)); }