Fastest way to retrieve VcsRevisionNumber

Hi,

I am looking for the fastest way to retrieve the current VCS revision number for a given file.

In my reVu plugin, I use com.intellij.openapi.vcs.diff.DiffProvider#getCurrentRevision(VirtualFile) method, but this is based on VCS implementation which call their internal service to retrieve this number. Since I want to apply a filter on project files based on a range of revisions, this may be a huge operation for large projects.

I wish I could find a way to retrieve these revision numbers from a local cache maintained in Idea, could someone confirm this is not available ?

Thanks

Sylvain

2 comments
Comment actions Permalink

Hello Sylvain,

ChangelistManager.getChange(VirtualFile).getBeforeRevision().getRevisionNumber()

(with appropriate null checks added, of course)

This works for modified files; IDEA doesn't keep track of the version number
for files which aren't modified.

I am looking for the fastest way to retrieve the current VCS revision
number for a given file.

In my http://plugins.intellij.net/plugin/?idea&id=3849plugin, I use
com.intellij.openapi.vcs.diff.DiffProvider#getCurrentRevision(VirtualF
ile) method, but this is based on VCS implementation which call their
internal service to retrieve this number. Since I want to apply a
filter on project files based on a range of revisions, this may be a
huge operation for large projects.

I wish I could find a way to retrieve these revision numbers from a
local cache maintained in Idea, could someone confirm this is not
available ?


--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0
Comment actions Permalink

OK, thanks for confirmation Dmitry.

Sylvain

0

Please sign in to leave a comment.