SVNKit replacement for svnversion.exe

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

SVNKit replacement for svnversion.exe

MLoe
We determin the subversion version number of our grails application in the eventCompileStart by executing svnversion.exe of an locally installed subversion client.

Now we want to switch to the svnkit plugin, because we don't like to install the subversion client on each developer's maschine.

But what's the equivalent svnkit method?

wcClient.doInfo(baseFile, SVNRevision.WORKING) shows not the latest version.

SVNRepository needs authentification, which we don't want to implement in _Events.groovy.

Any ideas?

Thanks, Michael
Reply | Threaded
Open this post in threaded view
|

Re: SVNKit replacement for svnversion.exe

MLoe
I think i have iterate over all directories to get the latest used revision in my workingcopy like this:


        // initialise SVNKit
        DAVRepositoryFactory.setup();
        SVNRepositoryFactoryImpl.setup();
        FSRepositoryFactory.setup();

        SVNClientManager clientManager = SVNClientManager.newInstance();
        SVNWCClient wcClient = clientManager.getWCClient();

        // the svnkit equivalent of "svn info"
        File baseFile = new File(basedir);
        SVNInfo svninfo = wcClient.doInfo(baseFile, SVNRevision.WORKING);

        def revisions = []
        wcClient.doInfo(baseFile, null, null,  SVNDepth.INFINITY, null, {it -> revisions.add(it.revision.number)} as ISVNInfoHandler)
        new File("grails-app/views/_svnversion.gsp").text = revisions.max()

Reply | Threaded
Open this post in threaded view
|

Re: SVNKit replacement for svnversion.exe

basejump (Josh)
This works for us
import org.tmatesoft.svn.core.wc.SVNStatus
...
SVNStatus status = SVNClientManager.newInstance().getStatusClient().doStatus(new File('.'), false)
String url = status.getURL()
String revision = status.getCommittedRevision()

On Apr 16, 2012, at 8:40 AM, MLoe wrote:

I think i have iterate over all directories to get the latest used revision
in my workingcopy like this:


       // initialise SVNKit
       DAVRepositoryFactory.setup();
       SVNRepositoryFactoryImpl.setup();
       FSRepositoryFactory.setup();

       SVNClientManager clientManager = SVNClientManager.newInstance();
       SVNWCClient wcClient = clientManager.getWCClient();

       // the svnkit equivalent of "svn info"
       File baseFile = new File(basedir);
       SVNInfo svninfo = wcClient.doInfo(baseFile, SVNRevision.WORKING);

       def revisions = []
       wcClient.doInfo(baseFile, null, null,  SVNDepth.INFINITY, null, {it
-> revisions.add(it.revision.number)} as ISVNInfoHandler)
       new File("grails-app/views/_svnversion.gsp").text = revisions.max()



--
View this message in context: http://grails.1312388.n4.nabble.com/SVNKit-replacement-for-svnversion-exe-tp4551538p4561554.html
Sent from the Grails - user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|

Re: SVNKit replacement for svnversion.exe

MLoe
But this only works, if I updated the directory with subversion.
Without an update the directory might have an older revision.
svnversion shows much more information:

The version number will be a single number if the working
copy is single revision, unmodified, not switched and with
an URL that matches the TRAIL_URL argument.  If the working
copy is unusual the version number will be more complex:

 4123:4168     mixed revision working copy
 4168M         modified working copy
 4123S         switched working copy
 4123P         partial working copy, from a sparse checkout
 4123:4168MS   mixed revision, modified, switched working copy
Reply | Threaded
Open this post in threaded view
|

Re: SVNKit replacement for svnversion.exe

basejump (Josh)
Yes, What we have works for us 95% of the time for our subversion based apps so we have not burned much time trying to get it to work in all scenarios.
When it doesn't work we just manually force the rev number.

When or if you come up with a better way please share it to this thread.
---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: SVNKit replacement for svnversion.exe

simran siddique
In reply to this post by MLoe
Fix defect where the svnversion.exe files show error fix the problem of svnversion.exe when installing