You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Ron Gilbert <li...@rzweb.com> on 2005/07/26 16:51:19 UTC

Reverting out of a commit

What is the best way to revert out of a commit on a single file?  I  
had a situation yesterday where a (binary) file was committed that  
was corrupt (not svn's fault).  It was the head, and I just wanted to  
removed it, but I could not find a good way to do this.  I ended up  
pulling down the previous version and tried to commit that, but it  
would not let me because it was not current, so I had to modify the  
file before committing it.

This seem very cumbersome.   Is there a way to remove the head, or  
quickly make another revision the head?

Thanks, Ron


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

Re: Reverting out of a commit

Posted by Ben Collins-Sussman <su...@collab.net>.
Ron Gilbert wrote:
>> svn cat -r99 foo.jpg > foo.jpg   # overwrite foo.jpg with r99
>> svn -v status
>>
>> Status should show only foo.jpg as modified and the first revision
>> numbers all at 100 (since you did an update to HEAD).
>>
>> svn commit
> 
> 
>> After all this I hope it works for you.
> 
> 
> Yes, this works perfectly.  Thanks.  Only issues is it's a command- line 
> only thing.  I have several artists on the project that are not  as 
> technically savvy as the programmers and using the command-line is  not 
> in the cards.  For the time-being, I can just fix the stuff  myself.   
> Thanks again.


It's not just a commandline thing.  TortoiseSVN allows you to 'fetch' 
any file from any revision, using the Revision Browser.  Just browse 
r99, fetch the older file, and then copy it on top of the newer one.

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

Re: Reverting out of a commit

Posted by Ron Gilbert <li...@rzweb.com>.
> svn cat -r99 foo.jpg > foo.jpg   # overwrite foo.jpg with r99
> svn -v status
>
> Status should show only foo.jpg as modified and the first revision
> numbers all at 100 (since you did an update to HEAD).
>
> svn commit

> After all this I hope it works for you.

Yes, this works perfectly.  Thanks.  Only issues is it's a command- 
line only thing.  I have several artists on the project that are not  
as technically savvy as the programmers and using the command-line is  
not in the cards.  For the time-being, I can just fix the stuff  
myself.   Thanks again.

Ron


On Jul 26, 2005, at 11:27 AM, Christopher Ness wrote:

> On Tue, 2005-07-26 at 10:55 -0700, Ron Gilbert wrote:
>
>>> Perhaps the best way would be to place the non-corrupt binary file
>>> into
>>> your working copy and then commit your changes.
>>> This will make a new HEAD revision with the updated file.
>>>
>>
>> This is what I was trying to do...I was doing this under TSVN and
>> getting errors about my working copy not being uptodate.
>>
>> I just tried the same thing using the command line (Windows):
>>
>> # Get old, non-corrupt copy
>> svn update -r99 foo.jpg
>>
>
> Now you cannot commit because your working copy is in a mixed revision
> and out-of-date as far as subversion is concerned.
>
> Was it luck that r99 was the file or are you following suit with my
> revision numbers?  Anyway, this should hopefully do it.
>     svn up -rHEAD .
>
> Where . is the directory foo.jpg lives in.  Now overwrite the file  
> using
> the version in r99.  Normally for source code you would do the reverse
> merge, but in this case a binary merge is sketchy so simply dump the
> file at that revision (`svn help cat` for more info).
>
>     svn cat -r99 foo.jpg > foo.jpg   # overwrite foo.jpg with r99
>     svn -v status
>
> Status should show only foo.jpg as modified and the first revision
> numbers all at 100 (since you did an update to HEAD).
>
>     svn commit
>
> Now you should be able to commit without the error message below since
> the working copy is up-to-date.  SVN thinks you modified foo.jpg, and
> you did, it just holds r99 data.
>
>
>> If I modify foo.jpg, then I get a "Transaction failed, file out of
>> date" (not exact words).
>>
>
> After all this I hope it works for you.
>
> Cheers,
> Chris
> -- 
> Wireless Group
> McMaster University
>
> summer
> 14:15:30 up 5 days, 8 min, 5 users, load average: 0.20, 0.17, 0.17
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: users-help@subversion.tigris.org
>


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

Re: Reverting out of a commit

Posted by Christopher Ness <ch...@nesser.org>.
On Tue, 2005-07-26 at 10:55 -0700, Ron Gilbert wrote:
> > Perhaps the best way would be to place the non-corrupt binary file  
> > into
> > your working copy and then commit your changes.
> > This will make a new HEAD revision with the updated file.
> 
> This is what I was trying to do...I was doing this under TSVN and  
> getting errors about my working copy not being uptodate.
> 
> I just tried the same thing using the command line (Windows):
> 
> # Get old, non-corrupt copy
> svn update -r99 foo.jpg

Now you cannot commit because your working copy is in a mixed revision
and out-of-date as far as subversion is concerned.  

Was it luck that r99 was the file or are you following suit with my
revision numbers?  Anyway, this should hopefully do it.
    svn up -rHEAD .

Where . is the directory foo.jpg lives in.  Now overwrite the file using
the version in r99.  Normally for source code you would do the reverse
merge, but in this case a binary merge is sketchy so simply dump the
file at that revision (`svn help cat` for more info).

    svn cat -r99 foo.jpg > foo.jpg   # overwrite foo.jpg with r99
    svn -v status 

Status should show only foo.jpg as modified and the first revision
numbers all at 100 (since you did an update to HEAD).

    svn commit

Now you should be able to commit without the error message below since
the working copy is up-to-date.  SVN thinks you modified foo.jpg, and
you did, it just holds r99 data.

> If I modify foo.jpg, then I get a "Transaction failed, file out of  
> date" (not exact words).

After all this I hope it works for you.

Cheers,
Chris
-- 
Wireless Group
McMaster University

summer
14:15:30 up 5 days, 8 min, 5 users, load average: 0.20, 0.17, 0.17



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

Re: Reverting out of a commit

Posted by Ron Gilbert <li...@rzweb.com>.
> Perhaps the best way would be to place the non-corrupt binary file  
> into
> your working copy and then commit your changes.
> This will make a new HEAD revision with the updated file.

This is what I was trying to do...I was doing this under TSVN and  
getting errors about my working copy not being uptodate.

I just tried the same thing using the command line (Windows):

# Get old, non-corrupt copy
svn update -r99 foo.jpg

#commit it making it the head
svn commit foo.jpg

When I do this, I get nothing back (just a new prompt) and the file  
is not committed and there is not a new head.

If I modify foo.jpg, then I get a "Transaction failed, file out of  
date" (not exact words).

Ron


On Jul 26, 2005, at 10:20 AM, Christopher Ness wrote:

> On Tue, 2005-07-26 at 09:51 -0700, Ron Gilbert wrote:
>
>> What is the best way to revert out of a commit on a single file?  I
>> had a situation yesterday where a (binary) file was committed that
>> was corrupt (not svn's fault).  It was the head, and I just wanted to
>> removed it, but I could not find a good way to do this.  I ended up
>> pulling down the previous version and tried to commit that, but it
>> would not let me because it was not current, so I had to modify the
>> file before committing it.
>>
>> This seem very cumbersome.   Is there a way to remove the head, or
>> quickly make another revision the head?
>>
>
> If HEAD = 100 and you have a working copy of the changes then to  
> revert
> the last commit (which is revision 100):
>     svn up                    # Update your working copy
>     svn merge -r100:99 .      # Reverse merge the changes made in 100
>       ** Inspect the changes made to make sure you are happy with them
>     svn commit                # Send changes to the repository
>
> This will revert ALL changes in commit 100, which you probably don't
> want to do.
>
> If you simply want to remove a file from the repository:
>    svn help rm
>
> Perhaps the best way would be to place the non-corrupt binary file  
> into
> your working copy and then commit your changes.
> This will make a new HEAD revision with the updated file.
>
> HTH's,
> Chris
> -- 
> Wireless Group
> McMaster University
>
> summer
> 13:13:45 up 4 days, 23:06, 5 users, load average: 0.10, 0.18, 0.17
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: users-help@subversion.tigris.org
>


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

Re: Reverting out of a commit

Posted by Christopher Ness <ch...@nesser.org>.
On Tue, 2005-07-26 at 09:51 -0700, Ron Gilbert wrote:
> What is the best way to revert out of a commit on a single file?  I  
> had a situation yesterday where a (binary) file was committed that  
> was corrupt (not svn's fault).  It was the head, and I just wanted to  
> removed it, but I could not find a good way to do this.  I ended up  
> pulling down the previous version and tried to commit that, but it  
> would not let me because it was not current, so I had to modify the  
> file before committing it.
> 
> This seem very cumbersome.   Is there a way to remove the head, or  
> quickly make another revision the head?

If HEAD = 100 and you have a working copy of the changes then to revert
the last commit (which is revision 100):
    svn up                    # Update your working copy
    svn merge -r100:99 .      # Reverse merge the changes made in 100
      ** Inspect the changes made to make sure you are happy with them
    svn commit                # Send changes to the repository

This will revert ALL changes in commit 100, which you probably don't
want to do.

If you simply want to remove a file from the repository:
   svn help rm

Perhaps the best way would be to place the non-corrupt binary file into
your working copy and then commit your changes.  
This will make a new HEAD revision with the updated file.

HTH's,
Chris
-- 
Wireless Group
McMaster University

summer
13:13:45 up 4 days, 23:06, 5 users, load average: 0.10, 0.18, 0.17



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