0

I would like to know for a specific local workspace file, the corresponding svn reposity path. My files are extracted from multiple repository, and placed in different projects of my eclipse workspace. Right clicking on them, selecting properties -> Subversion -> Url I can read the path I'm looking for.

I need to read this path with java class. I think some information are stored in an hidden .svn folder contained in the root of each project.

Can anyone tell me from where subclipse read the svn path of each file (or how build it)..

Later I will use svnkit to automatically make some operation on file of my workspace, using that information. But I would like to get the svnpath of any file, dinamically.

Thank you!

Francesco
  • 315
  • 1
  • 3
  • 13
  • There are some hidden files that are created when you checkout the project. one of them is .project file I think you want to check that file. – StackFlowed Sep 05 '14 at 15:27

2 Answers2

1

You need to use SVN API and call svn info on the local resource. The result will contain all that information.

Mark Phippard
  • 10,329
  • 2
  • 32
  • 42
0

I solved with this simplified (without try/catch and no control on nullpointer...) code: (Using SVNKit)

public static long getWorkingCopyRevisionNumber (String localpath)  {

        SVNStatus status = getWorkingStatus (localpath);
        Long revNum = status.getCommittedRevision().getNumber();
        return revNum;
}



public static SVNStatus getWorkingStatus (String localpath)  {

        SVNStatusClient statusClient = SVNClientManager.newInstance().getStatusClient();
        File f = new File(localpath);
        SVNStatus status = statusClient.doStatus(  f, false);
        return status;
}
Francesco
  • 315
  • 1
  • 3
  • 13