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

Re: terminating a commit..

From: Marshall White <marshall.white_at_pobox.com>
Date: 2007-03-03 18:38:18 CET

----- Original Message -----
From: "Vincent Lefevre"
Sent: Tuesday, February 27, 2007 12:10 PM
Subject: Re: terminating a commit..

> On 2007-02-26 17:11:38 +0100, Méresse Christophe wrote:
>> > I know how to uncommit code if necessary, but want I was
>> > wondering is, is there a way to terminate the commit once you
>> > are in the editor?
>>
>> Simply quit vi without saving, subversion will ask you if you want
>> to continue the commit or abort it.
>
> But this is a problem if the saved, and then decide not to commit.
> I can see two simple solutions:
>
> 1. If empty log messages are forbidden, save an empty file before
> quitting the editor.
>
> 2. Have an editor macro that kills the parent (not sure what signal
> is best) and quit the editor.
>
> --

If you are using "vim" and you have already saved your commit message, you
can exit vim with ":cq".
Vim will exit with an error code, and svn will not perform the commit.

$ svn commit
svn: Commit failed (details follow):
svn: system('vim svn-commit.tmp') returned 256

This ":cq" command is also very useful for getting out of the "svn diff"
cycle if you have vim set up to handle displaying diffs.
For instance, I have this script as my "diff-cmd":

$ cat ~/bin/vim_wrapper
#! /bin/bash

vim -R -d "$6" "$7"

if [ $? -ne 0 ] ; then
        exit 2
fi

If I am right in the middle of looking through several diffs, and need to
stop, I can just type ":cq" and svn will not show me the rest.

$ svn diff
Index: noise2.c
===================================================================
2 files to edit
Index: file name.c
===================================================================
2 files to edit
Index: shrink_wav.c
===================================================================
2 files to edit
svn: '/home/marshall/bin/vim_wrapper' returned 2

Other editors may have similar command to exit with error codes.

Marshall

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Sat Mar 3 18:38:48 2007

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.