You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by edA-qa <ed...@disemia.com> on 2004/12/16 14:39:58 UTC

Commiting file which contains the next revision number

Is there a way to either get the next revision number, or better, to 
specify a tag in a file such than when the file is committed the tag is 
replaced with the revision in which it was commited.

By Example:
File <changes.txt>
	-Added support for x ($NextRevision$)

Stored file:
	-Added support for x (348)

I need/want this since I have (as shown) a changes log that I would like 
to track the revision number each change is made in (of course if do a 
commit first to get a number, then I need to recommit to store that 
number for the changes file).

I've tried searching through the archives, but I can't think of the 
keywords to sort out what I want (so many posts with "revision" in them).

-- 
edA-qa mort-ora-y
Idea Architect
http://disemia.com/


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

Re: Commiting file which contains the next revision number

Posted by Patrick Smears <pa...@ensoft.co.uk>.
On Thu, 16 Dec 2004, Greg Thomas wrote:

> On Thu, 16 Dec 2004 15:39:58 +0100, edA-qa <ed...@disemia.com> wrote:
> 
> >Is there a way to ...
> >specify a tag in a file such than when the file is committed the tag is 
> >replaced with the revision in which it was commited.
> 
> Isn't that what the LastChangedRevision/Revision/Rev keyword is for?
> 
> http://svnbook.red-bean.com/en/1.0/ch07s02.html#svn-ch-7-sect-2.3.4
> 
> When the file is committed, the keyword will be updated with the
> revision number of that commit.

Yes... but then it will be updated next time the file is committed, too (I 
think what edA-qa is asking for is a way to have the revision number that 
a bugfix/feature is introduced mentioned in a "release notes" file, 
updating the "release notes" in the same commit as the bugfix/feature goes 
in.

If there is not a requirement for this to go in at the exact same commit,
(eg it may be acceptable to run a script to update the release notes just
before doing a release), then it might be worth considering writing a
script that can generate the release notes from the output of 'svn log'
(you could put specially-formatted comments in the log messages to
indicate that they should be turned into release notes; or indeed I 
suppose you could have a separate revision-property for each commit that 
specifies the release notes associated with that commit...)

Patrick
-- 
The easy way to type accents in Windows: http://www.frkeys.com/


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

Re: Commiting file which contains the next revision number

Posted by Greg Thomas <th...@omc.bt.co.uk>.
On Thu, 16 Dec 2004 15:39:58 +0100, edA-qa <ed...@disemia.com> wrote:

>Is there a way to ...
>specify a tag in a file such than when the file is committed the tag is 
>replaced with the revision in which it was commited.

Isn't that what the LastChangedRevision/Revision/Rev keyword is for?

http://svnbook.red-bean.com/en/1.0/ch07s02.html#svn-ch-7-sect-2.3.4

When the file is committed, the keyword will be updated with the
revision number of that commit.

Greg
-- 
This post represents the views of the author and does
not necessarily accurately represent the views of BT.

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

Re: Commiting file which contains the next revision number

Posted by Max Bowsher <ma...@ukf.net>.
Daniel Jackson wrote:
> The just-committed revision appears to be passed as an argument to the
> post-commit script.  It should be fairly easy to write a script to do
> this from post-commit.

You can't go back and change the text of something that's already committed.
So, you still need 2 revisions.

You could automate the second commit, though.

Max.

> Quoting Max Bowsher <ma...@ukf.net>:
>
>> edA-qa wrote:
>>> Is there a way to either get the next revision number, or better, to
>>> specify a tag in a file such than when the file is committed the tag is
>>> replaced with the revision in which it was commited.
>>>
>>> By Example:
>>> File <changes.txt>
>>> -Added support for x ($NextRevision$)
>>>
>>> Stored file:
>>> -Added support for x (348)
>>>
>>> I need/want this since I have (as shown) a changes log that I would like
>>> to track the revision number each change is made in (of course if do a
>>> commit first to get a number, then I need to recommit to store that
>>> number for the changes file).
>>>
>>> I've tried searching through the archives, but I can't think of the
>>> keywords to sort out what I want (so many posts with "revision" in 
>>> them).
>>
>> Sorry, such a feature does not exist. Indeed, it would be pretty much
>>
>> impossible to implement within the current architecture of
>> Subversion, since
>> the final revision number is not known until *after* the new file
>> data has
>> been written into the repository.
>>
>> Max.
>>
>>
>> ---------------------------------------------------------------------
>> 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 


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

Re: Commiting file which contains the next revision number

Posted by Daniel Jackson <da...@email.unc.edu>.
Let's try again.  I think I clicked the wrong thing and send before I 
was ready.

The original poster wants this at the end:

     line 1  (1)
     line 2  (2)

Using $Rev$ will produce this, I think:

     line 1  (2)
     line 2  (2)

Daniel


Quoting Ben Collins-Sussman <su...@collab.net>:

> >>
> >>> Is there a way to either get the next revision number, or
> better,
> >> to
> >>> specify a tag in a file such than when the file is committed the
> >> tag is
> >>> replaced with the revision in which it was commited.
> >>>
> 
> I don't understand why this thread is full of so much confusion.
> 
> The definition above sounds *exactly* like the definition of the
> $Rev$ 
> keyword.  Just use it!
> 
> 
> 
> ---------------------------------------------------------------------
> 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: Commiting file which contains the next revision number

Posted by Jeff Urlwin <ju...@esoftmatic.com>.
> 
> On 2004-12-16 12:43-0600, Ben Collins-Sussman wrote:
> > >>
> > >>>Is there a way to either get the next revision number, or better,
> > >>to
> > >>>specify a tag in a file such than when the file is committed the
> > >>tag is
> > >>>replaced with the revision in which it was commited.
> > >>>
> > 
> > I don't understand why this thread is full of so much confusion.
> 
> =)
> 
> > The definition above sounds *exactly* like the definition 
> of the $Rev$
> > keyword.  Just use it!
> 
> Well, the original poster asked something like that:
> 
> ChangeLog
> * foo fixed in r42
> * bar fided in r21
> * barf fixed in r2
> 
> So it $Rev$ is out of the picture.

