Exemplo n.º 1
0
        public LogEntry CopyTree(IGitTreeModifier treeBuilder, ITfsWorkspace workspace)
        {
            var startTime      = DateTime.Now;
            var itemsCopied    = 0;
            var maxChangesetId = 0;
            var tfsTreeEntries = GetTree().ToArray();

            if (tfsTreeEntries.Length == 0)
            {
                maxChangesetId = _changeset.ChangesetId;
            }
            else
            {
                workspace.Get(_changeset.ChangesetId);
                foreach (var entry in tfsTreeEntries)
                {
                    Add(entry.Item, entry.FullName, treeBuilder, workspace);
                    maxChangesetId = Math.Max(maxChangesetId, entry.Item.ChangesetId);

                    itemsCopied++;
                    if (DateTime.Now - startTime > TimeSpan.FromSeconds(30))
                    {
                        _stdout.WriteLine("{0} objects created...", itemsCopied);
                        startTime = DateTime.Now;
                    }
                }
            }
            return(MakeNewLogEntry(maxChangesetId == _changeset.ChangesetId ? _changeset : _tfs.GetChangeset(maxChangesetId)));
        }
Exemplo n.º 2
0
 public void Apply(ITfsWorkspace workspace)
 {
     workspace.Edit(Path);
     workspace.Rename(Path, PathTo, Score);
     var workspaceFile = workspace.GetLocalPath(PathTo);
     _repository.GetBlob(NewSha, workspaceFile);
 }
Exemplo n.º 3
0
 private void Add(IItem item, string pathInGitRepo, GitIndexInfo index, ITfsWorkspace workspace)
 {
     if (item.DeletionId == 0)
     {
         index.Update(Mode.NewFile, pathInGitRepo, workspace.GetLocalPath(pathInGitRepo));
     }
 }
Exemplo n.º 4
0
 public void Apply(ITfsWorkspace workspace)
 {
     workspace.Edit(_path);
     workspace.Rename(_path, _pathTo);
     var workspaceFile = workspace.GetLocalPath(_pathTo);
     _repository.GetBlob(_newSha, workspaceFile);
 }
Exemplo n.º 5
0
        public LogEntry CopyTree(GitIndexInfo index, ITfsWorkspace workspace)
        {
            var startTime = DateTime.Now;
            var itemsCopied = 0;
            var maxChangesetId = 0;
            var tfsTreeEntries = GetTree().ToArray();
            if (tfsTreeEntries.Length == 0)
            {
                maxChangesetId = _changeset.ChangesetId;
            }
            else
            {
                workspace.Get(_changeset.ChangesetId);
                foreach (var entry in tfsTreeEntries)
                {
                    Add(entry.Item, entry.FullName, index, workspace);
                    maxChangesetId = Math.Max(maxChangesetId, entry.Item.ChangesetId);

                    itemsCopied++;
                    if (DateTime.Now - startTime > TimeSpan.FromSeconds(30))
                    {
                        _stdout.WriteLine("{0} objects created...", itemsCopied);
                        startTime = DateTime.Now;
                    }
                }
            }
            return MakeNewLogEntry(maxChangesetId == _changeset.ChangesetId ? _changeset : _tfs.GetChangeset(maxChangesetId));
        }
Exemplo n.º 6
0
        public void Apply(ITfsWorkspace workspace)
        {
            var workspaceFile = workspace.GetLocalPath(Path);

            Repository.CopyBlob(NewSha, workspaceFile);
            workspace.Add(Path);
        }
Exemplo n.º 7
0
 private void PendChangesToWorkspace(string head, string parent, ITfsWorkspace workspace)
 {
     foreach (var change in Repository.GetChangedFiles(parent, head))
     {
         change.Apply(workspace);
     }
 }
