You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by jantje <ja...@skynet.be> on 2008/07/03 16:01:51 UTC

Receive only the revision number

Hi there,

Is it possible, for use in a /bin/bash script, to receive from subversion
the current revision number? So only the number, without other information?

Thanks..
-- 
View this message in context: http://www.nabble.com/Receive-only-the-revision-number-tp18262376p18262376.html
Sent from the Subversion Users mailing list archive at Nabble.com.


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

Re: Receive only the revision number

Posted by jantje <ja...@skynet.be>.
thanks, this works nice!!!



Paul Koning-4 wrote:
> 
>>>>>> "jantje" == jantje  <ja...@skynet.be> writes:
> 
>  jantje> Hi there,
> 
>  jantje> Is it possible, for use in a /bin/bash script, to receive
>  jantje> from subversion the current revision number? So only the
>  jantje> number, without other information?
> 
> HEAD_REV=$(svn info ${REPO_URL} | awk '/Revision:/{print $2}')
> 
> If you do "svn info" to a working directory, you get the rev of the
> most recent checkout or update to that WD.  But if you do it to a
> repository URL you get the info for the repository.
> 
> 	   paul
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: users-help@subversion.tigris.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Receive-only-the-revision-number-tp18262376p18266616.html
Sent from the Subversion Users mailing list archive at Nabble.com.


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

RE: Receive only the revision number

Posted by Roger Lipscombe <ro...@1e.com>.
On Windows, using Cygwin, but probably fine on most Unix-like systems:

svn log --limit 1 . | head -2 | tail -1 | cut -d"|" -f 1 | cut -b2-

The use of double-quotes on the first "cut" is probably a cmd.exe oddity. Adjust for your shell.

For the working copy, you might be better off using svnversion.

Oh, and the bit you're missing: The working copy revision is only really brought up-to-date after an "svn update". That is: if you've never done an svn update on a working copy, it'll probably always return 1 as the revision number.

Cheers,
Roger.

-----Original Message-----
From: jantje [mailto:janvanoppen@skynet.be]
Sent: Fri 04 July 2008 14:13
To: users@subversion.tigris.org
Subject: Re: Receive only the revision number


Ok, it works fine, but now I have a problem:
When I commit, svn gives the rivision number.. f.i. 245

But when I do info in my local copy, or use to the repository url.. The
result is: revision number=1

How is it possible, that this revision number on the repository and on the
local copy is 1?

Can someone help me? Thanks..


Paul Koning-4 wrote:
>
>>>>>> "jantje" == jantje  <ja...@skynet.be> writes:
>
>  jantje> Hi there,
>
>  jantje> Is it possible, for use in a /bin/bash script, to receive
>  jantje> from subversion the current revision number? So only the
>  jantje> number, without other information?
>
> HEAD_REV=$(svn info ${REPO_URL} | awk '/Revision:/{print $2}')
>
> If you do "svn info" to a working directory, you get the rev of the
> most recent checkout or update to that WD.  But if you do it to a
> repository URL you get the info for the repository.
>
>          paul
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: users-help@subversion.tigris.org
>
>
>

--
View this message in context: http://www.nabble.com/Receive-only-the-revision-number-tp18262376p18279259.html
Sent from the Subversion Users mailing list archive at Nabble.com.


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



DISCLAIMER: This is a PRIVATE message. If you are not the intended recipient, please delete without copying and kindly advise us by e-mail of the mistake in delivery. NOTE: Regardless of content, this e-mail shall not operate to bind 1E Ltd to any order or other contract unless pursuant to explicit written agreement or government initiative expressly permitting the use of e-mail for such purpose

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


Re: Receive only the revision number

Posted by jantje <ja...@skynet.be>.
Ok, it works fine, but now I have a problem:
When I commit, svn gives the rivision number.. f.i. 245

But when I do info in my local copy, or use to the repository url.. The
result is: revision number=1

How is it possible, that this revision number on the repository and on the
local copy is 1?

Can someone help me? Thanks..


Paul Koning-4 wrote:
> 
>>>>>> "jantje" == jantje  <ja...@skynet.be> writes:
> 
>  jantje> Hi there,
> 
>  jantje> Is it possible, for use in a /bin/bash script, to receive
>  jantje> from subversion the current revision number? So only the
>  jantje> number, without other information?
> 
> HEAD_REV=$(svn info ${REPO_URL} | awk '/Revision:/{print $2}')
> 
> If you do "svn info" to a working directory, you get the rev of the
> most recent checkout or update to that WD.  But if you do it to a
> repository URL you get the info for the repository.
> 
> 	   paul
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: users-help@subversion.tigris.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Receive-only-the-revision-number-tp18262376p18279259.html
Sent from the Subversion Users mailing list archive at Nabble.com.


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

Re: Receive only the revision number

Posted by Paul Koning <Pa...@dell.com>.
>>>>> "jantje" == jantje  <ja...@skynet.be> writes:

 jantje> Hi there,

 jantje> Is it possible, for use in a /bin/bash script, to receive
 jantje> from subversion the current revision number? So only the
 jantje> number, without other information?

HEAD_REV=$(svn info ${REPO_URL} | awk '/Revision:/{print $2}')

If you do "svn info" to a working directory, you get the rev of the
most recent checkout or update to that WD.  But if you do it to a
repository URL you get the info for the repository.

	   paul


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