use of com.intellij.openapi.vcs.diff.ItemLatestState in project intellij-community by JetBrains.
the class HgDiffProvider method getLastRevision.
public ItemLatestState getLastRevision(VirtualFile file) {
VirtualFile vcsRoot = VcsUtil.getVcsRootFor(project, file);
if (vcsRoot == null) {
return null;
}
HgRevisionNumber revision = (HgRevisionNumber) getCurrentRevision(file);
if (revision == null) {
return null;
}
return new ItemLatestState(revision, file.exists(), true);
}
use of com.intellij.openapi.vcs.diff.ItemLatestState in project intellij-community by JetBrains.
the class GitHistoryUtilsTest method testGetLastRevisionForNonExistingFile.
public void testGetLastRevisionForNonExistingFile() throws Exception {
git("remote add origin git://example.com/repo.git");
git("config branch.master.remote origin");
git("config branch.master.merge refs/heads/master");
git("rm " + bfile.getPath());
commit("removed bfile");
String[] hashAndDate = log("--pretty=format:%H#%ct", "-n1").split("#");
// to avoid pushing to this fake origin
git("update-ref refs/remotes/origin/master HEAD");
touch("dir/b.txt", "content");
addCommit("recreated bfile");
refresh();
myRepo.update();
final ItemLatestState state = GitHistoryUtils.getLastRevision(myProject, toFilePath(bfile));
assertTrue(!state.isItemExists());
final GitRevisionNumber revisionNumber = (GitRevisionNumber) state.getNumber();
assertEquals(revisionNumber.getRev(), hashAndDate[0]);
assertEquals(revisionNumber.getTimestamp(), GitTestRevision.gitTimeStampToDate(hashAndDate[1]));
}
Aggregations