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

Re: [PATCH] Making propchange-email.pl send diffs

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: 2004-03-26 22:58:26 CET

Julian Foad wrote:
>
> This patch allows propchange-email.pl to accept a diff file to put in
> the message instead of just a copy of the new property value. If the
> diff file is not supplied, it works as before. A diff file can be
> generated by the pre-revprop-change hook when issue 952 is fixed, or by
> the post-revprop-change hook if the pre- hook saved the previous value.

I have fixed issue 952 in r9211, and committed this enhancement to propchange-email.pl.in in r9216, so you can now have diffs e-mailed for revprop changes. The example below shows one way to do it.

- Julian

Index: pre-revprop-change.tmpl
===================================================================
--- pre-revprop-change.tmpl
+++ pre-revprop-change.tmpl (working copy)
@@ -45,5 +45,16 @@
 USER="$3"
 PROPNAME="$4"
 
-if [ "$PROPNAME" = "svn:log" ]; then exit 0; fi
-exit 1
+# Don't allow changes to revision properties other than svn:log
+if [ "$PROPNAME" != "svn:log" ]; then exit 1; fi
+
+# Generate a diff of the change, to be used by propchange-email.pl
+ID="r$REV-$USER"
+DIFF_FILE="$ID.diff"
+svnlook log -r "$REV" "$REPOS" > "$ID.old"
+cat - > "$ID.new"
+echo >> "$ID.new" # Add an extra newline, like svn and svnlook do.
+diff -u -L "$PROPNAME (old)" -L "$PROPNAME (new)" "$ID.old" "$ID.new" > "$DIFF_FILE"
+rm "$ID.old" "$ID.new"
+
+exit 0
Index: post-revprop-change.tmpl
===================================================================
--- post-revprop-change.tmpl
+++ post-revprop-change.tmpl (working copy)
@@ -37,4 +37,6 @@
 USER="$3"
 PROPNAME="$4"
 
-propchange-email.pl "$REPOS" "$REV" "$USER" "$PROPNAME" watchers@example.org
+DIFF_FILE="r$REV-$USER.diff"
+propchange-email.pl "$REPOS" "$REV" "$USER" "$PROPNAME" -d "$DIFF_FILE" watchers@example.org
+rm "$DIFF_FILE"

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Mar 26 22:54:40 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.