Exemplo n.º 8
0
 private void Apply(IChange change, GitIndexInfo index, ITfsWorkspace workspace, IDictionary <string, GitObject> initialTree)
 {
     // If you make updates to a dir in TF, the changeset includes changes for all the children also,
     // and git doesn't really care if you add or delete empty dirs.
     if (change.Item.ItemType == TfsItemType.File)
     {
         var pathInGitRepo = GetPathInGitRepo(change.Item.ServerItem, workspace.Remote, initialTree);
         if (pathInGitRepo == null || Summary.Remote.ShouldSkip(pathInGitRepo))
         {
             return;
         }
         if (change.ChangeType.IncludesOneOf(TfsChangeType.Rename))
         {
             Rename(change, pathInGitRepo, index, workspace, initialTree);
         }
         else if (change.ChangeType.IncludesOneOf(TfsChangeType.Delete))
         {
             Delete(pathInGitRepo, index, initialTree);
         }
         else
         {
             Update(change, pathInGitRepo, index, workspace, initialTree);
         }
     }
 }
Exemplo n.º 9
0
        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());
        }
Exemplo n.º 10
0
        public void Apply(ITfsWorkspace workspace)
        {
            workspace.Edit(Path);
            workspace.Rename(Path, PathTo, Score);
            var workspaceFile = workspace.GetLocalPath(PathTo);

            _repository.GetBlob(NewSha, workspaceFile);
        }
Exemplo n.º 11
0
 public void Get(ITfsWorkspace workspace, IEnumerable <IChange> changes)
 {
     foreach (var change in changes)
     {
         var item = (UnshelveItem)change.Item;
         item.Get(workspace);
     }
 }
Exemplo n.º 12
0
 private long Checkin(string head, string parent, ITfsWorkspace workspace, CheckinOptions options, string sourceTfsPath)
 {
     PendChangesToWorkspace(head, parent, workspace);
     if (!string.IsNullOrWhiteSpace(sourceTfsPath))
     {
         workspace.Merge(sourceTfsPath, TfsRepositoryPath);
     }
     return(workspace.Checkin(options));
 }
Exemplo n.º 13
0
        private string GetPathRelativeToWorkspaceLocalPath(ITfsWorkspace workspace)
        {
            if (workspace.Remote.MatchesUrlAndRepositoryPath(Summary.Remote.TfsUrl, Summary.Remote.TfsRepositoryPath))
            {
                return("");
            }

            return(string.IsNullOrEmpty(Summary.Remote.TfsRepositoryPath) ? "" : Summary.Remote.Prefix);
        }
Exemplo n.º 14
0
        public TfsFileSystem(ITfsWorkspace workspace, string path)
            : base(path)
        {
            if (workspace == null)
            {
                throw new ArgumentNullException("workspace");
            }

            Workspace = workspace;
        }
Exemplo n.º 15
0
 public LogEntry Apply(string lastCommit, GitIndexInfo index, ITfsWorkspace workspace)
 {
     var initialTree = Summary.Remote.Repository.GetObjects(lastCommit);
     workspace.Get(_changeset);
     foreach (var change in Sort(_changeset.Changes))
     {
         Apply(change, index, workspace, initialTree);
     }
     return MakeNewLogEntry();
 }
Exemplo n.º 16
0
        public LogEntry Apply(string lastCommit, GitIndexInfo index, ITfsWorkspace workspace)
        {
            var initialTree = workspace.Remote.Repository.GetObjects(lastCommit);

            workspace.Get(_changeset);
            foreach (var change in Sort(_changeset.Changes))
            {
                Apply(change, index, workspace, initialTree);
            }
            return(MakeNewLogEntry());
        }
Exemplo n.º 17
0
 private void Update(ApplicableChange change, IGitTreeModifier treeBuilder, ITfsWorkspace workspace, IDictionary<string, GitObject> initialTree)
 {
     var localPath = workspace.GetLocalPath(change.GitPath);
     if (File.Exists(localPath))
     {
         treeBuilder.Add(change.GitPath, localPath, change.Mode);
     }
     else
     {
         _stdout.WriteLine("Cannot checkout file '{0}' from TFS. Skip it", change.GitPath);
     }
 }
