You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Kynn Jones <ky...@gmail.com> on 2009/03/28 18:30:51 UTC

How to undo a commit?

By mistake, I ran the following command while in the wrong directory:
svn commit -m 'a lengthy description string'

This was a big mistake: The directory in question was not even part of the
project that I thought I was working with!  Hence, the lengthy message that
I passed as the argument to the -m option is wholly inappropriate, and in
fact misleading.  (In addition, a couple of files got committed prematurely
to the repository, but this is the lesser problem.)

Is there a straightforward way to undo this mistake, and delete the
incorrect message?

I assume the answer is no, since Subversion is designed to "keep
everything".  In this case, what's the best approximation to a full delete
of this incorrect message?

TIA!

Kynn

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=1459354

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].

Re: How to undo a commit?

Posted by David Weintraub <qa...@gmail.com>.
On Mar 30, 2009, at 12:34, David Weintraub wrote:
> The other is that you must for some strange reason have
> a working copy. It doesn't really matter what's in your working
> copy as long as you have a working copy. Yes, the
> "svn propedit --revprop" doesn't change a thing in the
> working copy.

On Tue, Mar 31, 2009 at 7:33 AM, Ryan Schmidt
<su...@ryandesign.com> wrote:
>
> That's always worked for me. What happens for you?
>

I don't know. I've tried changing the revision property before, give
it a Subversion URL, and Subversion responds that it can't run svn
propedit because I don't have a working copy.

It's easy enough to fix: I simply change to a directory that is a
Subversion working copy and rerun the command.


I never thought of complaining about this as a bug because it's easy
enough to fix (i.e. it's easy enough to get around this issue, and I
do it so rarely that it isn't worth the time to report this is a bug).
I just figured that Subversion requires "svn propedit" to be a working
copy when you're changing a file's property.

--
David Weintraub
qazwart@gmail.com

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=1497190

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].

Re: How to undo a commit?

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Mar 30, 2009, at 12:34, David Weintraub wrote:

> Okay, exactly what is the issue:
>
> * Your commit is fine, but the comment is incorrect.
> * Your commit is incorrect.
>
> The first one can be changed via the "svn propedit --revprop -r<rev>
> svn:log" command. There are two caveats: The first is that you need to
> enable to "pre-revprop-change" hook which is disabled by default. You
> can't change a revision property without such a hook.

Yes.

> The other is
> that you must for some strange reason have a working copy. It doesn't
> really matter what's in your working copy as long as you have a
> working copy. Yes, the "svn propedit --revprop" doesn't change a thing
> in the working copy, and the change in the repository takes place
> immediately without a commit, but you can't run this command against a
> URL.

That's always worked for me. What happens for you?

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=1494936

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].

Re: How to undo a commit?

Posted by David Weintraub <qa...@gmail.com>.
Okay, exactly what is the issue:

* Your commit is fine, but the comment is incorrect.
* Your commit is incorrect.

The first one can be changed via the "svn propedit --revprop -r<rev>
svn:log" command. There are two caveats: The first is that you need to
enable to "pre-revprop-change" hook which is disabled by default. You
can't change a revision property without such a hook. The other is
that you must for some strange reason have a working copy. It doesn't
really matter what's in your working copy as long as you have a
working copy. Yes, the "svn propedit --revprop" doesn't change a thing
in the working copy, and the change in the repository takes place
immediately without a commit, but you can't run this command against a
URL.

Correcting a bad commit is a bit more problematic because, unless
you're willing to shutdown your Subversion repository and then do a
dump and load, there is no real way to erase a committed revision.

You can back out the change doing a reverse merge, but that will
entail another commit against the already bad one you did before. It
will be enshrined forever in the Subversion repository history that
you did a big goof.

On Sat, Mar 28, 2009 at 2:30 PM, Kynn Jones <ky...@gmail.com> wrote:
> By mistake, I ran the following command while in the wrong directory:
> svn commit -m 'a lengthy description string'
> This was a big mistake: The directory in question was not even part of the
> project that I thought I was working with!  Hence, the lengthy message that
> I passed as the argument to the -m option is wholly inappropriate, and in
> fact misleading.  (In addition, a couple of files got committed prematurely
> to the repository, but this is the lesser problem.)
>
> Is there a straightforward way to undo this mistake, and delete the
> incorrect message?
> I assume the answer is no, since Subversion is designed to "keep
> everything".  In this case, what's the best approximation to a full delete
> of this incorrect message?
> TIA!
> Kynn
>
>



-- 
--
David Weintraub
qazwart@gmail.com

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=1484102

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].


Re: How to undo a commit?

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Mar 28, 2009, at 13:38, B Smith-Mannschott wrote:

> On Sat, Mar 28, 2009 at 19:30, Kynn Jones wrote:
>
>> By mistake, I ran the following command while in the wrong directory:
>> svn commit -m 'a lengthy description string'
>> This was a big mistake: The directory in question was not even  
>> part of the
>> project that I thought I was working with!  Hence, the lengthy  
>> message that
>> I passed as the argument to the -m option is wholly inappropriate,  
>> and in
>> fact misleading.  (In addition, a couple of files got committed  
>> prematurely
>> to the repository, but this is the lesser problem.)
>>
>> Is there a straightforward way to undo this mistake, and delete the
>> incorrect message?
>> I assume the answer is no, since Subversion is designed to "keep
>> everything".  In this case, what's the best approximation to a  
>> full delete
>> of this incorrect message?
>
> http://subversion.tigris.org/faq.html#change-log-msg

Right, that will help you change the commit message after the fact.  
So you could edit the log message to say "Accidental commit; reverted  
in r123".

But first, to actually revert the changes, you could do a reverse  
merge, described here:

http://svnbook.red-bean.com/en/1.5/ 
svn.branchmerge.basicmerging.html#svn.branchmerge.basicmerging.undo

Once you commit that reverse merge, then you'll have the revision  
number so that you can rewrite the log message as above.

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=1462345

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].

Re: How to undo a commit?

Posted by B Smith-Mannschott <bs...@gmail.com>.
On Sat, Mar 28, 2009 at 19:30, Kynn Jones <ky...@gmail.com> wrote:
> By mistake, I ran the following command while in the wrong directory:
> svn commit -m 'a lengthy description string'
> This was a big mistake: The directory in question was not even part of the
> project that I thought I was working with!  Hence, the lengthy message that
> I passed as the argument to the -m option is wholly inappropriate, and in
> fact misleading.  (In addition, a couple of files got committed prematurely
> to the repository, but this is the lesser problem.)
>
> Is there a straightforward way to undo this mistake, and delete the
> incorrect message?
> I assume the answer is no, since Subversion is designed to "keep
> everything".  In this case, what's the best approximation to a full delete
> of this incorrect message?

http://subversion.tigris.org/faq.html#change-log-msg

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=1459435

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].