You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Gabor Nagypal <na...@gmail.com> on 2005/02/02 14:13:42 UTC

how to make a previous repository version the actual one?

Hi,

I am a subversion newbie, so perhaps this is a trivial question, but I
do not see the proper way to do it...

Assume that you have a project with a complicated directory structure,
lots of files etc. Suppose, you started a line of change, committed
many changes several times and after a week you notice, ups, it is
stupid what I am doing. Now I would like to return to the original
state of the project (i.e. two weeks ago).

My naive way of doing this would be:

svn up -r XX (where XX is the last good known version)
svn ci (check out this version as the new HEAD version)

But it does not work, because svn ci doesn't do anything, as none of
my files has changed...

So, what would be the best way to use subversion as a 'time machine',
and return to an older version?

Gabor

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: how to make a previous repository version the actual one?

Posted by Ben Collins-Sussman <su...@collab.net>.
On Feb 3, 2005, at 7:23 AM, Dale Worley wrote:

> -----Original Message-----
> From: Ben Collins-Sussman [mailto:sussman@collab.net]
>
> On Feb 2, 2005, at 12:30 PM, Dale Worley wrote:
>>
>>     # Delete all the files and directories from HEAD
>>     svn delete http://repository/root
>>     # Copy revision REV into HEAD.
>>     svn copy -r REV http://repository/root http://repository/root
>>
>
> This won't work.  'svn copy' doesn't overwrite directories.  Like the
> Unix 'cp' command, it creates a new directory underneath the target
> directory when the target directory already exists.  So in your example
> above, you'd end up with http://repository/root/root.
> -------------------------
>
> Well, strictly speaking, if the 'svn delete' succeeded, the directory 
> in
> question won't exist (in HEAD!), and 'svn copy' won't exhibit this 
> behavior.
> As I went on to explain, the question is if the directory in question 
> is the
> root of the repository.  I haven't checked, but I expect that you can't
> delete it.
>

Ah yes, you're right!  Never mind.  :-)


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

RE: how to make a previous repository version the actual one?

Posted by Dale Worley <dw...@pingtel.com>.
-----Original Message-----
From: Ben Collins-Sussman [mailto:sussman@collab.net]

On Feb 2, 2005, at 12:30 PM, Dale Worley wrote:
>
>     # Delete all the files and directories from HEAD
>     svn delete http://repository/root
>     # Copy revision REV into HEAD.
>     svn copy -r REV http://repository/root http://repository/root
>

This won't work.  'svn copy' doesn't overwrite directories.  Like the
Unix 'cp' command, it creates a new directory underneath the target
directory when the target directory already exists.  So in your example
above, you'd end up with http://repository/root/root.
-------------------------

Well, strictly speaking, if the 'svn delete' succeeded, the directory in
question won't exist (in HEAD!), and 'svn copy' won't exhibit this behavior.
As I went on to explain, the question is if the directory in question is the
root of the repository.  I haven't checked, but I expect that you can't
delete it.

Dale


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: how to make a previous repository version the actual one?

Posted by Ben Collins-Sussman <su...@collab.net>.
On Feb 2, 2005, at 12:30 PM, Dale Worley wrote:
>
>     # Delete all the files and directories from HEAD
>     svn delete http://repository/root
>     # Copy revision REV into HEAD.
>     svn copy -r REV http://repository/root http://repository/root
>

This won't work.  'svn copy' doesn't overwrite directories.  Like the 
Unix 'cp' command, it creates a new directory underneath the target 
directory when the target directory already exists.  So in your example 
above, you'd end up with http://repository/root/root.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

RE: how to make a previous repository version the actual one?

Posted by Dale Worley <dw...@pingtel.com>.
-----Original Message-----
From: Gabor Nagypal [mailto:nagypalg@gmail.com]

Assume that you have a project with a complicated directory structure,
lots of files etc. Suppose, you started a line of change, committed
many changes several times and after a week you notice, ups, it is
stupid what I am doing. Now I would like to return to the original
state of the project (i.e. two weeks ago).
---------------------------------------------------------------------

Maybe I've overlooked someone mentioning this, but it seems to me that the
most effective way would be:

    # Delete all the files and directories from HEAD
    svn delete http://repository/root
    # Copy revision REV into HEAD.
    svn copy -r REV http://repository/root http://repository/root

More likely, you can't delete the root directory of the repository, so you
have to list out its contents, and delete and copy them individually.  OTOH,
maybe you're lucky, and the version you want to revert is really
/repository/root/trunk, in which case you can probably do it in two
commands.

The advantage of this is that it preserves the history correctly.  E.g.,
"svn blame" produces the results you expect.

Dale


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org