You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by da...@apache.org on 2013/07/27 17:16:21 UTC

svn commit: r1507663 - /subversion/trunk/tools/dist/backport.pl

Author: danielsh
Date: Sat Jul 27 15:16:21 2013
New Revision: 1507663

URL: http://svn.apache.org/r1507663
Log:
backport.pl: Use 'svnauth list' to determine the username, if possible.

* tools/dist/backport.pl
  ($SVNAUTH): New global.
  ($AVAILID): Set from `svnauth list` output, if svnauth is available.

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=1507663&r1=1507662&r2=1507663&view=diff
==============================================================================
--- subversion/trunk/tools/dist/backport.pl (original)
+++ subversion/trunk/tools/dist/backport.pl Sat Jul 27 15:16:21 2013
@@ -30,6 +30,7 @@ use POSIX qw/ctermid/;
 ############### Start of reading values from environment ###############
 
 # Programs we use.
+my $SVNAUTH = $ENV{SVNAUTH} // 'svnauth'; # optional dependency
 my $SVN = $ENV{SVN} || 'svn'; # passed unquoted to sh
 my $SHELL = $ENV{SHELL} // '/bin/sh';
 my $VIM = 'vim';
@@ -49,9 +50,13 @@ my $VERBOSE = 0;
 my $DEBUG = (exists $ENV{DEBUG}) ? 'true' : 'false'; # 'set -x', etc
 
 # Username for entering votes.
+my $SVN_A_O_REALM = '<https://svn.apache.org:443> ASF Committers';            
 my ($AVAILID) = $ENV{AVAILID} // do {
-  my $SVN_A_O_REALM = 'd3c8a345b14f6a1b42251aef8027ab57';
-  open USERNAME, '<', "$ENV{HOME}/.subversion/auth/svn.simple/$SVN_A_O_REALM";
+  local $_ = `$SVNAUTH list 2>/dev/null`;
+  ($? == 0) ? (/Auth.*realm: \Q$SVN_A_O_REALM\E\nUsername: (.*)/, $1) : undef
+} // do {
+  my $filename = Digest->new("MD5")->add($SVN_A_O_REALM)->hexdigest;
+  open USERNAME, '<', "$ENV{HOME}/.subversion/auth/svn.simple/$filename";
   1 until <USERNAME> eq "username\n";
   <USERNAME>;
   local $_ = <USERNAME>;