Well, not really.  While $NextRev$ may sound convenient (which it would be), I would want
it to do this:

Changes.txt
* foo fixed in Rev: $NextRevOneTimeOnly$

After checkin of Changes.txt:

* foo fixed in Rev: 3

But, since I'd have to edit Changes.txt again for the next log message, I would:

* bar fixed in Rev: $NextRevOneTimeOnly$
* foo fixed in Rev: 3


Since, you'll probably keep a running edit on the Changes file, what you can do now is:

* foo fixed in Rev: $Revision$

And, after commit, go and edit

* foo fixed in Rev: $Revision 5$
To
* foo fixed in Rev: 5

Then publish the version.

But it would be nice to have a method to do it cleanly.

For an example, see Tim Bunce's DBD-Oracle Changes file here:
http://svn.perl.org/modules/dbd-oracle/trunk/Changes )


So, you can see that Tim, for example, tracks the rev # for each release to the public.
He's got the NNN as a place holder while he's checking it in during development, but
later, he'll change that to a Rev # (after the fact, of course or by guessing.)  You
manually have to "guess" the number as you are checking in or, you check in r5 and then go
back and edit changes file and indicate r5 (which becomes r6 when you check it in...)

Jeff




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


Re: Commiting file which contains the next revision number

Posted by Jani Averbach <ja...@jaa.iki.fi>.
On 2004-12-16 12:43-0600, Ben Collins-Sussman wrote:
> >>
> >>>Is there a way to either get the next revision number, or better,
> >>to
> >>>specify a tag in a file such than when the file is committed the
> >>tag is
> >>>replaced with the revision in which it was commited.
> >>>
> 
> I don't understand why this thread is full of so much confusion.

=)

> The definition above sounds *exactly* like the definition of the $Rev$ 
> keyword.  Just use it!

Well, the original poster asked something like that:

ChangeLog
* foo fixed in r42
* bar fided in r21
* barf fixed in r2

So it $Rev$ is out of the picture.

This thread is a some kind of variation (one-time-shot) of this FAQ:
http://subversion.tigris.org/project_faq.html#version-value-in-source

BR, Jani

-- 
Jani Averbach


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

Re: Commiting file which contains the next revision number

