Question on paths

View: New views
2 Messages — Rating Filter:   Alert me  

Question on paths

by David Honey-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


I have recently started looking at SVNKit, using version 1.30 with SVN 1.6.2.
As a newbie, this might all seem obvious, but I couldn't see this on the nabble forum or described in the Javadoc.

I was trying a program that used SVNRepository.getFile to get the SVNProperties of a file in an SVN repository. For example, the URL for this would be svn://honeylinux/test/trunk/hello.txt where the SVN repository hosted on honeylinux is named test. I can use an SVN client to show the info using this URL. However, SVNRepository.getFile reports that it cannot identify the object on this URL. If I create an SVNURL for this path, and then use getPath, it returns a path of "/test/trunk/hello.txt". However, SVNRepository.getFile doesn't work with that path either. It does work with "/trunk/hello.txt" and gets the expected properties that match what svn info  shows.  I cannot see any method that returns a path from the URL that SVNRepository.getFile would accept.

Is this a defect?

If not, why? And what is the recommended platform-independent way of getting a path from a URL that SVNRepository.getFile will accept?

Thanks,
David.





Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU







Re: Question on paths

by Alexander Sinyushkin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello David,

SVNURL.getPath() includes also path to the repository itself,
but SVNRepository methods accept only repository root relative paths, .i.e.
/ meant repository root and so on.

If you know the url of the file, you can use it to create an
SVNRepository object,
and then simply call SVNRepository.getFile("", ...) that will get you
the file you want.

Paths which you pass to SVNRepository methods and which are sent to a
repository are formed according to the following rule:

 - if a path starts with '/', then it's an absolute repository path..
and request is send directly for
   this path

 - ohterwise, it's a path relative to the SVNRepository location and
request is sent for the appended path:
   i.e. SVNRepository.locationPath + '/' + path.


----
Alexander Sinyushkin,
TMate Software,
http://svnkit.com/ - Java [Sub]Versioning Library!



David Honey wrote:

>
> I have recently started looking at SVNKit, using version 1.30 with SVN
> 1.6.2.
> As a newbie, this might all seem obvious, but I couldn't see this on
> the nabble forum or described in the Javadoc.
>
> I was trying a program that used /SVNRepository.getFile/ to get the
> /SVNProperties/ of a file in an SVN repository. For example, the URL
> for this would be svn://honeylinux/test/trunk/hello.txt where the SVN
> repository hosted on honeylinux is named test. I can use an SVN client
> to show the info using this URL. However, /SVNRepository.getFile/
> reports that it cannot identify the object on this URL. If I create an
> SVNURL for this path, and then use /getPath/, it returns a path of
> "/test/trunk/hello.txt". However, /SVNRepository.getFile/ doesn't work
> with that path either. It does work with "/trunk/hello.txt" and gets
> the expected properties that match what /svn info / shows.  I cannot
> see any method that returns a path from the URL that
> /SVNRepository.getFile/ would accept.
>
> Is this a defect?
>
> If not, why? And what is the recommended platform-independent way of
> getting a path from a URL that /SVNRepository.getFile/ will accept?
>
> Thanks,
> David.
>
>
> ------------------------------------------------------------------------
>
> /
> /
>
> /Unless stated otherwise above:
> IBM United Kingdom Limited - Registered in England and Wales with
> number 741598.
> Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6
> 3AU/
>
>
>
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: svnkit-users-unsubscribe@...
For additional commands, e-mail: svnkit-users-help@...