[Gnucash-changes] r11839 - meta/hooks - Diff-less gnucash-patches emails ... should work. :/

Joshua Sled jsled at cvs.gnucash.org
Sat Nov 5 12:09:29 EST 2005


Author: jsled
Date: 2005-11-05 12:09:29 -0500 (Sat, 05 Nov 2005)
New Revision: 11839

Modified:
   meta/hooks/commit-email.pl
   meta/hooks/post-commit
Log:
Diff-less gnucash-patches emails ... should work. :/


Modified: meta/hooks/commit-email.pl
===================================================================
--- meta/hooks/commit-email.pl	2005-11-05 15:53:47 UTC (rev 11838)
+++ meta/hooks/commit-email.pl	2005-11-05 17:09:29 UTC (rev 11839)
@@ -111,7 +111,9 @@
                        '-l'     => 'log_file',
                        '-m'     => '',
                        '-r'     => 'reply_to',
-                       '-s'     => 'subject_prefix');
+                       '-s'     => 'subject_prefix',
+                       '-n'     => ''
+                       );
 
 while (@ARGV)
   {
@@ -124,7 +126,7 @@
             die "$0: command line option `$arg' is not recognized.\n";
           }
 
-        unless (@ARGV)
+        unless ($arg eq '-n' or @ARGV)
           {
             die "$0: command line option `$arg' is missing a value.\n";
           }
@@ -136,14 +138,21 @@
           }
         else
           {
-            # Here handle -m.
-            unless ($arg eq '-m')
+              # Here handle -m, -n
+              if ($arg eq '-m')
               {
-                die "$0: internal error: should only handle -m here.\n";
+                  $current_project                = &new_project;
+                  $current_project->{match_regex} = $value;
+                  push(@project_settings_list, $current_project);
               }
-            $current_project                = &new_project;
-            $current_project->{match_regex} = $value;
-            push(@project_settings_list, $current_project);
+              elsif ($arg eq '-n')
+              {
+                  $current_project->{generate_diff} = 0;
+              }
+              else
+              {
+                  die "$0: internal error: should only handle -m, -n here.\n";
+              }
           }
       }
     elsif ($arg =~ /^-/)
@@ -288,9 +297,13 @@
 # Get the diff from svnlook.
 my @no_diff_deleted = $no_diff_deleted ? ('--no-diff-deleted') : ();
 my @no_diff_added = $no_diff_added ? ('--no-diff-added') : ();
-my @difflines = &read_from_process($svnlook, 'diff', $repos,
-                                   '-r', $rev, @no_diff_deleted,
-                                   @no_diff_added);
+my @difflines = ();
+if ($current_project->{generate_diff})
+{
+    @difflines = &read_from_process($svnlook, 'diff', $repos,
+                                    '-r', $rev, @no_diff_deleted,
+                                    @no_diff_added);
+}
 
 ######################################################################
 # Modified directory name collapsing.
@@ -372,7 +385,10 @@
 push(@body, "Log:\n");
 push(@body, @log);
 push(@body, "\n");
-push(@body, map { /[\r\n]+$/ ? $_ : "$_\n" } @difflines);
+if ($current_project->{generate_diff})
+{
+    push(@body, map { /[\r\n]+$/ ? $_ : "$_\n" } @difflines);
+}
 
 # Go through each project and see if there are any matches for this
 # project.  If so, send the log out.
@@ -511,6 +527,7 @@
       "  -m regex              Regular expression to match committed path\n",
       "  -r email_address      Email address for 'Reply-To:'\n",
       "  -s subject_prefix     Subject line prefix\n",
+      "  -n                    No diff in generated mail\n",
       "\n",
       "This script supports a single repository with multiple projects,\n",
       "where each project receives email only for commits that modify that\n",
@@ -542,7 +559,8 @@
           log_file        => '',
           match_regex     => '.',
           reply_to        => '',
-          subject_prefix  => ''};
+          subject_prefix  => '',
+          generate_diff   => 1};
 }
 
 # Start a child process safely without using /bin/sh.

Modified: meta/hooks/post-commit
===================================================================
--- meta/hooks/post-commit	2005-11-05 15:53:47 UTC (rev 11838)
+++ meta/hooks/post-commit	2005-11-05 17:09:29 UTC (rev 11839)
@@ -47,7 +47,10 @@
 REV="$2"
 
 COMMIT_EMAIL=${REPOS}/hooks/commit-email.pl
+# with diffs...
 ${COMMIT_EMAIL} "$REPOS" "$REV" gnucash-changes at gnucash.org
+# ('-n'=) without diffs... 
+${COMMIT_EMAIL} -n "$REPOS" "$REV" gnucash-patches at gnucash.org
 
 # 2005-11-02, jsled: If the commit changed meta/hooks/, then update the repository's hooks dir.
 SVNLOOK=/usr/bin/svnlook



More information about the gnucash-changes mailing list