I’m trying to determine the exact absolute path of the local file from only having available the absolute path from the SVN. The whole idea is that I’m writing an eclipse plugin that from knowing the URL to a file in the SVN you could click a row and the corresponding file locally from within eclipse would be opened.
Where I’m running into difficulty is trying to determine exactly where the SVN path ends and the actual file begins locally. Let me give an actual example to demonstrate.
Let’s say the absolute URL to the file in the SVN is:
That same file can be found in eclipse at this location on the users computer:
C:\Users\Steve\workspace\Jira Plugins\Sentinel2Jirav4\sentinel2jirav4\src\main\java\com\whitehatsecurity\jira\configurations\IPluginConfigurationSettings.java
There are some differences for sure in the structures of the paths.
You see how in the SVN the URL is:
/svn/discovery/sentinel2jirav4/
The local path from eclipse is:
\Jira Plugins\Sentinel2Jirav4\sentinel2jirav4\
It looks like I may be able to have a preference page where I have the user add the path to the svn so like: /svn/discovery/
Therefore every absolute URL I get from the SVN would then be chopped off all the way to /svn/discovery.
Is there a better way to correlate the SVN path to its path locally? Does the SVN store that local path info?
First, you should read about local structure of svn (
.svnfolder andentriesfile inside .svn folder), that obtained in result ofcheckoutSecond, you need to parse .svn/entries for all folders inside you %WORKSPACE%.
After that you would exactly know relation between local folder and url in the SVN
For instance:
src/main/java/com/whitehatsecurity/jira/configurations/IPluginConfigurationSettings.javainside root folder
srcshould be folder named.svn, in which should be located fileentries. Inside of file.svn/entriesshould be following lines:Or you can just run
svn info C:\Users\Steve\workspace\Jira Plugins\Sentinel2Jirav4\sentinel2jirav4\srcfor each folder, which contains.svninside.And as a result get something like