How to check out Prevision revision

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

How to check out Prevision revision

by Tech Cool :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello Group,
                I am facing problem to check out previous revision. I am using following API method and it gives error

updateClient.doCheckout(url, destPath, SVNRevision.PREVIOUS , PREVIOUS , isRecursive);

regards,
TechCool

Re: How to check out Prevision revision

by Alexander Kitaev-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

SVNRevision.PREVIOUS makes no sense for doCheckout method - there is no
revision number to base upon at the moment of checkout. If you'd like to
check out revision HEAD-1, then you may get HEAD revision first:

SVNInfo info = SVNWCClient.doInfo(URL, SVNRevision.HEAD, SVNRevision.HEAD);
SVNRevision latestRev = info.getRevision();
SVNRevision previous;
if (latestRev.getNumber() > 0) {
     previous = SVNRevision.create(latestRev.getNumber() - 1);
} else {
     previous = latestRev; // in case latest repo revision is 0.
}

Then call doCheckout with "previous" revision.

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

Tech Cool wrote:

> Hello Group,
>                 I am facing problem to check out previous revision. I am
> using following API method and it gives error
>
> updateClient.doCheckout(url, destPath, SVNRevision.PREVIOUS , PREVIOUS ,
> isRecursive);
>
> regards,
> TechCool
>

Re: How to check out Prevision revision

by Tech Cool :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks a lot. It worked.

regards,
RB
Alexander Kitaev-3 wrote:
Hello,

SVNRevision.PREVIOUS makes no sense for doCheckout method - there is no
revision number to base upon at the moment of checkout. If you'd like to
check out revision HEAD-1, then you may get HEAD revision first:

SVNInfo info = SVNWCClient.doInfo(URL, SVNRevision.HEAD, SVNRevision.HEAD);
SVNRevision latestRev = info.getRevision();
SVNRevision previous;
if (latestRev.getNumber() > 0) {
     previous = SVNRevision.create(latestRev.getNumber() - 1);
} else {
     previous = latestRev; // in case latest repo revision is 0.
}

Then call doCheckout with "previous" revision.

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

Tech Cool wrote:
> Hello Group,
>                 I am facing problem to check out previous revision. I am
> using following API method and it gives error
>
> updateClient.doCheckout(url, destPath, SVNRevision.PREVIOUS , PREVIOUS ,
> isRecursive);
>
> regards,
> TechCool
>