You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Rob Hills <ro...@netpaver.com.au> on 2004/10/11 02:51:12 UTC

getting a repository's latest revision

Hi All,

I use ant scripts to build our applications for release.  As part of this process, source 
code is exported from the repository to a temporary directory and built.

In my ant script, this process often involves getting files from several different areas of 
our repository and hence involves several "export" operations.  To ensure I get a 
consistent build, I use the same revision number for all my exports.

However, I've not been able to find any way of getting the "latest" revision number of 
a repository without at least exporting one file from it.  I've looked at the "svn info" 
command, but this operates against a working copy which won't necessarily be 
present on the build machine.  So, for now, I do an export, parse its output for the 
revision number and then use that revision number for subsequent exports.  It works, 
but I find it a bit messy and it is of course subject to any changes in the formatting of 
the output from the export command.

I guess what I'm looking for is a kind of "svn revision URL" command that returns the 
latest revision of the specified url without needing a local client working copy.  
Alternatively perhaps, allow the "svn status" command to take a URL instead of a 
local path and then return appropriate values for that URL.

Cheers,

Rob Hills
MBBS, Grad Dip Com Stud, MACS
Senior Consultant
Netpaver Web Solutions
Tel:	(08) 9485 2555
Mob:	(0412) 904 357
Fax:	(08) 9485 2555



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: getting a repository's latest revision

