Return-Path: X-Original-To: apmail-subversion-commits-archive@minotaur.apache.org Delivered-To: apmail-subversion-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 65E0610ED5 for ; Wed, 21 Aug 2013 04:34:48 +0000 (UTC) Received: (qmail 92804 invoked by uid 500); 21 Aug 2013 04:34:48 -0000 Delivered-To: apmail-subversion-commits-archive@subversion.apache.org Received: (qmail 92757 invoked by uid 500); 21 Aug 2013 04:34:48 -0000 Mailing-List: contact commits-help@subversion.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@subversion.apache.org Delivered-To: mailing list commits@subversion.apache.org Received: (qmail 92745 invoked by uid 99); 21 Aug 2013 04:34:46 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 21 Aug 2013 04:34:46 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 21 Aug 2013 04:34:45 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 9792A23888CD; Wed, 21 Aug 2013 04:34:25 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: svn commit: r1516082 - /subversion/trunk/tools/dist/backport.pl Date: Wed, 21 Aug 2013 04:34:25 -0000 To: commits@subversion.apache.org From: danielsh@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20130821043425.9792A23888CD@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: danielsh Date: Wed Aug 21 04:34:25 2013 New Revision: 1516082 URL: http://svn.apache.org/r1516082 Log: backport.pl interactive mode: Microƶptimization. Teach the state calculation to ignore trailing whitespace when determining whether an entry has been added to the "Don't prompt again" state. * tools/dist/backport.pl (digest_entry): New. (parse_entry, vote): Use new function to compute entry digests. Modified: subversion/trunk/tools/dist/backport.pl Modified: subversion/trunk/tools/dist/backport.pl URL: http://svn.apache.org/viewvc/subversion/trunk/tools/dist/backport.pl?rev=1516082&r1=1516081&r2=1516082&view=diff ============================================================================== --- subversion/trunk/tools/dist/backport.pl (original) +++ subversion/trunk/tools/dist/backport.pl Wed Aug 21 04:34:25 2013 @@ -182,6 +182,14 @@ sub digest_string { Digest->new("MD5")->add(@_)->hexdigest } +sub digest_entry($) { + # Canonicalize the number of trailing EOLs to two. This matters when there's + # on empty line after the last entry in Approved, for example. + local $_ = shift; + s/\n*\z// and $_ .= "\n\n"; + Digest->new("MD5")->add($_)->hexdigest +} + sub prompt { print $_[0]; shift; my %args = @_; @@ -422,7 +430,7 @@ sub parse_entry { entry => [@lines], accept => $accept, raw => $raw, - digest => digest_string($raw), + digest => digest_entry($raw), ); } @@ -460,7 +468,7 @@ sub vote { open VOTES, ">", "$STATUS.$$.tmp"; while () { $had_empty_line = /\n\n\z/; - my $key = digest_string $_; + my $key = digest_entry $_; $approvedcheck{$key}++ if exists $approved->{$key}; $votescheck{$key}++ if exists $votes->{$key}; @@ -492,7 +500,7 @@ sub vote { if ($vote eq 'edit') { local $_ = $entry->{raw}; - $votesarray[-1]->{digest} = digest_string $_; + $votesarray[-1]->{digest} = digest_entry $_; (exists $approved->{$key}) ? ($raw_approved .= $_) : (print VOTES); next; } @@ -501,7 +509,7 @@ sub vote { or s/(.*\w.*?\n)/"$1 $vote: $AVAILID\n"/se; $_ = edit_string $_, $entry->{header}, trailing_eol => 2 if $vote ne '+1'; - $votesarray[-1]->{digest} = digest_string $_; + $votesarray[-1]->{digest} = digest_entry $_; (exists $approved->{$key}) ? ($raw_approved .= $_) : (print VOTES); } close STATUS;