Пример #1
0
        private void Update(ApplicableChange change, IGitTreeModifier treeBuilder, ITfsWorkspace workspace, IDictionary <string, GitObject> initialTree)
        {
            // Assume we cut path at the start, so add it back
            var tfsPath = change.GitPath;

            if (!string.IsNullOrEmpty(_cutPath))
            {
                tfsPath = _cutPath + "/" + tfsPath;
            }

            var localPath = workspace.GetLocalPath(tfsPath);

            if (File.Exists(localPath))
            {
                treeBuilder.Add(change.GitPath, localPath, change.Mode);
            }
            else
            {
                // Fallback to supplied path
                tfsPath   = change.GitPath;
                localPath = workspace.GetLocalPath(tfsPath);
                if (File.Exists(localPath))
                {
                    treeBuilder.Add(change.GitPath, localPath, change.Mode);
                }
                else
                {
                    Trace.TraceInformation("Cannot checkout file '{0}' from TFS. Skip it", tfsPath);
                }
            }
        }
Пример #2
0
 public void DoesNotApplyBranchedFile()
 {
     AssertChanges(Subject.GetChangesToApply(),
                   ApplicableChange.Delete("oldfile10.txt"),
                   ApplicableChange.Update("file8.txt"),
                   ApplicableChange.Update("file9.txt"),
                   ApplicableChange.Update("file10.txt"));
 }
Пример #3
0
 public void UpdatesPathCasing()
 {
     AssertChanges(Subject.GetChangesToApply(),
                   ApplicableChange.Delete("dir2/file2.txt"),
                   ApplicableChange.Update("dir2/file3.txt"),
                   ApplicableChange.Update("dir1/file1.exe"),
                   ApplicableChange.Update("dir1/file4.txt"));
 }
Пример #4
0
 public void SplitsRenamesAndPutsDeletesFirst()
 {
     AssertChanges(Subject.GetChangesToApply(),
                   ApplicableChange.Delete("file2.txt"),
                   ApplicableChange.Delete("file4.txt"),
                   ApplicableChange.Delete("oldfile5.txt"),
                   ApplicableChange.Update("file1.txt"),
                   ApplicableChange.Update("file3.txt"),
                   ApplicableChange.Update("file5.txt"));
 }
Пример #5
0
 public void AppliesDeletesFirst()
 {
     AssertChanges(Subject.GetChangesToApply(),
                   ApplicableChange.Delete("1-ignored.txt"),
                   ApplicableChange.Delete("3-included.txt"),
                   ApplicableChange.Delete("4-wasignored.txt"),
                   ApplicableChange.Delete("5-wasincluded.txt"),
                   ApplicableChange.Delete("6-wasignored.txt"),
                   ApplicableChange.Update("2-included.txt"),
                   ApplicableChange.Update("6-included.txt"));
 }
Пример #6
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);
            }
        }
Пример #7
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);
            }
        }
Пример #8
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);
            }
        }
Пример #9
0
 public void FetchesItemRenamedAfterDelete()
 {
     AssertChanges(Subject.GetChangesToApply(),
                   ApplicableChange.Update("file1.txt"));
 }
Пример #10
0
 public void IncludesChangesInThisProject()
 {
     AssertChanges(Subject.GetChangesToApply(),
                   ApplicableChange.Update("file1.txt"));
 }
Пример #11
0
 public void OnlyAppliesChangesInsideTheProject()
 {
     AssertChanges(Subject.GetChangesToApply(),
                   ApplicableChange.Delete("startedinside.txt"),
                   ApplicableChange.Update("movedinside.txt"));
 }
Пример #12
0
 public void DoesNotApplyDeletedRenamedFile()
 {
     AssertChanges(Subject.GetChangesToApply(),
                   ApplicableChange.Delete("oldfile1.txt"));
 }
Пример #13
0
 private void Update(ApplicableChange change, IGitTreeModifier treeBuilder, ITfsWorkspace workspace, IDictionary <string, GitObject> initialTree)
 {
     treeBuilder.Add(change.GitPath, workspace.GetLocalPath(change.GitPath), change.Mode);
 }