public static string changeType(this DiffEntry diffEntry) { if (diffEntry.notNull()) { return(diffEntry.GetChangeType().str()); } return(null); }
private static RevisionEntryInfo ConvertToRevisionEntryInfo(DiffEntry difference) { var path = Path(difference); var revisionEntryInfo = new RevisionEntryInfo { Path = path, Action = GetAction(difference.GetChangeType()) }; return(revisionEntryInfo); }
public virtual void TestNoOutputStreamSet() { FilePath file = WriteTrashFile("test.txt", "a"); NUnit.Framework.Assert.IsTrue(file.SetLastModified(file.LastModified() - 5000)); Git git = new Git(db); git.Add().AddFilepattern(".").Call(); Write(file, "b"); IList <DiffEntry> diffs = git.Diff().Call(); NUnit.Framework.Assert.IsNotNull(diffs); NUnit.Framework.Assert.AreEqual(1, diffs.Count); DiffEntry diff = diffs[0]; NUnit.Framework.Assert.AreEqual(DiffEntry.ChangeType.MODIFY, diff.GetChangeType() ); NUnit.Framework.Assert.AreEqual("test.txt", diff.GetOldPath()); NUnit.Framework.Assert.AreEqual("test.txt", diff.GetNewPath()); }
private static string Path(DiffEntry difference) { switch (difference.GetChangeType()) { case DiffEntry.ChangeType.ADD: return(difference.GetNewPath()); case DiffEntry.ChangeType.COPY: return(string.Format("{0} -> {1}", difference.GetOldPath(), difference.GetNewPath())); case DiffEntry.ChangeType.DELETE: return(difference.GetOldPath()); case DiffEntry.ChangeType.MODIFY: return(difference.GetOldPath()); case DiffEntry.ChangeType.RENAME: return(string.Format("{0} -> {1}", difference.GetOldPath(), difference.GetNewPath())); default: return(difference.ToString()); } }
private static bool IsRename(DiffEntry ent) { return(ent.GetChangeType() == DiffEntry.ChangeType.RENAME || ent.GetChangeType() == DiffEntry.ChangeType.COPY); }