You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Julian Foad <ju...@btopenworld.com> on 2008/11/05 23:00:30 UTC

Diffs in log messages [was: svn commit: propchange - r34067 - svn:log]

On Wed, 2008-11-05 at 12:10 -0800, Greg Stein wrote:
> Seriously... are we going to have to install a pre-commit hook to fail
> if people keep inserting diffs into the log message?

Maybe it's only me that keeps inserting diffs in the log message. I'll
keep an eye open for ways to change my working practices to avoid this,
but I can't see it's very likely at this point. At the moment I normally
keep patches (with log message and diff) until ready to commit, and then
try to remember to delete the diff and use the file as the log message
with "svn ci -F/--file FILE". I should get around to trying SVK some
time. I need local commits!

Or Perforce "changelist" feature that stores both a list of what files
I'm working on and the log message that goes with them.

- Julian


> On Wed, Nov 5, 2008 at 12:08 PM,  <gs...@tigris.org> wrote:
> > Author: gstein
> > Revision: 34067
> > Property Name: svn:log
> > Action: modified
> >
> > Property diff:
> > --- old property value
> > +++ new property value
> > @@ -38,243 +38,3 @@ Make the tree conflicts WC API more cons
> >  * subversion/libsvn_wc/update_editor.c
> >   (check_tree_conflict): Adjust calls accordingly.
> >   (add_file): Adjust commented-out code accordingly.
> > -
> > -Index: subversion/include/svn_wc.h
> > -===================================================================
> > ---- subversion/include/svn_wc.h        (revision 34061)
> > -+++ subversion/include/svn_wc.h        (working copy)
> > -@@ -5278,17 +5278,16 @@ svn_wc_get_tree_conflict(svn_wc_conflict
> > -                          svn_wc_adm_access_t *adm_access,
> > -                          apr_pool_t *pool);
> > -
> > --/**
> > -- * Add the tree conflict described by @a conflict to the directory entry
> > -- * belonging to @a adm_access.
> > -- * Do all allocations in @a pool.
> > -+/** Record the tree conflict described by @a conflict in the WC.
> > -+ * @a adm_access must be a write-access baton for the parent directory of
> > -+ * @a victim->path. Use @a pool for all allocations.
> > -  *
[...]



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

Re: Diffs in log messages

Posted by Julian Foad <ju...@btopenworld.com>.
On Sun, 2008-11-09 at 02:20 +0100, Neels J Hofmeyr wrote:
> I did find some peculiar behaviour (attached) when changing the very first
> line of a function (which "trickles" down consecutive changes), or when
> changing a function name. Fair enough, I read the diffs anyway.
> 
> It's not completely 100% reliable, but it's really really close, considering
> that real-world changes will almost certainly show all the correct function
> names (and maybe some more). What a great help this will be! Thanks a lot!

About reliability: Yes, it's poor. It just uses diff's
"-p/--show-c-function" option which is really hacky and simply prints
the last-seen line that looks like a function declaration before the
hunk it prints. It doesn't work properly for many situations including
added/deleted functions, and when the function declaration appears in
the context lines of the hunk, and when editing the doc string before a
function declaration. Both GNU diff's and svn diff's "-p" options are
like this.

- Julian



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

Re: Diffs in log messages

Posted by Neels J Hofmeyr <ne...@elego.de>.
Julian Foad wrote:
> Yes: attached is my "svnlogmsg" script. It prints a log message
> skeleton, plus a diff, to stdout. I use it like this:
> 
> [[[
> svnlogmsg > ff
> vim ff  # I edit the message, and delete the diff
> svn ci -F ff && rm ff
> ]]]


Wow, Julian, that's so awesome!

I did find some peculiar behaviour (attached) when changing the very first
line of a function (which "trickles" down consecutive changes), or when
changing a function name. Fair enough, I read the diffs anyway.

It's not completely 100% reliable, but it's really really close, considering
that real-world changes will almost certainly show all the correct function
names (and maybe some more). What a great help this will be! Thanks a lot!

~Neels


Re: Diffs in log messages [was: svn commit: propchange - r34067 - svn:log]

Posted by Julian Foad <ju...@btopenworld.com>.
On Thu, 2008-11-06 at 19:58 -0600, Peter Samuelson wrote:
> | #!/bin/bash
> | # Write a log message template, listing the files that would be committed.
> | FILES=`svn st "$@" | grep "^[^?]" | grep -v "^  L" | sed 's/^.......//' | sort`
>                                                  or  | cut -c8- | sort
> 
> | echo
> | for FILE in $FILES; do
> |   echo "* $FILE"
> |   # Find the names of the functions affected, and list them in parentheses.
> |   svn diff --diff-cmd diff -x '-U0 -p' $FILE | sed -e "s/^@@ [^@]* @@ .*\<\([A-Za-z_][A-Za-z0-9_]*\) *(.*/  (\1): /" -e "t" -e "d" | uniq
> |   echo
> | done
> 
> echo '--This line, and those below, will be ignored--'

Heh! That's brilliant. Thanks. It never occurred to me.

