https://svn.lrde.epita.fr/svn/lrde-tools/trunk
Index: ChangeLog from Roland Levillain roland@lrde.epita.fr
Factor the implementation of git-lrde dcommit.
* src/git-lrde (lrde_dcommit): Factor redundant code, by using lrde_send_email.
git-lrde | 54 ++++++------------------------------------------------ 1 file changed, 6 insertions(+), 48 deletions(-)
Index: src/git-lrde --- src/git-lrde (revision 492) +++ src/git-lrde (working copy) @@ -84,63 +84,21 @@ EOF }
-# FIXME: Factor lrde_dcommit and lrde_send_email. - # lrde_dcommit # ------------ lrde_dcommit() { count=$((`git log | sed '/ git-svn-id: /q' | grep -c '^commit'` - 1)) - test $count -gt 0 || die "No patch to send." - - # Sender. - test -n "$FULLNAME" || die "No environment variable FULLNAME set." - test -n "$EMAIL" || die "No environment variable EMAIL set." - sender="$FULLNAME <$EMAIL>" - - # Recipient. - # Look for a project mailing list e-mail address in Vcs helper. - for f in . .. ../.. ../../..; do - test -f "$f"/vcs/*.rb || continue - recipient=`sed -n 's/.*mail.*[(.*@.*)].*/\1/p' "$f"/vcs/*.rb` - test -z "$recipient" || break - done - if test -z "$recipient"; then - echo 1>&2 "Don't know where to mail patches." - exit 1 - else - echo Mailing patches to $recipient - fi - - # FIXME: Allow the sender to add his own message to the e-mail. - - # Get the last commited N patches. - git format-patch -C --numbered-files HEAD~$count - # Send them to the Subversion server. git svn dcommit - # Refresh the list of patches, to get their Subversion revisions. - git format-patch -C --numbered-files HEAD~$count - - for i in `seq 1 $count`; do - rev=$(grep -E '^git-svn-id:.*@[^ ]+' $i | sed 's/.*@([^ ]+).*/\1/') - echo "Sending mail for $rev..." - ( - echo "To: $recipient" - sed -e "1d" \ - -e "/^Subject:/s/[PATCH]/$rev:/" \ - -e "/^git-svn-id:/d" \ - -e "s/^From: .*/From: $sender/" \ - $i - rm -f $i - ) | /usr/sbin/sendmail -t - done + lrde_send_email "$count" }
-# lrde_send-email N +# lrde_send_email N # ----------------- -# FIXME: Instead of a numeric argument, we should allow a description -# of the patches to be send (e.g. `HEAD~3'). -# Or we should allow one to pass a list of SVN revisions instead. +# FIXME: Improve the interface of `lrde_send_email': instead of +# accepting (only) numeric arguments, we should (also) accept other +# definitions of the patches to send (e.g. `HEAD~3', or a list of SVN +# revisions. lrde_send_email() { count=$1