From a37c643781f48b73aa8dbb2ab28390318d9b2ec7 Mon Sep 17 00:00:00 2001 From: Julia Beliaeva Date: Thu, 5 Apr 2018 12:50:26 +0300 Subject: [PATCH] [file-history, hg] calcCurrentRevisionNumber actually gets last revision for the file --- .../zmlx/hg4idea/provider/HgHistoryProvider.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/provider/HgHistoryProvider.java b/plugins/hg4idea/src/org/zmlx/hg4idea/provider/HgHistoryProvider.java index bb63e6107138..3d7d845ae968 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/provider/HgHistoryProvider.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/provider/HgHistoryProvider.java @@ -79,7 +79,7 @@ public class HgHistoryProvider implements VcsHistoryProvider { return null; } final List revisions = new ArrayList<>(getHistory(filePath, vcsRoot, myProject)); - return createAppendableSession(vcsRoot, revisions, null); + return createAppendableSession(vcsRoot, filePath, revisions, null); } public void reportAppendableHistory(FilePath filePath, final VcsAppendableHistorySessionPartner partner) throws VcsException { @@ -88,7 +88,7 @@ public class HgHistoryProvider implements VcsHistoryProvider { final List history = getHistory(filePath, vcsRoot, myProject); if (history.size() == 0) return; - final VcsAbstractHistorySession emptySession = createAppendableSession(vcsRoot, Collections.emptyList(), null); + final VcsAbstractHistorySession emptySession = createAppendableSession(vcsRoot, filePath, Collections.emptyList(), null); partner.reportCreatedEmptySession(emptySession); for (HgFileRevision hgFileRevision : history) { @@ -97,11 +97,15 @@ public class HgHistoryProvider implements VcsHistoryProvider { partner.finished(); } - private VcsAbstractHistorySession createAppendableSession(final VirtualFile vcsRoot, List revisions, @Nullable VcsRevisionNumber number) { + @NotNull + private VcsAbstractHistorySession createAppendableSession(@NotNull VirtualFile vcsRoot, + @NotNull FilePath filePath, + @NotNull List revisions, + @Nullable VcsRevisionNumber number) { return new VcsAbstractHistorySession(revisions, number) { @Nullable protected VcsRevisionNumber calcCurrentRevisionNumber() { - return new HgWorkingCopyRevisionsCommand(myProject).firstParent(vcsRoot); + return new HgWorkingCopyRevisionsCommand(myProject).parents(vcsRoot, filePath).first; } public HistoryAsTreeProvider getHistoryAsTreeProvider() { @@ -110,7 +114,7 @@ public class HgHistoryProvider implements VcsHistoryProvider { @Override public VcsHistorySession copy() { - return createAppendableSession(vcsRoot, getRevisionList(), getCurrentRevisionNumber()); + return createAppendableSession(vcsRoot, filePath, getRevisionList(), getCurrentRevisionNumber()); } }; }