Posted by Rob Hills <ro...@netpaver.com.au>.
<?xml  version="1.0" ?><html>
<head>
<title></title>
</head>
<body>
<div align="left"><font face="Arial"><span style="font-size:10pt">Hi Jani,</span></font></div>
<div align="left"><br/></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">On 10 Oct 2004 at 23:09, Jani Averbach wrote:</span></font></div>
<div align="left"><br/>
</div>
<div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">&gt; On 2004-10-11 10:51+0800, Rob Hills wrote:</span></font></div>
<div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">&gt; </span></font></div>
<div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">&gt; &gt; However, I've not been able to find any way of getting the &quot;latest&quot; revision 
number of </span></font></div>
<div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">&gt; &gt; a repository without at least exporting one file from it. </span></font></div>
<div align="left"><br/>
</div>
<div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">&gt; svn log -r head URL</span></font></div>
<div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">&gt; </span></font></div>
<div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">&gt; gives you an entry like:</span></font></div>
<div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">&gt; </span></font></div>
<div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">&gt; ------------------------------------------------------------------------</span></font></div>
<div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">&gt; r11306 | hynnet | 2004-10-10 18:41:38 -0600 (Sun, 10 Oct 2004) | 1 line</span></font></div>
<div align="left"><br/></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">Interestingly, all I get is:</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">------------------------------------------------------------------------</span></font></div>
<div align="left"><br/>
</div>
<div align="left"><font face="Arial"><span style="font-size:10pt">ie, the dashed line with an empty CR after it :-(&#160; FWIW, in our repository, we enforce a 
log entry with every commit.</span></font></div>
<div align="left"><br/>
</div>
<div align="left"><font face="Arial"><span style="font-size:10pt">Not sure why we don't get the release number etc.&#160; Otherwise, this solution could be 
a goer.</span></font></div>
<div align="left"><br/>
</div>
<div align="left"><font face="Arial"><span style="font-size:10pt">cheers,</span></font></div>
<div align="left"><br/>
</div>
<div align="left"><br/>
</div>
<div align="left"><font face="Arial"><span style="font-size:10pt">Rob Hills</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">MBBS, Grad Dip Com Stud, MACS</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">Senior Consultant</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">Netpaver Web Solutions</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">Tel:&#160;&#160;&#160;&#160;&#160;&#160;(08) 9485 2555</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">Mob:&#160;&#160;&#160;&#160;(0412) 904 357</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">Fax:&#160;&#160;&#160;&#160;&#160;(08) 9485 2555</span></font></div>
<div align="left"><br/>
</div>
<div align="left"></div>
</body>
</html>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: getting a repository's latest revision

Posted by Mike Mason <mg...@thoughtworks.net>.
Rob Hills wrote:

>Hi All,
>
>I use ant scripts to build our applications for release.  As part of this process, source 
>code is exported from the repository to a temporary directory and built.
>
>In my ant script, this process often involves getting files from several different areas of 
>our repository and hence involves several "export" operations.  To ensure I get a 
>consistent build, I use the same revision number for all my exports.
>  
>

Other folks have suggested how you might find that revision number, but 
you could also try using svn:externals. This allows you to pull 
different bits of your repository (or even multiple repositories) into a 
single directory. There are minor wrinkles if you want to make changes 
and commit them, but it sounds like you just want to do a build and not 
commit anything back.

The book has more: http://svnbook.red-bean.com/svnbook-1.0/ch07s03.html

Cheers,
Mike.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: getting a repository's latest revision

Posted by Christopher Ness <ch...@nesser.org>.
On Sun, 2004-10-10 at 22:51, Rob Hills wrote:
> Hi All,
> 
> I use ant scripts to build our applications for release.  As part of this process, source 
> code is exported from the repository to a temporary directory and built.
> 
> In my ant script, this process often involves getting files from several different areas of 
> our repository and hence involves several "export" operations.  To ensure I get a 
> consistent build, I use the same revision number for all my exports.
> 
> However, I've not been able to find any way of getting the "latest" revision number of 
> a repository without at least exporting one file from it.  I've looked at the "svn info" 
> command, but this operates against a working copy which won't necessarily be 
> present on the build machine.  So, for now, I do an export, parse its output for the 
> revision number and then use that revision number for subsequent exports.  It works, 
> but I find it a bit messy and it is of course subject to any changes in the formatting of 
> the output from the export command.
> 
> I guess what I'm looking for is a kind of "svn revision URL" command that returns the 
> latest revision of the specified url without needing a local client working copy.  
> Alternatively perhaps, allow the "svn status" command to take a URL instead of a 
> local path and then return appropriate values for that URL.

Why not just check out all the projects at once by making a list of them
in the arguments.  

  svn co -r "HEAD" http://websvn.your.domain/trunk/proj1 \
  http://websvn.your.domain/trunk/proj2 etc.....

I'm not sure if this will check out the same version of "HEAD" if
someone checks in a change to a project during the checkout command's
runtime.  Maybe someone else can clear that up if svn's commands are
atomic.

If "HEAD" can change during your check out.  You could check out one
project, find the repository version number using Steve Williams method
or the `svnversion` program and then check out the rest of the projects
using that as the -r argument.

I think that should do it.
Cheers,
Chris
-- 
Software Engineering IV,
McMaster University
PGP Public Key: http://www.nesser.org/pgp-key/
22:56:29 up 6 min, 2 users, load average: 0.07, 0.41, 0.24 
http://www.fsf.org/philosophy/no-word-attachments.html

Re: getting a repository's latest revision

Posted by Dirk Hoffmann <dh...@web.de>.
Hi Rob,

I had the same problem but with the java binding not the commandline client.

Meanwhile I learned how to extend the libsvn_client API and the 
commandline client. The latter to make debugging easier.

If you are willing to do some C programming I can give you some pointers 
on how to make the command line client do what you want.

Regards,
Dirk

Rob Hills wrote:

>Hi All,
>
>I use ant scripts to build our applications for release.  As part of this process, source 
>code is exported from the repository to a temporary directory and built.
>
>In my ant script, this process often involves getting files from several different areas of 
>our repository and hence involves several "export" operations.  To ensure I get a 
>consistent build, I use the same revision number for all my exports.
>
>However, I've not been able to find any way of getting the "latest" revision number of 
>a repository without at least exporting one file from it.  I've looked at the "svn info" 
>command, but this operates against a working copy which won't necessarily be 
>present on the build machine.  So, for now, I do an export, parse its output for the 
>revision number and then use that revision number for subsequent exports.  It works, 
>but I find it a bit messy and it is of course subject to any changes in the formatting of 
>the output from the export command.
>
>I guess what I'm looking for is a kind of "svn revision URL" command that returns the 
>latest revision of the specified url without needing a local client working copy.  
>Alternatively perhaps, allow the "svn status" command to take a URL instead of a 
>local path and then return appropriate values for that URL.
>
>Cheers,
>
>Rob Hills
>MBBS, Grad Dip Com Stud, MACS
>Senior Consultant
>Netpaver Web Solutions
>Tel:	(08) 9485 2555
>Mob:	(0412) 904 357
>Fax:	(08) 9485 2555
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
>For additional commands, e-mail: users-help@subversion.tigris.org
>
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: getting a repository's latest revision

Posted by Rob Hills <ro...@netpaver.com.au>.
Hi Steve,

On 11 Oct 2004 at 13:00, Steve Williams wrote:

> svn ls -v URL
> gives you the latest revision of the URL without a local working copy.

Thanks for the quick reply - I was not aware of that nuance of the use of the list 
command, though it's there in the documentation once you know.  However, when I 
tried it against one of our project URLs, it returned a list of all the subfolders under it 
with the latest revision of each.  Parsing that in Ant would be tricky :-(.  I tried the -N (-
-non-recursive) switch, but the list command won't take that.

> > I guess what I'm looking for is a kind of "svn revision URL" command
> > that returns the  latest revision of the specified url without needing
> > a local client working copy.  Alternatively perhaps, allow the "svn
> > status" command to take a URL instead of a  local path and then return
> > appropriate values for that URL. 

Thanks again,

Rob Hills
MBBS, Grad Dip Com Stud, MACS
Senior Consultant
Netpaver Web Solutions
Tel:	(08) 9485 2555
Mob:	(0412) 904 357
Fax:	(08) 9485 2555



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: getting a repository's latest revision

Posted by Steve Williams <st...@kromestudios.com>.
svn ls -v URL
gives you the latest revision of the URL without a local working copy.

Sly

> I guess what I'm looking for is a kind of "svn revision URL" command that
returns the
> latest revision of the specified url without needing a local client
working copy.
> Alternatively perhaps, allow the "svn status" command to take a URL
instead of a
> local path and then return appropriate values for that URL.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: getting a repository's latest revision

Posted by Jani Averbach <ja...@jaa.iki.fi>.
On 2004-10-11 10:51+0800, Rob Hills wrote:
> Hi All,
> 

> However, I've not been able to find any way of getting the "latest" revision number of 
> a repository without at least exporting one file from it. 

svn log -r head URL

gives you an entry like:

------------------------------------------------------------------------
r11306 | hynnet | 2004-10-10 18:41:38 -0600 (Sun, 10 Oct 2004) | 1 line

Simplified Chinese translation added by YingNing Huang <hyn hynnet com>
------------------------------------------------------------------------

Br, Jani

-- 
Jani Averbach


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org