5

I have a project that has a revision number of 3960. But unfortunately it is not under source control. Now I would like to put it under SVN and use Tortoise SVN. But when I put it there it will have revision from 1,2,3,4 and so on.

Is there a way to change the revision number to 3960?

GEOCHET
  • 21,119
  • 15
  • 74
  • 98
Tom Smykowski
  • 25,487
  • 54
  • 159
  • 236
  • 1
    One thing to be careful of is the fact that a "build number" has a maximum value of 65535, while SVN repository revisions can quickly grow well past this. If you find your repository growing faster than your build numbers were previously, you might want to consider moving the revision number into a comment field and letting the build number increase naturally. – skamradt Feb 09 '12 at 18:22

3 Answers3

10

The safest way I can think of would be to make a dump file with an appropriate number of empty revisions, than load it. The format would be something like:

SVN-fs-dump-format-version: 2

Revision-number: 0
Prop-content-length: 56
Content-length: 56

K 8
svn:date
V 27
2009-01-12T14:58:15.449041Z
PROPS-END

Revision-number: 1
Prop-content-length: 56
Content-length: 56

K 8
svn:date
V 27
2009-01-12T14:58:40.758271Z
PROPS-END

Revision-number: 2
Prop-content-length: 56
Content-length: 56

K 8
svn:date
V 27
2009-01-12T14:58:44.509698Z
PROPS-END

You could omit the svn:date and it would still be a valid svn repository, but queries by {date} wouldn't work (just like they don't in any case where the dates are not monotonically increasing with revision). So it's probably best to fake up a string of plausible dates.

If you want 3960 such revisions, you probably want to write a script to generate the dump file. I leave that as an exercise to the reader :-)

puetzk
  • 10,534
  • 3
  • 28
  • 32
7

It is possible in theory, but not very useful.

If you need somehow to keep track of this information, you may consider creating a tag '3960', but otherwise leaving the normal revision process taking place.

As said in the manual:

Global Revision Numbers
Unlike those of many other version control systems, Subversion's revision numbers apply to entire trees, not individual files. Each revision number selects an entire tree, a particular state of the repository after some committed change.
Another way to think about it is that revision N represents the state of the repository filesystem after the Nth commit. When a Subversion user talks about “revision 5 of foo.c”, they really mean “foo.c as it appears in revision 5.”

A revision number is different than an **application version number" (the version number of your application): the latter is represented by a tag.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • 1
    I disagree with your statement that this is not very useful. If you use the revision number as part of the version number (replacing build #) you can always set the repository to that specific version when attempting to reproduce a bug. You can use tags for this, but it requires an additional step and breaks down quickly if you have multiple executables in the same repository. – skamradt Feb 09 '12 at 17:57
  • @skamradt using "the revision number as part of the version number (replacing build #)" is a good practice in general, I agree. I was only pointing out the hassle involved in this particular situation (as described in the OP's question), as opposed to store that old revision number somewhere and start anew. – VonC Feb 09 '12 at 18:54
3

First, I don't know a way to do this. If it would be possible, I think you have to use a svn-hookscript.

Second, the revision number in Source Control Systems has nothing to do with the revision (Version) Number of your Program. The Source Control System keeps track of every change you submit and so you may have much more submits than builds of your code. It may differ every time, if you don't just submit changes with a new build-number and I don't think that you should just check in changes in such huge steps.

For keeping track of your build numbers you should use tags.

Xn0vv3r
  • 17,766
  • 13
  • 58
  • 65