You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Tremal Naik <tr...@gmail.com> on 2007/08/02 13:44:28 UTC

commit-email.pl: problems with regex

Hi to the fellowship of Subversion,
I'm facing a problem with the commit-email.pl script. I can
successfully run it if invoked by the post-hook script like this:

commit-email.pl "$REPOS" "$REV" --from "no_replies@fuffa.com" --diff n
commit-watchers@fuffa.com

but when I try to use the '-m' switch to filter the project paths like this:

commit-email.pl "$REPOS" "$REV" -m ".*\/deploy\/.*" --from
"no_replies@fuffa.com" --diff n deploy-watchers@fuffa.com

It does't work. I think I'm invoking it correctly according to the synopsis:

"usage (commit mode):
  ./commit-email.pl REPOS REVNUM [[-m regex] [options] [email_addr ...]] ..."

Invoking the script from command line I get the error:

"./commit-email.pl: use of either `-h' or `--from' is mandatory when
sending email using direct SMTP."

and debugging the script with the perl debugger I see that the problem may be:

        else
          {
            if ($arg eq '-m')
              {
                $current_project                = &new_project;
                $current_project->{match_regex} = $value;
                push(@project_settings_list, $current_project);
              }

In fact, when the '-m' switch is invoked, the $current_project
variable is initialised again and pushed into the
@project_settings_list variable as element at index 1. When the
following block of code code is executed:

foreach my $project (@project_settings_list)
  {
    my $match_re = $project->{match_re};

the project at index 0 in the @project_settings_list is
un-initialized, hence the program exits with the above error.

Any hints?

I hope it's me doing something inappropriate

-- 
TREMALNAIK

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: commit-email.pl: problems with regex

Posted by Tremal Naik <tr...@gmail.com>.
2007/8/2, Tremal Naik <tr...@gmail.com>:
> I'm facing a problem with the commit-email.pl script. I can

I think I've found a solution, posting here FYI. I noticed other
people had the same problem.
The fix is really easy, it's sufficient changing the line:

my @project_settings_list = (&new_project);

to

my @project_settings_list = ();

even if this means that you'll always have to invoke the script with
the '-m' option, eventually to match any project (-m ".")



-- 
TREMALNAIK

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org