> | # (when in sorted order) svn diff -x -up "$@"
> | for FILE in $FILES; do
> |   svn diff --diff-cmd diff -x -up $FILE
> | done
> 
> Why not just call svn diff with $FILES ?

Because
  (a) I want the files to appear in the same order here (a diff with
context) as they do when generating the message template above (where I
use no context, '-U0', in order to get more accurate reporting of the
function names). Subversion doesn't guarantee that diffs come out in the
same order each time.
  (b) I want the order to be a sensible sorted order. Subversion doesn't
do that.

- Julian


Re: Diffs in log messages [was: svn commit: propchange - r34067 - svn:log]

Posted by Peter Samuelson <pe...@p12n.org>.
| #!/bin/bash
| # Write a log message template, listing the files that would be committed.
| FILES=`svn st "$@" | grep "^[^?]" | grep -v "^  L" | sed 's/^.......//' | sort`
                                                 or  | cut -c8- | sort

| echo
| for FILE in $FILES; do
|   echo "* $FILE"
|   # Find the names of the functions affected, and list them in parentheses.
|   svn diff --diff-cmd diff -x '-U0 -p' $FILE | sed -e "s/^@@ [^@]* @@ .*\<\([A-Za-z_][A-Za-z0-9_]*\) *(.*/  (\1): /" -e "t" -e "d" | uniq
|   echo
| done

echo '--This line, and those below, will be ignored--'

| # (when in sorted order) svn diff -x -up "$@"
| for FILE in $FILES; do
|   svn diff --diff-cmd diff -x -up $FILE
| done

Why not just call svn diff with $FILES ?
-- 
Peter Samuelson | org-tld!p12n!peter | http://p12n.org/

Re: Diffs in log messages [was: svn commit: propchange - r34067 - svn:log]

Posted by Julian Foad <ju...@btopenworld.com>.
On Fri, 2008-11-07 at 00:09 +0100, Neels J. Hofmeyr wrote:
> 
> Julian Foad wrote:
> > On Wed, 2008-11-05 at 12:10 -0800, Greg Stein wrote:
> >> Seriously... are we going to have to install a pre-commit hook to fail
> >> if people keep inserting diffs into the log message?
> > 
> > Maybe it's only me that keeps inserting diffs in the log message. I'll
> > keep an eye open for ways to change my working practices to avoid this,
> > but I can't see it's very likely at this point. At the moment I normally
> > keep patches (with log message and diff) until ready to commit, and then
> > try to remember to delete the diff and use the file as the log message
> > with "svn ci -F/--file FILE".
> 
> Hm, I just keep a separate "log" file in each working copy root. It's handy
> for me to have two separate vims open on the diff and the log message, much
> easier copy-pasting of file/function names via Shift-middle-mouse-button.
> 
> Has someone actually come up with a script to automatically print a log
> message skeleton with all files and function names in it? Would be nice to
> save us that copy-paste orgy each time we commit.

Yes: attached is my "svnlogmsg" script. It prints a log message
skeleton, plus a diff, to stdout. I use it like this:

[[[
svnlogmsg > ff
vim ff  # I edit the message, and delete the diff
svn ci -F ff && rm ff
]]]

or, another example, from within Vim:

[[[
# make a new file and read in a log skeleton:
:e ff
:r !svnlogmsg subversion/include/
# edit the text and delete the diff
# ...
# commit from within Vim
:!svn ci -F ff && rm ff
]]]

Hope it's useful or inspiring.

- Julian


Re: Diffs in log messages [was: svn commit: propchange - r34067 - svn:log]

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Neels J Hofmeyr wrote on Sun, 9 Nov 2008 at 02:34 +0100:
> 
> 

(why do you have two empty lines here?)

> Daniel Shahaf wrote:
> >     :let @a = ''
> >     :g/Index/y A
> >     # etc
> 
> ... huh?
> * neels tries it out
> 
> Oh, I see. I'm not familiar with these commands, so I had to still figure
> out that the result is stored in register 'a'. Just for completeness:
> command  "a  pastes register 'a'.
> 

Yes.  ":yank A" appends the line to register 'a' (which might be
non-empty at the start if, e.g., ':help q' was used).  Then I can paste
from the register by doing gg"aP and remove the "Index: " prefixes with
some visual block mode work (or :s///, if you like that better).  Pretty
fast once you're used to it.

    :help :let-@
    :help :y
    :help blockwise-visual

> But this doesn't show the *function* names affected. That's the real great
> help that I need.
> 

For me it's enough to have them in the diff -x-p headers in the other
window and use ^N.  :-)

(Having a mini-indent plugin (that saves typing the two spaces in front
of every open paren) helps, too.)

> About contrib/client-side/vim/diff-to-logmsg.vim: I prefer Julian's shell
> script version.
> 

Haven't tried it yet; should though. :)

> ~Neels
> 
> 
> 

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

Re: Diffs in log messages [was: svn commit: propchange - r34067 - svn:log]

Posted by Neels J Hofmeyr <ne...@elego.de>.

