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); } } }
public void DoesNotApplyBranchedFile() { AssertChanges(Subject.GetChangesToApply(), ApplicableChange.Delete("oldfile10.txt"), ApplicableChange.Update("file8.txt"), ApplicableChange.Update("file9.txt"), ApplicableChange.Update("file10.txt")); }
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")); }
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")); }
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")); }
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); } }
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); } }
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); } }
public void FetchesItemRenamedAfterDelete() { AssertChanges(Subject.GetChangesToApply(), ApplicableChange.Update("file1.txt")); }
public void IncludesChangesInThisProject() { AssertChanges(Subject.GetChangesToApply(), ApplicableChange.Update("file1.txt")); }
public void OnlyAppliesChangesInsideTheProject() { AssertChanges(Subject.GetChangesToApply(), ApplicableChange.Delete("startedinside.txt"), ApplicableChange.Update("movedinside.txt")); }
public void DoesNotApplyDeletedRenamedFile() { AssertChanges(Subject.GetChangesToApply(), ApplicableChange.Delete("oldfile1.txt")); }
private void Update(ApplicableChange change, IGitTreeModifier treeBuilder, ITfsWorkspace workspace, IDictionary <string, GitObject> initialTree) { treeBuilder.Add(change.GitPath, workspace.GetLocalPath(change.GitPath), change.Mode); }