[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Replacing files in a tag that is a copy of another tag, with revisions from trunk

From: Thomas Dudziak <tomdzk_at_gmail.com>
Date: 2007-07-16 08:26:01 CEST

Hi folks,

I have a somewhat unusual tagging problem and checkout/update/merge
are giving me grief.
For reference, this is on Ubuntu 6.06 server with svn 1.3.1.

In short, I need to create tags for older revisions of files, and if
possible, based on each other (e.g. tag 2.1 is based on 2.0). Since
the tags are not from trunk and the files in them come from different
revisions, I cannot use a simple a svn copy command to create them.
Rather, in order to avoid generating thousands of revsions (one svn
copy for each file), the tags are generated via this procedure:

* checkout the individual files into the working directory, each at
the specific revision (i.e. svn co -r <rev> <url>)
* checkin the whole working directory as a new tag

For example, let's assume trunk contains files A, B, C, all at
revision 5. Now, tag 1 should contain A at revision 1, B and C at
revisions 2. The commands then would be

svn mkdir <repo url>/tags/1
svn co <repo url>/tags/1 <work dir>
svn copy -r 1 <repo url>/trunk/A <work dir>/A
svn copy -r 2 <repo url>/trunk/B <work dir>/B
svn copy -r 2 <repo url>/trunk/C <work dir>/C
svn ci <work dir>

While this works (and generates only one revision per tag), the tag is
not based on the previous one but instead generated from trunk
directly. The benefit of generating a tag from the previous one would
be that only few files have changed in between tags, and so the whole
process would be faster.

To continue the example, let's assume that tag 2 has file A now at
revision 2 and file C is no longer in it. File B remains at revision
2. Right now, I have to create tag 2 in exactly the same way:

svn mkdir <repo url>/tags/2
svn co <repo url>/tags/2 <work dir>
svn copy -r 2 <repo url>/trunk/A <work dir>/A
svn copy -r 2 <repo url>/trunk/B <work dir>/B
svn ci <work dir>

Now, the idea that I had was the following:

* svn copy <previous tag> <new tag> to create the initial new tag
based on the previous one
* checkout this new tag into the working directory
* delete all files and directories no longer in the new tag (svn delete)
* add new files using svn co -r <rev> <url> as before
* update changed files


svn copy <repo url>/tags/1 <repo url>/tags/2
svn co <repo url>/tags/2 <work dir>
<somehow update A>
svn delete <work dir>/C
svn ci <work dir>

The step of updating A however proves to be impossible. I tried
different approaches but to no avail:

* svn co -r 2 <repo url>/trunk/A <work dir>/A

This simply refuses to checkout the file, complaining about:

svn: File not found: revision <revision of tag 2>, path "trunk/A"

Why does it use the tag revision (e.g. 6) instead of the one specified ?

* svn up -r 2 <work dir>/A tells me:

At revision 2.

but when I check the file via svn log, I get a "is not under version
control". And if i checkin the working directory, the file is missing.

* svn merge fails with different error messages depending on what syntax I use.

- svn merge -r 1:2 <repo url>/trunk/A

fails with:

svn: File not found: revision <revision of tag 2>, path "/trunk/A"

Same as the svn co command above, it uses the revision of the file in
the working directory instead of the specfied one ?

- svn merge <repo url>/trunk/A@1 <repo url>/trunk/A@2


svn: Cannot replace a directory from within

which, honestly, does not tell me anything at all.

- svn merge <repo url>/tags/2/A <repo url>/trunk/A@2

Same error, "svn: Cannot replace a directory from within".

svn merge <repo url>/tags/1/A <repo url>/trunk/A@2

Same error again.

I also tried to add --ignore-ancestry to the merge commands, but there
was no difference.
Btw, "svn diff -r 1:2 <repo url>/trunk/A" has the same error as the
corresponding merge command. However, "svn diff <repo url>/tags/2/A
<repo url>/trunk/A@2" works, it shows me the differences between
revision 1 and 2 just fine.

I searched on the Internet but could not find anything useful for my
situation, so my question is, can Subversion actually do this, i.e.

* Create the first tag containing specific revisions (non-HEAD) of
specific files from trunk, without having to use svn copy for each and
every file.

* Create the second tag as a copy of the first tag, and then update
specific files with specific different revisions from trunk, again
without having to use svn copy for each and every file.


To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Mon Jul 16 08:26:02 2007

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.