Daniel Shahaf wrote:
>> Has someone actually come up with a script to automatically print a log
>> message skeleton with all files and function names in it? Would be nice to
>> save us that copy-paste orgy each time we commit.
> 
> contrib/client-side/vim/diff-to-logmsg.vim ?

Heh, you keep pointing me there, thanks. Next time I'll look there first
before posting.

> Daniel
> (who still uses
> 
>     :let @a = ''
>     :g/Index/y A
>     # etc

... huh?
* neels tries it out

Oh, I see. I'm not familiar with these commands, so I had to still figure
out that the result is stored in register 'a'. Just for completeness:
command  "a  pastes register 'a'.

But this doesn't show the *function* names affected. That's the real great
help that I need.

About contrib/client-side/vim/diff-to-logmsg.vim: I prefer Julian's shell
script version.

~Neels



Re: Diffs in log messages [was: svn commit: propchange - r34067 - svn:log]

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Neels J. Hofmeyr wrote on Fri, 7 Nov 2008 at 00:09 +0100:
> Julian Foad wrote:
> > On Wed, 2008-11-05 at 12:10 -0800, Greg Stein wrote:
> >> Seriously... are we going to have to install a pre-commit hook to fail
> >> if people keep inserting diffs into the log message?
> > 
> > Maybe it's only me that keeps inserting diffs in the log message. I'll
> > keep an eye open for ways to change my working practices to avoid this,
> > but I can't see it's very likely at this point. At the moment I normally
> > keep patches (with log message and diff) until ready to commit, and then
> > try to remember to delete the diff and use the file as the log message
> > with "svn ci -F/--file FILE".
> 
> Hm, I just keep a separate "log" file in each working copy root. It's handy
> for me to have two separate vims open on the diff and the log message, much
> easier copy-pasting of file/function names via Shift-middle-mouse-button.
> 
> Has someone actually come up with a script to automatically print a log
> message skeleton with all files and function names in it? Would be nice to
> save us that copy-paste orgy each time we commit.

contrib/client-side/vim/diff-to-logmsg.vim ?


Daniel
(who still uses

    :let @a = ''
    :g/Index/y A
    # etc

to start his log messages.)

> 
> ~Neels

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

Re: Diffs in log messages [was: svn commit: propchange - r34067 - svn:log]

Posted by "Neels J. Hofmeyr" <ne...@elego.de>.

Julian Foad wrote:
> On Wed, 2008-11-05 at 12:10 -0800, Greg Stein wrote:
>> Seriously... are we going to have to install a pre-commit hook to fail
>> if people keep inserting diffs into the log message?
> 
> Maybe it's only me that keeps inserting diffs in the log message. I'll
> keep an eye open for ways to change my working practices to avoid this,
> but I can't see it's very likely at this point. At the moment I normally
> keep patches (with log message and diff) until ready to commit, and then
> try to remember to delete the diff and use the file as the log message
> with "svn ci -F/--file FILE".

Hm, I just keep a separate "log" file in each working copy root. It's handy
for me to have two separate vims open on the diff and the log message, much
easier copy-pasting of file/function names via Shift-middle-mouse-button.

Has someone actually come up with a script to automatically print a log
message skeleton with all files and function names in it? Would be nice to
save us that copy-paste orgy each time we commit.

~Neels

 I should get around to trying SVK some
> time. I need local commits!
> 
> Or Perforce "changelist" feature that stores both a list of what files
> I'm working on and the log message that goes with them.
> 
> - Julian
> 
> 
>> On Wed, Nov 5, 2008 at 12:08 PM,  <gs...@tigris.org> wrote:
>>> Author: gstein
>>> Revision: 34067
>>> Property Name: svn:log
>>> Action: modified
>>>
>>> Property diff:
>>> --- old property value
>>> +++ new property value
>>> @@ -38,243 +38,3 @@ Make the tree conflicts WC API more cons
>>>  * subversion/libsvn_wc/update_editor.c
>>>   (check_tree_conflict): Adjust calls accordingly.
>>>   (add_file): Adjust commented-out code accordingly.
>>> -
>>> -Index: subversion/include/svn_wc.h
>>> -===================================================================
>>> ---- subversion/include/svn_wc.h        (revision 34061)
>>> -+++ subversion/include/svn_wc.h        (working copy)
>>> -@@ -5278,17 +5278,16 @@ svn_wc_get_tree_conflict(svn_wc_conflict
>>> -                          svn_wc_adm_access_t *adm_access,
>>> -                          apr_pool_t *pool);
>>> -
>>> --/**
>>> -- * Add the tree conflict described by @a conflict to the directory entry
>>> -- * belonging to @a adm_access.
>>> -- * Do all allocations in @a pool.
>>> -+/** Record the tree conflict described by @a conflict in the WC.
>>> -+ * @a adm_access must be a write-access baton for the parent directory of
>>> -+ * @a victim->path. Use @a pool for all allocations.
>>> -  *
> [...]
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: dev-help@subversion.tigris.org
>