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

Re: how to revert to a previous version in subversion

From: John Szakmeister <john_at_szakmeister.net>
Date: 2004-03-02 01:07:10 CET

On Monday 01 March 2004 18:35, jingzheng@softhome.net wrote:
> I just installed subversion 1.0.0 and experiment with it. I tried to
> simluate the following scenario:
> checked in revision 1;
> added some "buggy" code, checked in as revision 2;
> added some other "buggy" code, checked in as revision 3;
> now I want to revert the working copy to revision 1, make some changes and
> checked in as revision 4.
> I can get revision 1 to working copy by doing:
> $svn update -r 1 (right after checking in revision 3)
> then I modify my code and do
> $svn ci -m "test"
> svn complains something like
> "svn: Out of date: '/mysvn/build.conf' in transaction 'y'"
>
> I know I can do "svn update" to make the complaint go away, but that is NOT
> my goal. I don't want to merge changes in revision 2 and revision 3. I just
> want revision 1 and my new changes on top of revision 1 checked in as
> revision 4.

You actually want to use the merge command. Do the following:
svn merge -r4:1 .
<make your changes>
svn ci -m 'test' .

The Subversion Book goes over this scenario pretty well. Here's the link:
http://svnbook.red-bean.com/book.html#svn-ch-4-sect-4.2

> in cvs I know I can do "cvs update -j 1.5 -j 1.3" to revert "buggy"
> changes, seems svn doesn't have a similar option for update. Does anyone
> know how to achieve this in subversion? I searched google and the
> subversion book and couldn't find an example for this. "svn revert" is not
> what I need here. Thanks a lot. --Jing

Subversion's update is a little different than CVS's update. In Subversion,
it means to go the repository and grab the latest version. If you tell it to
grab a particular revision, it isn't "sticky". Meaning, if you do an update
again without the revision parameter, Subversion will update the file to the
HEAD revision again. Merge is the way to get changes into or out of your
file.

-John

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Tue Mar 2 01:08:11 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.