You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Adrian Oliver <ad...@eurotherm.co.uk> on 2004/05/07 10:09:56 UTC

snv:keywords - want current checked out working revision ID

I want to be able to put into my code the currently checked out working 
revision ID using a keyword.

For example, when I perform an svn update, svn checkout or svn commit, 
the last thing it displays is: "Updated to revision 140."

I would like to put into my code the "140" using a keyword, as it 
provides a means of linking a compiled executable with the svn revision 
used to generate it.

I accept that if changes are made after the update, checkout or commit 
and are not recommitted, that it would not be telling the whole truth.

When we perform releases, we generally make a fresh checkout before 
building.

Thanks,

Adrian
-- 
Adrian Oliver, Eurotherm Limited - An Invensys company
Faraday Close, Durrington, West Sussex, BN13 3PL, UK
Tel: +44 (0)1903 837433
http://www.eurotherm.co.uk   adrian.oliver@eurotherm.co.uk


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

Is there a way to do an exclusive edit on a file?

Posted by Greg Goodrich <gg...@medinotes.com>.
We've found that certain files (MS Visual Studio, C++) tend to get 
severely modified for some unknown reason when they are maintained by 
Visual Studio, such as resource files, projects, and workspaces.  In 
Visual Source Safe, we can see when someone else has one of these files 
checked out, and we go on the honor system of not doing a "multiple" 
checkout situation on them, as we have had data loss (possibly because 
of VSS's merge tool) in the past when this was not followed.  We are in 
the process of migrating to Subversion, but have concerns about this 
situation.  Is there a way to "lock" a file so that someone else won't 
edit the file at the same time?  The only idea I've had so far would be 
to try to set a property on each of those files that would serve as a 
kind of "lock".  Then prior to someone changing one of those files, they 
would check to see what the property was set to to determine if someone 
else is currently modifying it or not.

Maybe my fears are unfounded with Subversion handling the merge, as it 
could have superior merge abilities in comparison to VSS.  I just know 
that for some unexplained reason, it appears that occasionally Visual 
Studio will "shuffle" these files in such a way that a diff is next to 
useless, as everything has been reorganized in a different order.  I 
don't know what causes this, when it does it, or why.  I just know that 
it has happened.  TIA

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

Re: Is there a way to do an exclusive edit on a file?

Posted by Greg Goodrich <gg...@medinotes.com>.

Ben Collins-Sussman wrote:

>On Fri, 2004-05-07 at 15:32, Greg Goodrich wrote:
>  
>
>> Is there a way to "lock" a file so that someone else won't
>>edit the file at the same time? 
>>    
>>
>
>No, this is an svn 1.1 feature we're working on.  No, there's no
>estimated date set for 1.1 yet, we're still in the planning stages.
>
>  
>
It is good to know that this feature is in the list.

>> it appears that occasionally Visual
>>Studio will "shuffle" these files in such a way that a diff is next to
>>useless, as everything has been reorganized in a different order.  I
>>don't know what causes this, when it does it, or why.  I just know that
>>it has happened.  TIA
>>    
>>
>
>I don't know squat about VC, but perhaps these files shouldn't be kept
>under version control?
>
>  
>
The resource files are an integral part of VC (MFC).  They define the 
dialogs and the controls within.  There is no choice but to have them 
under version control.  The project files are analogous to Makefiles, so 
they too are essential.  I wish that I knew the circumstances that cause 
VC to "shuffle" them, at least then we would know when to watch for 
problems.

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

Re: Is there a way to do an exclusive edit on a file?

Posted by Gary Feldman <g1...@marsdome.com>.
----- Original Message ----- 
From: "Glenn Maynard" <g_...@zewt.org>
Sent: Sunday, May 09, 2004 4:01 AM

> However, I've never seen VC shuffle a .vcproj file around, which is

I don't know about .vcproj files in particular, but I have seen the
shuffling take place on .vdproj file (deployment project files), and I
suspect that some corruption I saw in a .csproj file (C#) was due to the
same reasion, when a merge went through with inconsistent GUIDs in the
result.

Gary


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

Re: Is there a way to do an exclusive edit on a file?

Posted by Glenn Maynard <g_...@zewt.org>.
On Fri, May 07, 2004 at 03:44:47PM -0500, Ben Collins-Sussman wrote:
> I don't know squat about VC, but perhaps these files shouldn't be kept
> under version control?

Moving things out of the build tree is (in my experience) rarely a
practical solution, even for unmergable files and files that don't change
very much.  Having build instructions that look like "download this svn
tree, then extract this tar into this specific place to get the rest of
the files, and watch the mailing list just in case they do change, and
mail me changes if you really need to change them" don't work very well.  :)

However, I've never seen VC shuffle a .vcproj file around, which is
usually the most commonly-changed file in a VC7 workspace (containing
the actual file lists).  I *have* seen svn fail to merge it in cases
that seemed trivial: a few blocks of XML added, and it created a whole-
file conflict that had to be merged by hand.  I havn't got around to
investigating this, yet.

(I have seen VC6 generate different output for the same project file--a
bunch of random things will change depending on who commits the file,
probably based on the version of the IDE.)

-- 
Glenn Maynard

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

Re: Is there a way to do an exclusive edit on a file?

Posted by Ben Collins-Sussman <su...@collab.net>.
On Fri, 2004-05-07 at 15:32, Greg Goodrich wrote:
>  Is there a way to "lock" a file so that someone else won't
> edit the file at the same time? 

No, this is an svn 1.1 feature we're working on.  No, there's no
estimated date set for 1.1 yet, we're still in the planning stages.

>  it appears that occasionally Visual
> Studio will "shuffle" these files in such a way that a diff is next to
> useless, as everything has been reorganized in a different order.  I
> don't know what causes this, when it does it, or why.  I just know that
> it has happened.  TIA

I don't know squat about VC, but perhaps these files shouldn't be kept
under version control?



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

Is there a way to do an exclusive edit on a file?

Posted by Greg Goodrich <gg...@medinotes.com>.
We've found that certain files (MS Visual Studio, C++) tend to get
severely modified for some unknown reason when they are maintained by
Visual Studio, such as resource files, projects, and workspaces.  In
Visual Source Safe, we can see when someone else has one of these files
checked out, and we go on the honor system of not doing a "multiple"
checkout situation on them, as we have had data loss (possibly because
of VSS's merge tool) in the past when this was not followed.  We are in
the process of migrating to Subversion, but have concerns about this
situation.  Is there a way to "lock" a file so that someone else won't
edit the file at the same time?  The only idea I've had so far would be
to try to set a property on each of those files that would serve as a
kind of "lock".  Then prior to someone changing one of those files, they
would check to see what the property was set to to determine if someone
else is currently modifying it or not.

Maybe my fears are unfounded with Subversion handling the merge, as it
could have superior merge abilities in comparison to VSS.  I just know
that for some unexplained reason, it appears that occasionally Visual
Studio will "shuffle" these files in such a way that a diff is next to
useless, as everything has been reorganized in a different order.  I
don't know what causes this, when it does it, or why.  I just know that
it has happened.  TIA

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

Re: snv:keywords - want current checked out working revision ID

Posted by Michael W Thelen <th...@cs.utah.edu>.
* Adrian Oliver <ad...@eurotherm.co.uk> [2004-05-07 10:16]:
> I want to be able to put into my code the currently checked out working 
> revision ID using a keyword.

There's not really a keyword to do this, but check out the 'svnversion'
program.  It will give you the information you want.  As part of your
build process, you can run svnversion and put its output into your code.

-- Mike

-- 
Michael W. Thelen
The greatest of all weaknesses is the fear of appearing weak.
                -- J.B. Bossuet, "Politics from Holy Writ", 1709

Re: snv:keywords - want current checked out working revision ID

Posted by Ben Collins-Sussman <su...@collab.net>.
Please oh please, will somebody write a FAQ for this question?  It seems
to come up all the time.



On Fri, 2004-05-07 at 07:33, Scott Lawrence wrote:
> On Fri, 2004-05-07 at 06:09, Adrian Oliver wrote:
> > I want to be able to put into my code the currently checked out working 
> > revision ID using a keyword.
> > 
> > For example, when I perform an svn update, svn checkout or svn commit, 
> > the last thing it displays is: "Updated to revision 140."
> > 
> > I would like to put into my code the "140" using a keyword, as it 
> > provides a means of linking a compiled executable with the svn revision 
> > used to generate it.
> > 
> > I accept that if changes are made after the update, checkout or commit 
> > and are not recommitted, that it would not be telling the whole truth.
> 
> In your Makefile, link svn_version.o into your executable, then add:
> 
> svn_version.c: FORCE
> 	echo 'const char* svn_version(void) { return "' > svn_version.c
> 	svnversion -n . >> svn_version.c
> 	echo '"; }'   >> svn_version.c
> 
> a call to svn_version() will return the working copy version string.


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

Re: snv:keywords - want current checked out working revision ID

Posted by Scott Lawrence <sl...@pingtel.com>.
On Fri, 2004-05-07 at 06:09, Adrian Oliver wrote:
> I want to be able to put into my code the currently checked out working 
> revision ID using a keyword.
> 
> For example, when I perform an svn update, svn checkout or svn commit, 
> the last thing it displays is: "Updated to revision 140."
> 
> I would like to put into my code the "140" using a keyword, as it 
> provides a means of linking a compiled executable with the svn revision 
> used to generate it.
> 
> I accept that if changes are made after the update, checkout or commit 
> and are not recommitted, that it would not be telling the whole truth.

In your Makefile, link svn_version.o into your executable, then add:

svn_version.c: FORCE
	echo 'const char* svn_version(void) { return "' > svn_version.c
	svnversion -n . >> svn_version.c
	echo '"; }'   >> svn_version.c

a call to svn_version() will return the working copy version string.

-- 

Scott Lawrence
Consulting Engineer
Pingtel Corp.   
sip:slawrence@pingtel.com
+1.781.938.5306 x162


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

Re: snv:keywords - want current checked out working revision ID

Posted by SteveKing <st...@gmx.ch>.
Adrian Oliver wrote:

> I want to be able to put into my code the currently checked out working 
> revision ID using a keyword.
> 
> For example, when I perform an svn update, svn checkout or svn commit, 
> the last thing it displays is: "Updated to revision 140."
> 
> I would like to put into my code the "140" using a keyword, as it 
> provides a means of linking a compiled executable with the svn revision 
> used to generate it.
> 
> I accept that if changes are made after the update, checkout or commit 
> and are not recommitted, that it would not be telling the whole truth.
> 
> When we perform releases, we generally make a fresh checkout before 
> building.

Try the small utility SVNWCRev.exe which TortoiseSVN uses to generate a 
header file with those revision numbers in it. The tool can be found 
here (under "Misc Tools"):
http://tortoisesvn.tigris.org/download.html
To see how this tool works, start it without any parameters. You can 
also check out the template file TortoiseSVN uses here:
http://svn.collab.net/repos/tortoisesvn/trunk/src/version.in

Stefan

--
"The whole problem with the world is that fools and fanatics are always 
so certain of themselves, but wiser people so full of doubts." - 
Bertrand Russell
--

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