Exemplo n.º 18
0
 private void Rename(IChange change, string pathInGitRepo, GitIndexInfo index, ITfsWorkspace workspace, IDictionary<string, GitObject> initialTree)
 {
     var oldPath = GetPathInGitRepo(GetPathBeforeRename(change.Item), initialTree);
     if (oldPath != null)
     {
         Delete(oldPath, index, initialTree);
     }
     if (!change.ChangeType.IncludesOneOf(TfsChangeType.Delete))
     {
         Update(change, pathInGitRepo, index, workspace, initialTree);
     }
 }
Exemplo n.º 19
0
 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();
 }
Exemplo n.º 20
0
        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());
        }
Exemplo n.º 21
0
        private void Update(ApplicableChange change, IGitTreeModifier treeBuilder, ITfsWorkspace workspace, IDictionary <string, GitObject> initialTree)
        {
            var localPath = workspace.GetLocalPath(change.GitPath);

            if (File.Exists(localPath))
            {
                treeBuilder.Add(change.GitPath, localPath, change.Mode);
            }
            else
            {
                Trace.TraceInformation("Cannot checkout file '{0}' from TFS. Skip it", change.GitPath);
            }
        }
Exemplo n.º 22
0
 private void Apply(ApplicableChange change, IGitTreeModifier treeBuilder, ITfsWorkspace workspace, IDictionary<string, GitObject> initialTree)
 {
     switch (change.Type)
     {
         case ChangeType.Update:
             Update(change, treeBuilder, workspace, initialTree);
             break;
         case ChangeType.Delete:
             Delete(change.GitPath, treeBuilder, initialTree);
             break;
         default:
             throw new NotImplementedException("Unsupported change type: " + change.Type);
     }
 }
Exemplo n.º 23
0
 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();
 }
Exemplo n.º 24
0
        public LogEntry Apply(string lastCommit, IGitTreeModifier treeBuilder, ITfsWorkspace workspace, IDictionary <string, GitObject> initialTree)
        {
            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());
            foreach (var change in sieve.GetChangesToApply())
            {
                Apply(change, treeBuilder, workspace, initialTree);
            }
            return(MakeNewLogEntry());
        }
Exemplo n.º 25
0
        private void Apply(ApplicableChange change, IGitTreeModifier treeBuilder, ITfsWorkspace workspace, IDictionary <string, GitObject> initialTree)
        {
            switch (change.Type)
            {
            case ChangeType.Update:
                Update(change, treeBuilder, workspace, initialTree);
                break;

            case ChangeType.Delete:
                Delete(change.GitPath, treeBuilder, initialTree);
                break;

            default:
                throw new NotImplementedException("Unsupported change type: " + change.Type);
            }
        }
Exemplo n.º 26
0
        private void Update(ApplicableChange change, IGitTreeModifier treeBuilder, ITfsWorkspace workspace, IDictionary <string, GitObject> initialTree)
        {
            var localPath = workspace.GetLocalPath(change.GitPath);

            if (File.Exists(localPath))
            {
                if (new System.IO.FileInfo(localPath).Length > 50 * 1024 * 1024)
                {
                    throw new Exception($"File too large for github {localPath}");
                }

                treeBuilder.Add(change.GitPath, localPath, change.Mode);
            }
            else
            {
                Trace.TraceInformation("Cannot checkout file '{0}' from TFS. Skip it", change.GitPath);
            }
        }
Exemplo n.º 27
0
 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();
 }
Exemplo n.º 28
0
        public LogEntry Apply(string lastCommit, IGitTreeModifier treeBuilder, ITfsWorkspace workspace, IDictionary <string, GitObject> initialTree, Action <Exception> ignorableErrorHandler, FileFilter filters)
        {
            if (initialTree.Empty())
            {
                //add mappings to the resolver
                _mappingsFile.Mappings.ForEach(m =>
                {
                    if (!initialTree.ContainsKey(m.TfsPath))
                    {
                        initialTree.Add(m.TfsPath, new GitObject()
                        {
                            Path = m.LocalPath
                        });
                    }
                });

                Summary.Remote.Repository.GetObjects(lastCommit, initialTree);
            }

            var remoteRelativeLocalPath = GetPathRelativeToWorkspaceLocalPath(workspace);
            var resolver = new PathResolver(Summary.Remote, remoteRelativeLocalPath, initialTree);
            var sieve    = new ChangeSieve(_changeset, resolver, filters);

            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());
        }
