SVN revision # in code?

Go To Last Post
7 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi freaks

Do any of you guys know if it is possible to import the AnkhSVN revision number into my code in Atmel Studio 6?

I can see that it has already been asked at ankhsvn.open.collab.net, but with no answers - so I thought that this place could give an answer.

Thank you! 8)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I don't know about AnkhSVN, but with the svn cli I do

svn propset svn:keywords Revision file.c

then the string $Revision: 42 $ will be updated on every check in. I guess you can accomplish the same with any svn client.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This is a generic SVN problem, not specific for AnkhSVN.

A good Google should give you plenty, e.g. this: http://stackoverflow.com/questio... .

EDIT: And this - right from the horses mouth..: http://svnbook.red-bean.com/nigh... . (If you're into branching or tagging then you probably want to insert more than just the revision, e.g. the URL.)

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I use Bazaar and it too can create a file with a revision number (and more). I put this command in a run-before-make entry somewhere.

More interesting, it can also produce a flag indicating whether the build is clean (e.g. no uncommited changes in versioned files). It is important not to version the resulting file, otherwise the flag is always set to not-clean :)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

snigelen wrote:
I don't know about AnkhSVN, but with the svn cli I do
svn propset svn:keywords Revision file.c

then the string $Revision: 42 $ will be updated on every check in. I guess you can accomplish the same with any svn client.

Thank you!

I digged into the properties in AnkhSVN and found that it is possible to right click on a c-file, then choose Subversion->Subversion Properties. Here I can choose svn:keywords Revision and write

#define "$Revision$"

So now I have a define with a new revision number for each svn commit.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I use the the SubWCRev utility that comes with Tortoisesvn.

http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-subwcrev.html

As a pre-build command

SubWCRev .. svnrev.temp svnrev.h

The file svnrev.temp contains the line

#define SVNREV $WCREV$$WCMODS?M:$

this generates the file svnrev.h with the line

#define SVNREV 2172M

2172 is my current svn rev and M says the code is modified.

In my code I have the following

  #define QUOTEME_(x) #x
  #define QUOTEME(x) QUOTEME_(x)
  const char PROGMEM svn_rev[8] PROGMEM = QUOTEME(SVNREV);

svn_rev is a string in flash that contains the svn rev.

One problem you may encounter is if you have the hexfiles checked in with the code. You'll always get the 'M' for modified, and the svn rev will be off. I solved that problem by creating a script to patch the hex files directly and move them to an images directory before check in.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I use TortoiseSVN too, there is TortoiseSVN guide http://www.aliaspooryorik.com/bl... that uses the right click dialog.

Alex

"For every effect there is a root cause. Find and address the root cause rather than try to fix the effect, as there is no end to the latter."
Author Unknown