info-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: diff in commit message (was: Multiple-line log message)


From: Gerhard Sittig
Subject: Re: diff in commit message (was: Multiple-line log message)
Date: Thu, 26 Oct 2000 23:19:42 +0200

On Tue, Oct 24, 2000 at 14:21 -0500, Richard J. Duncan wrote:
> > 
> > Does anyone know a method how to incorporate "cvs diff" into
> > the "cvs commit" message and thus aid the committer with
> > showing what has changed when he is asked to specify what he
> > did and why?
> > 
> > As a background:  At the moment I employ a homegrown wrapper
> > script around RCS to catch the diff before invoking an editor
> > with the diff log and the "tell me why you did it" message.
> > 
> > [ ... ]
> 
> I think hacking the source is overkill.
> 
> Your locking problem can be solved by running diff with the -n
> option (proceed without lock).

You pushed me in the right direction!  Although -n means "don't
actually do it", I found out about the (general) -R option for
"the repo is on a ro medium".  And since I'm used to feed back to
where I get something from, here's what I came up with until now
after a (very) little toying:

export CVSEDITOR=/path/to/cvscommiteditor.sh
export EDITOR=/whatever/you/are/used/to

#!/bin/sh
# ----- cvscommiteditor.sh ------------------
FILE=$1
cvs -R diff | sed 's/^/CVS: /' >> $FILE
${EDITOR:-vi} "$@"
# ----- E O F -------------------------------

I'm still not sure if this $CVSEDITOR script will always get only
this one argument.  But it looks like it was so.

The next step could be to fetch the list of involved files from
$FILE and draw the diff just over them.  This would better
reflect what will be covered by commit.  This probably would be
with a perl script extracting the "modified / added / removed"
(pretty printed) section.  The only sorrow I could see arise is
when somebody has the Bright Idea(TM) to translate or beautify
the prefix strings and thus breaks recognition.  It's already bad
enough when people think to know how wide my screen is (think of
80 char text in 80 char wide terminals in vi with "se nu" on).

> Do you want to see the diff output to assist in typing the
> "this is what I did" message?

Yes, exactly.  I'm aware of the fact that commenting on what the
code next to the comment _does_ is somewhat pointless (the code
should be written in a way to make this clear already).  Instead
the comment should give hints about what the code is trying to
_achieve_ and respect that the particular algorithm is just an
implementation detail and actually doesn't matter in the abstract
problem solution.

It's exactly the "what was done" against the "what was meant to
be done" thing.  We don't change code for fun but to achieve
results, don't we? :)


On Thu, Oct 26, 2000 at 10:19 -0400, Derek R. Price wrote:
> Mike Castle wrote:
> 
> > On Tue, Oct 24, 2000 at 08:54:37PM +0200, Gerhard Sittig wrote:
> > > 
> > > Does anyone know a method how to incorporate "cvs diff"
> > > into the "cvs commit" message and thus aid the committer
> > > with showing what has changed when he is asked to specify
> > > what he did and why?
> >
> > I would have to say, this is probably the ugliest idea I have
> > ever seen.  You really want to do this on a regular basis?
> > Why?  this information can ALWAYS be regenerated outside of
> > the log message.
> 
> I have to agree with Mike and Richard that your proposal seems
> to implement redundant functionality.  I might put diffs in
> emails (a function there are scripts out there for already),
> but CVS will already allow me to view diffs and log messages so
> diffs in log messages seems like wasted space and useless
> clutter.

Umm, obviously I've been unclear there. :)  Of course it doesn't
make much of a sense to put the diffs into the commit message.  I
meant to get them somehow into the "template" the editor sees to
aid the user in his thinking "what was it that I did to the
code?".  And yes, a wrapper could have done.  But telling the
users to issue "cvs ci" as they are used to from everywhere and
can read in all the doc is easier than teaching them to specify
"mycvs ci" which is nonstandard and confusing.  And yes, even
"missing" mycvs wrappers can be handled by doing "cvs diff; cvs
ci" -- but it always is extra work and can easily be thought
about and handled once and for all.


virtually yours   82D1 9B9C 01DC 4FB4 D7B4  61BE 3F49 4F77 72DE DA76
Gerhard Sittig   true | mail -s "get gpg key" address@hidden
-- 
     If you don't understand or are scared by any of the above
             ask your parents or an adult to help you.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]