Esempio n. 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);
                }
            }
        }
Esempio n. 2
0
 public void DoesNotApplyBranchedFile()
 {
     AssertChanges(Subject.GetChangesToApply(),
                   ApplicableChange.Delete("oldfile10.txt"),
                   ApplicableChange.Update("file8.txt"),
                   ApplicableChange.Update("file9.txt"),
                   ApplicableChange.Update("file10.txt"));
 }
Esempio n. 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"));
 }
Esempio n. 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"));
 }
Esempio n. 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"));
 }
Esempio n. 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);
            }
        }
Esempio n. 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);
            }
        }
Esempio n. 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);
            }
        }
Esempio n. 9
0
 public void FetchesItemRenamedAfterDelete()
 {
     AssertChanges(Subject.GetChangesToApply(),
                   ApplicableChange.Update("file1.txt"));
 }
Esempio n. 10
0
 public void IncludesChangesInThisProject()
 {
     AssertChanges(Subject.GetChangesToApply(),
                   ApplicableChange.Update("file1.txt"));
 }
Esempio n. 11
0
 public void OnlyAppliesChangesInsideTheProject()
 {
     AssertChanges(Subject.GetChangesToApply(),
                   ApplicableChange.Delete("startedinside.txt"),
                   ApplicableChange.Update("movedinside.txt"));
 }
Esempio n. 12
0
 public void DoesNotApplyDeletedRenamedFile()
 {
     AssertChanges(Subject.GetChangesToApply(),
                   ApplicableChange.Delete("oldfile1.txt"));
 }
Esempio n. 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);
 }