Exemplo n.º 29
0
        public LogEntry CopyTree(IGitTreeModifier treeBuilder, ITfsWorkspace workspace)
        {
            var startTime      = DateTime.Now;
            var itemsCopied    = 0;
            var maxChangesetId = 0;
            var tfsTreeEntries = GetTree().ToArray();

            if (tfsTreeEntries.Length == 0)
            {
                maxChangesetId = _changeset.ChangesetId;
            }
            else
            {
                workspace.Get(_changeset.ChangesetId);
                foreach (var entry in tfsTreeEntries)
                {
                    var tfsPath = entry.FullName;
                    if (!string.IsNullOrEmpty(Summary.Remote.TfsRepositoryPath) && entry.Item.ServerItem.StartsWith(Summary.Remote.TfsRepositoryPath))
                    {
                        tfsPath = entry.Item.ServerItem.Substring(Summary.Remote.TfsRepositoryPath.Length);
                    }
                    while (tfsPath.StartsWith("/"))
                    {
                        tfsPath = tfsPath.Substring(1);
                    }
                    Add(entry.Item, entry.FullName, tfsPath, treeBuilder, workspace);
                    maxChangesetId = Math.Max(maxChangesetId, entry.Item.ChangesetId);

                    itemsCopied++;
                    if (DateTime.Now - startTime > TimeSpan.FromSeconds(30))
                    {
                        Trace.TraceInformation("{0} objects created...", itemsCopied);
                        startTime = DateTime.Now;
                    }
                }
            }
            return(MakeNewLogEntry(maxChangesetId == _changeset.ChangesetId ? _changeset : _tfs.GetChangeset(maxChangesetId)));
        }
Exemplo n.º 30
0
 private void Apply(IChange change, GitIndexInfo index, ITfsWorkspace workspace, IDictionary<string, GitObject> initialTree)
 {
     // If you make updates to a dir in TF, the changeset includes changes for all the children also,
     // and git doesn't really care if you add or delete empty dirs.
     if (change.Item.ItemType == TfsItemType.File)
     {
         var pathInGitRepo = GetPathInGitRepo(change.Item.ServerItem, initialTree);
         if (pathInGitRepo == null || Summary.Remote.ShouldSkip(pathInGitRepo))
             return;
         if (change.ChangeType.IncludesOneOf(TfsChangeType.Rename))
         {
             Rename(change, pathInGitRepo, index, workspace, initialTree);
         }
         else if (change.ChangeType.IncludesOneOf(TfsChangeType.Delete))
         {
             Delete(pathInGitRepo, index, initialTree);
         }
         else
         {
             Update(change, pathInGitRepo, index, workspace, initialTree);
         }
     }
 }
Exemplo n.º 31
0
 private void Add(IItem item, string pathInGitRepo, IGitTreeModifier treeBuilder, ITfsWorkspace workspace)
 {
     if (item.DeletionId == 0)
     {
         treeBuilder.Add(pathInGitRepo, workspace.GetLocalPath(pathInGitRepo), LibGit2Sharp.Mode.NonExecutableFile);
     }
 }
Exemplo n.º 32
0
 private void PendChangesToWorkspace(string head, string parent, ITfsWorkspace workspace)
 {
     foreach (var change in Repository.GetChangedFiles(parent, head))
     {
         change.Apply(workspace);
     }
 }
Exemplo n.º 33
0
 private long Checkin(string head, string parent, ITfsWorkspace workspace)
 {
     PendChangesToWorkspace(head, parent, workspace);
     return workspace.Checkin();
 }
Exemplo n.º 34
0
 private void Shelve(string shelvesetName, string head, TfsChangesetInfo parentChangeset, ITfsWorkspace workspace)
 {
     foreach (var change in Repository.GetChangedFiles(parentChangeset.GitCommit, head))
     {
         change.Apply(workspace);
     }
     workspace.Shelve(shelvesetName);
 }
