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

Backing up to an earlier revision / retrospective branching

From: <andy.glew_at_amd.com>
Date: 2004-04-21 22:00:48 CEST

This should be a FAQ, but I could not find an answer
reading either FAQ or the SVN book. (Possibly the usual
terminology impedance mismatch.)

A basic usage model question, followed by a question
leading to a possible enhancement:
   Q: how do you move back to an earlier revision,
      and make it the trunk?
   Q: does Subversion support "retrospective branching"?

Elaborating on the questions:

---+ Maing an earlier revision head of the trunk

   Q: how do you move back to an earlier revision,
      and make it the trunk?

Yesterday, I had made a few edits and checked them in on
the trunk, when I realized that the test suite was broken,
and that the trunk needed to revert to an earlier revision.

E.g. I was at revision 1260, and I needed to revert to
revision 1255.

Q: what is the easiest way in Subversion to accomplish this?

Naively, I thought that svn revert or svn update -r1255 would
do it, but of course they did not. (svn update -r1255 moved
me back to the working rev, but then I could not check it in
as the head.)

I eventually resorted to
   cd'ing to some parent directory
   svn cp -r 1255 module module.reverting-to-r1255; svn ci
   svn mv module module.broken; svn ci
   svn mv module.reverting-to-r1255 module; svn ci
   svn rm module; svn ci

This worked, but had the unpleasant side-effect of
making the history about the broken revisions harder to find
- the usual "Subversion only reports history only a path
in the tree" problem. (Why would I want the history for
the broken revs? First, they weren't irretrivably broken
- I eventually (today) recovered the good code from them.
second, because my pair programming partner is tracking
our efficiency, our accuracy in task estimation, by looking
at the Subversion logs.)

Is there a better way to make an earlier rev the head?

The only other svn knowledgeable person here recommended
        svn copy . http://absolute-url-of-module.broken
etc. --- but that requires absolute URLs. :-(

Note that the approach I describe uses relative paths
in the workspace, but results in the copy (branch/version)
that was broken being placed in something other than the
"official" branches or tags directory locaions.

---+ Retrospective Branching

In my example, everything on my tree from rev 1255 to rev 1260
was broken.

An operation that I have often wanted in CVS, which supposedly
PerForce has, is "retrospective branching"
- the ability to take those revisions, which had originally
been checked in on the trunk, and move them to a branch.

I.e. to take a segment of the trunk, move it to a branch,
and establish a new head at the trunk at the point where
the branch forked off.

Occasionally in CVS I would actually go and do this.
There was no way to take those revs off the trunk,
but you could establish a branch that reflected each of them.

A similar approach could be used in subversion:
   svn co -r1255 module module.retrospective-branch
   svn merge -r1256 module module.retrospective-branch
   svn merge -r1257 module module.retrospective-branch
   svn merge -r1258 module module.retrospective-branch
   svn merge -r1259 module module.retrospective-branch
   svn merge -r1260 module module.retrospective-branch
(svn ci'ing between each step I want to appear in the history)
(and then reverting the trunk head as I described above)

However, this is annoying, since it requires enumerating
all of the revisions.

Q: is there a better way to establish such a "retrospective
branch" in subversion?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Wed Apr 21 22:01:40 2004

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.