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

Re: Diffs into default log template

From: Chris Pepper <pepper_at_reppep.com>
Date: 2004-10-14 06:33:00 CEST

At 1:55 PM +0100 2004/10/12, Julian Foad wrote:
>Chris Pepper wrote:
>> The default log "template" provided by "svn commit", listing
>>files that are changed for review is quite useful. It would be even
>>more useful if it showed the actual diffs about to be applied, so I
>>could make sure my log message is complete and in sync with what
>>I'm about to actually commit.
>>
>> Is there a way to accomplish this?
>
>I create my log message like this:
>
>svnlogmsg | vim -
>
>where 'svnlogmsg' is a script I wrote (attached) to write the diff
>and also write the names of files and functions changed, in the
>format specified in HACKING; and 'vim -' invokes my editor starting
>with text read from standard input.

Julian,

        This is neat, but since I'm working with docs instead of
functions, svnlog doesn't seem to get me anything more than "svn diff
| bbedit", which I've been using. I'd like something to dump it into
the log template, to save me a step.

        I think what I really want would be a second loop in util.c,
after the list of files with status has been generated. If a (new)
flag was set, svn would loop across the files to be committed again,
appending a diff for each one on this round. It would be cleaned out
of the actual log message automatically, same as the current list of
files is ignored.

        Would anyone else find this useful??

                                                Chris Pepper

> for (i = 0; i < commit_items->nelts; i++)
> {
> svn_client_commit_item_t *item
> = ((svn_client_commit_item_t **) commit_items->elts)[i];
> const char *path = item->path;
> char text_mod = '_', prop_mod = ' ';
>
> if (! path)
> path = item->url;
> else if (! *path)
> path = ".";
>
> if (path && lmb->base_dir)
> path = svn_path_is_child (lmb->base_dir, path, pool);
>
> /* If still no path, then just use current directory. */
> if (! path)
> path = ".";
>
> if ((item->state_flags & SVN_CLIENT_COMMIT_ITEM_DELETE)
> && (item->state_flags & SVN_CLIENT_COMMIT_ITEM_ADD))
> text_mod = 'R';
> else if (item->state_flags & SVN_CLIENT_COMMIT_ITEM_ADD)
> text_mod = 'A';
> else if (item->state_flags & SVN_CLIENT_COMMIT_ITEM_DELETE)
> text_mod = 'D';
> else if (item->state_flags & SVN_CLIENT_COMMIT_ITEM_TEXT_MODS)
> text_mod = 'M';
>
> if (item->state_flags & SVN_CLIENT_COMMIT_ITEM_PROP_MODS)
> prop_mod = 'M';
>
> svn_stringbuf_appendbytes (tmp_message, &text_mod, 1);
> svn_stringbuf_appendbytes (tmp_message, &prop_mod, 1);
> svn_stringbuf_appendcstr (tmp_message, " ");
> svn_stringbuf_appendcstr (tmp_message, path);
> svn_stringbuf_appendcstr (tmp_message, APR_EOL_STR);
> }

--
Chris Pepper:               <http://www.reppep.com/~pepper/>
Rockefeller University:     <http://www.rockefeller.edu/>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Oct 14 15:32:24 2004

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.