Exemplo n.º 35
0
 private void Update(IChange change, string pathInGitRepo, GitIndexInfo index, ITfsWorkspace workspace, IDictionary<string, GitObject> initialTree)
 {
     if (change.Item.DeletionId == 0)
     {
         index.Update(
             GetMode(change, initialTree, pathInGitRepo),
             pathInGitRepo,
             workspace.GetLocalPath(pathInGitRepo)
         );
     }
 }
Exemplo n.º 36
0
 private void Update(ApplicableChange change, IGitTreeModifier treeBuilder, ITfsWorkspace workspace, IDictionary<string, GitObject> initialTree)
 {
     treeBuilder.Add(change.GitPath, workspace.GetLocalPath(change.GitPath), change.Mode);
 }
Exemplo n.º 37
0
 private void PendChangesToWorkspace(string head, TfsChangesetInfo parentChangeset, ITfsWorkspace workspace)
 {
     foreach (var change in Repository.GetChangedFiles(parentChangeset.GitCommit, head))
     {
         change.Apply(workspace);
     }
 }
Exemplo n.º 38
0
 public void Get(ITfsWorkspace workspace, IEnumerable <IChange> changes, Action <Exception> ignorableErrorHandler)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 39
0
        private void Rename(IChange change, string pathInGitRepo, GitIndexInfo index, ITfsWorkspace workspace, IDictionary <string, GitObject> initialTree)
        {
            var oldPath = GetPathInGitRepo(GetPathBeforeRename(change.Item), workspace.Remote, initialTree);

            if (oldPath != null)
            {
                Delete(oldPath, index, initialTree);
            }
            if (!change.ChangeType.IncludesOneOf(TfsChangeType.Delete))
            {
                Update(change, pathInGitRepo, index, workspace, initialTree);
            }
        }
Exemplo n.º 40
0
 private void PendChangesToWorkspace(string head, TfsChangesetInfo parentChangeset, ITfsWorkspace workspace)
 {
     foreach (var change in Repository.GetChangedFiles(parentChangeset.GitCommit, head))
     {
         change.Apply(workspace);
     }
 }
Exemplo n.º 41
0
 public void Get(ITfsWorkspace workspace, IEnumerable<IChange> changes)
 {
     workspace.Get(this.ChangesetId, changes);
 }
Exemplo n.º 42
0
 private void Shelve(string shelvesetName, string head, TfsChangesetInfo parentChangeset, bool evaluateCheckinPolicies, ITfsWorkspace workspace)
 {
     PendChangesToWorkspace(head, parentChangeset, workspace);
     workspace.Shelve(shelvesetName, evaluateCheckinPolicies);
 }
Exemplo n.º 43
0
 private long CheckinTool(string head, TfsChangesetInfo parentChangeset, ITfsWorkspace workspace)
 {
     PendChangesToWorkspace(head, parentChangeset.GitCommit, workspace);
     return(workspace.CheckinTool(() => Repository.GetCommitMessage(head, parentChangeset.GitCommit)));
 }
Exemplo n.º 44
0
 private long Checkin(string head, TfsChangesetInfo parentChangeset, ITfsWorkspace workspace)
 {
     PendChangesToWorkspace(head, parentChangeset, workspace);
     return(workspace.Checkin());
 }
Exemplo n.º 45
0
 public void Get(ITfsWorkspace workspace, IEnumerable <IChange> changes)
 {
     workspace.Get(this.ChangesetId, changes);
 }
Exemplo n.º 46
0
 public TfsFileSystem(ITfsWorkspace workspace, string path)
     : base(path)
 {
     Workspace = workspace;
 }
Exemplo n.º 47
0
 private void Add(IItem item, string pathInGitRepo, GitIndexInfo index, ITfsWorkspace workspace)
 {
     if (item.DeletionId == 0)
     {
         index.Update(Mode.NewFile, pathInGitRepo, workspace.GetLocalPath(pathInGitRepo));
     }
 }
Exemplo n.º 48
0
 public void Apply(ITfsWorkspace workspace)
 {
     workspace.Delete(Path);
 }
