Sylvain Viart [mailto:sylvain.viart@easyrencontre.com] wrote:
> Is it possible to update (not to switch or merge) to the same revision
> that were been copied into a tag?
> Ex:
> trunk_wc/file1 rev 123
> trunk_wc/file2 rev 129
> Mixed version wc...
> now I tag the wc using a copy.
> cd ..
> svn copy http://url//repos/tags/mytag trunk_wc
> Now, I would like to have in the trunk, the same that I've taged in
mytag.
> ideally something like the :
> cd trunk_wc/
> svn up -r http://url//repos/tags/mytag
> Any idea?
Yes, it is possible, however SVN's design forces you to jump
through
a mess of pain to get there. Thankfully you can script it to
some
degree, with effort.
A tag is really a copy and results in a new revision with shared
history. But you don't want that one, you want what it
represents (a
particular path@rev on a particular branch or trunk).
First checkout the latest of whatever branch you're talking
about
(assuming you haven't deleted it...at which point this becomes
much
more complex because of how badly SVN handles deleted objects).
Now that you have HEAD on the branch the tag was made, you need
to
run svn diff --summarize between your copy and the tag you're
trying
to get to. This will give you a manifest of the files that need
to be
changed.
Walk this manifest and one by one retrieve the history of that
file on the tag path and walk the history backwards until the
path is
no longer on the /tag/. This is probably the 2nd entry from the
top of the log, but might not be if you've changed anything on
the
tag after it was created or if the tag was created by copying
another
tag (i.e., copying a build # tag to a final release # tag).
Now you have the original path and rev. Use that rev to update
the
particular file. Do this separately for each file in the diff
manifest...one by one.
If you need to REMOVE a file because it exists at HEAD but not
at
the tag you're trying to reproduce, you can't update to a
revision
number. -If you try, such as update -r 0, it will remove the
file in
your wc...but it'll screw up that file's parent directory meta
info
such that SVN won't let you copy your WC (you can't tag again).
Instead you need to kluge around this SVN brain damage by running
svn switch on the file to a URL that doesn't exist:
svn switch http://my/repo/NON_EXISTANT_PATH
wc/path/to/file
This will remove the file from your wc w/o screwing up the
directory's
meta data allowing you to copy your wc again if you'd like the
same
as it originally existed. -In this case you're leveraging SVN's
poor deleted file handling in your favor instead of against you.
I have scripts I use to do this, but the code is part of
larger utilities and I haven't had time to split it out cleanly
yet.
It is a major feature hole/design flaw in SVN. SVN needs *real*
tags, not kluged copy. It also needs the Last Modified Revision
to be correct...which it frequently is not (found out the hard
way).
HTH
-Byron
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Wed Sep 26 02:15:17 2007