Posted by Ben Collins-Sussman <su...@collab.net>.
[keeping this on the users@ list]

On Dec 16, 2004, at 12:51 PM, Daniel Jackson wrote:

> Ben,
>
> If I have a file with this:
>
>      line1 - $Rev$
>
> Then I commit and update it as revision 1.
>
> Then I edit it so it looks like this:
>
>      line1 - 1
>      line2 - $Rev$
>
> Then I commit and update it as revision 2.
>
> Don't I get this:
>
>

[sussman@BenBook:~/scratch]$ svnadmin create repos
[sussman@BenBook:~/scratch]$ svn co file://`pwd`/repos wc
Checked out revision 0.
[sussman@BenBook:~/scratch]$ cd wc
[sussman@BenBook:~/scratch/wc]$ echo "\$Rev:\$" > file
[sussman@BenBook:~/scratch/wc]$ svn add file
A         file
[sussman@BenBook:~/scratch/wc]$ svn propset svn:keywords Revision file
property 'svn:keywords' set on 'file'
[sussman@BenBook:~/scratch/wc]$ cat file
$Rev$
[sussman@BenBook:~/scratch/wc]$ svn ci -m "add file"
Adding         file
Transmitting file data .
Committed revision 1.
[sussman@BenBook:~/scratch/wc]$ cat file
$Rev: 1 $
[sussman@BenBook:~/scratch/wc]$ echo "new text" >> file
[sussman@BenBook:~/scratch/wc]$ cat file
$Rev: 1 $
new text
[sussman@BenBook:~/scratch/wc]$ svn ci -m "commit again"
Sending        file
Transmitting file data .
Committed revision 2.
[sussman@BenBook:~/scratch/wc]$ cat file
$Rev: 2 $
new text


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

Re: Commiting file which contains the next revision number

Posted by Ben Collins-Sussman <su...@collab.net>.
>> 
>>> Is there a way to either get the next revision number, or better,
>> to
>>> specify a tag in a file such than when the file is committed the
>> tag is
>>> replaced with the revision in which it was commited.
>>>

I don't understand why this thread is full of so much confusion.

The definition above sounds *exactly* like the definition of the $Rev$ 
keyword.  Just use it!



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

Re: Commiting file which contains the next revision number

Posted by Daniel Jackson <da...@email.unc.edu>.
The just-committed revision appears to be passed as an argument to the 
post-commit script.  It should be fairly easy to write a script to do 
this from post-commit.

Daniel

Quoting Max Bowsher <ma...@ukf.net>:

> edA-qa wrote:
> > Is there a way to either get the next revision number, or better,
> to
> > specify a tag in a file such than when the file is committed the
> tag is
> > replaced with the revision in which it was commited.
> >
> > By Example:
> > File <changes.txt>
> > -Added support for x ($NextRevision$)
> >
> > Stored file:
> > -Added support for x (348)
> >
> > I need/want this since I have (as shown) a changes log that I would
> like
> > to track the revision number each change is made in (of course if
> do a
> > commit first to get a number, then I need to recommit to store
> that
> > number for the changes file).
> >
> > I've tried searching through the archives, but I can't think of
> the
> > keywords to sort out what I want (so many posts with "revision" in
> them).
> 
> Sorry, such a feature does not exist. Indeed, it would be pretty much
> 
> impossible to implement within the current architecture of
> Subversion, since 
> the final revision number is not known until *after* the new file
> data has 
> been written into the repository.
> 
> Max.
> 
> 
> ---------------------------------------------------------------------
> 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: Commiting file which contains the next revision number

Posted by Max Bowsher <ma...@ukf.net>.
edA-qa wrote:
> Is there a way to either get the next revision number, or better, to
> specify a tag in a file such than when the file is committed the tag is
> replaced with the revision in which it was commited.
>
> By Example:
> File <changes.txt>
> -Added support for x ($NextRevision$)
>
> Stored file:
> -Added support for x (348)
>
> I need/want this since I have (as shown) a changes log that I would like
> to track the revision number each change is made in (of course if do a
> commit first to get a number, then I need to recommit to store that
> number for the changes file).
>
> I've tried searching through the archives, but I can't think of the
> keywords to sort out what I want (so many posts with "revision" in them).