Exemplo n.º 49
0
 private void Shelve(string shelvesetName, string head, TfsChangesetInfo parentChangeset, CheckinOptions options, bool evaluateCheckinPolicies, ITfsWorkspace workspace)
 {
     PendChangesToWorkspace(head, parentChangeset.GitCommit, workspace);
     workspace.Shelve(shelvesetName, evaluateCheckinPolicies, options);
 }
Exemplo n.º 50
0
 private long Checkin(string head, TfsChangesetInfo parentChangeset, ITfsWorkspace workspace)
 {
     foreach (var change in Repository.GetChangedFiles(parentChangeset.GitCommit, head))
     {
         change.Apply(workspace);
     }
     return workspace.Checkin();
 }
Exemplo n.º 51
0
 private int Checkin(string head, string parent, ITfsWorkspace workspace, CheckinOptions options, string sourceTfsPath)
 {
     PendChangesToWorkspace(head, parent, workspace);
     if (!string.IsNullOrWhiteSpace(sourceTfsPath))
         workspace.Merge(sourceTfsPath, TfsRepositoryPath);
     return workspace.Checkin(options);
 }
Exemplo n.º 52
0
 public void Apply(ITfsWorkspace workspace)
 {
     var workspaceFile = workspace.GetLocalPath(Path);
     Repository.CopyBlob(NewSha, workspaceFile);
     workspace.Add(Path);
 }
Exemplo n.º 53
0
 private long CheckinTool(string head, TfsChangesetInfo parentChangeset, ITfsWorkspace workspace)
 {
     PendChangesToWorkspace(head, parentChangeset.GitCommit, workspace);
     return workspace.CheckinTool(() => Repository.GetCommitMessage(head, parentChangeset.GitCommit));
 }
Exemplo n.º 54
0
 public void Get(ITfsWorkspace workspace, IEnumerable<IChange> changes, Action<Exception> ignorableErrorHandler)
 {
     workspace.Get(this.ChangesetId, changes);
 }
Exemplo n.º 55
0
 private void Shelve(string shelvesetName, string head, TfsChangesetInfo parentChangeset, bool evaluateCheckinPolicies, ITfsWorkspace workspace)
 {
     PendChangesToWorkspace(head, parentChangeset.GitCommit, workspace);
     workspace.Shelve(shelvesetName, evaluateCheckinPolicies, () => Repository.GetCommitMessage(head, parentChangeset.GitCommit));
 }
Exemplo n.º 56
0
 private void Shelve(string shelvesetName, string head, TfsChangesetInfo parentChangeset, bool evaluateCheckinPolicies, ITfsWorkspace workspace)
 {
     PendChangesToWorkspace(head, parentChangeset.GitCommit, workspace);
     workspace.Shelve(shelvesetName, evaluateCheckinPolicies, () => Repository.GetCommitMessage(head, parentChangeset.GitCommit));
 }
Exemplo n.º 57
0
 public void Get(ITfsWorkspace workspace, IEnumerable <IChange> changes, Action <Exception> ignorableErrorHandler)
 {
     workspace.Get(this.ChangesetId, changes);
 }
Exemplo n.º 58
0
 private void Add(IItem item, string pathInGitRepo, IGitTreeModifier treeBuilder, ITfsWorkspace workspace)
 {
     if (item.DeletionId == 0)
     {
         treeBuilder.Add(pathInGitRepo, workspace.GetLocalPath(pathInGitRepo), LibGit2Sharp.Mode.NonExecutableFile);
     }
 }
Exemplo n.º 59
0
 private void Update(IChange change, string pathInGitRepo, GitIndexInfo index, ITfsWorkspace workspace, IDictionary <string, GitObject> initialTree)
 {
     if (change.Item.DeletionId == 0)
     {
         index.Update(
             GetMode(change, initialTree, pathInGitRepo),
             pathInGitRepo,
             workspace.GetLocalPath(pathInGitRepo)
             );
     }
 }
Exemplo n.º 60
0
 public void Apply(ITfsWorkspace workspace)
 {
     workspace.Edit(Path);
     var workspaceFile = workspace.GetLocalPath(Path);
     _repository.CopyBlob(NewSha, workspaceFile);
 }