Sorry, such a feature does not exist. Indeed, it would be pretty much 
impossible to implement within the current architecture of Subversion, since 
the final revision number is not known until *after* the new file data has 
been written into the repository.

Max.


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

Re: Commiting file which contains the next revision number

Posted by edA-qa <ed...@disemia.com>.
Max Bowsher wrote:
> Nope, no good.
> The extra complication doesn't work round the essential problem:
> *ALL* file data must be written *before* the new revision number is known.

Yes, but my solution meets this requirement.  To make it clearer what 
happens:

In <file.txt> I use the tag: $Unique:LastRev$

When I do commit, this happens:
	1. Unique is found and a uniqe file is created, a UUID or something 
that subersion guarantees is uniqe, for our exmplae choose "ABCD.FILE".
	2. The Unique reference is replaced with a named reference: 
$Unique:LastRev$ => $ABCD.FILE:LastRev$
	3. Now the files can be written, then a revision number of known

Okay,but since the ABCD.FILE is unique, and is read-only (never changes) 
the $ABCD.FILE:LastRev$ will always be the revision with which is was 
first checked in, therefore, in <file.txt> the reference will always 
contain the same revision number, and it will be the revision number 
with which <file.txt> was checked in with.

Note: Some work on naming/display would of course be needed.


-- 
edA-qa mort-ora-y
Idea Architect
http://disemia.com/


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

Re: Commiting file which contains the next revision number

Posted by Max Bowsher <ma...@ukf.net>.
edA-qa wrote:
> kfogel@collab.net wrote:
>> What you want is, unfortunately, impossible :-).
>> See http://subversion.tigris.org/issues/show_bug.cgi?id=958
> 
> I had an idea on how to implement this:

Nope, no good.
The extra complication doesn't work round the essential problem:

*ALL* file data must be written *before* the new revision number is known.

Max.


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

Re: Commiting file which contains the next revision number

Posted by edA-qa <ed...@disemia.com>.
kfogel@collab.net wrote:
> What you want is, unfortunately, impossible :-).
> See http://subversion.tigris.org/issues/show_bug.cgi?id=958

I had an idea on how to implement this:

Since one can create a file that has any number of properties (assuming 
these are fairly cheap) and one can create any number of files (also 
assuming this are cheap), could one not do this:

	1. Add a tag called %Unique:Property% where Propery can be any 
supported tag.
	2. During commit, before finally writing the file to the system, a 
UNIQUE file is created which stores all the Unique:Properties
	3. The original Unique properties are replaced with a link to this file 
(this is all still fine before the final post, no causality broken yet ;)
	4. The Unique file is marked readonly (in some fashion) so that it can 
never be modified again.
	5. On checkout/update the %Unique:Property% is updated with the 
property stored in that unique file

Thus, to do my initial request, you would enter a tag like this:

	$Unique:LastRev$

Which, if you follow my steps, will end up being the next revision 
number for commit, and will never again change.

Thoughts, suggestions?


-- 
edA-qa mort-ora-y
Idea Architect
http://disemia.com/


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

Re: Commiting file which contains the next revision number

Posted by kf...@collab.net.
edA-qa <ed...@disemia.com> writes:
> Is there a way to either get the next revision number, or better, to
> specify a tag in a file such than when the file is committed the tag
> is replaced with the revision in which it was commited.
> 
> By Example:
> File <changes.txt>
> 	-Added support for x ($NextRevision$)
> 
> Stored file:
> 	-Added support for x (348)

What you want is, unfortunately, impossible :-).

See http://subversion.tigris.org/issues/show_bug.cgi?id=958

Best,
-Karl

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

RE: Commiting file which contains the next revision number

Posted by Dale Worley <dw...@pingtel.com>.
-----Original Message-----
From: news [mailto:news@sea.gmane.org]On Behalf Of edA-qa

Is there a way to either get the next revision number, or better, to
specify a tag in a file such than when the file is committed the tag is
replaced with the revision in which it was commited.
---------------------------------------------------------------------

Well, you can't get the next revision number, or rather, it isn't useful,
because someone might do a commit between when you get the number and when
you do your commit.

Dale


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