Merge branch 'mk/svn'
authorJunio C Hamano <gitster@pobox.com>
Sun, 1 Jul 2007 06:48:54 +0000 (23:48 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sun, 1 Jul 2007 06:48:54 +0000 (23:48 -0700)
* mk/svn:
git-svn: honor ~/.subversion/ client cert file settings.

1  2 
git-svn.perl
diff --combined git-svn.perl
index d5088eab9cacccb9bef2bd26acc65365ebe2f785,9dfea97fcd4bcdf400c64ecc6fd4ee0bbc5fa334..98687f54d79fa2f7212a5cdad80332b4231d50df
@@@ -787,12 -787,12 +787,12 @@@ sub read_repo_config 
  
  sub extract_metadata {
        my $id = shift or return (undef, undef, undef);
 -      my ($url, $rev, $uuid) = ($id =~ /^git-svn-id:\s(\S+?)\@(\d+)
 +      my ($url, $rev, $uuid) = ($id =~ /^\s*git-svn-id:\s+(.*)\@(\d+)
                                                        \s([a-f\d\-]+)$/x);
        if (!defined $rev || !$uuid || !$url) {
                # some of the original repositories I made had
                # identifiers like this:
 -              ($rev, $uuid) = ($id =~/^git-svn-id:\s(\d+)\@([a-f\d\-]+)/);
 +              ($rev, $uuid) = ($id =~/^\s*git-svn-id:\s(\d+)\@([a-f\d\-]+)/);
        }
        return ($url, $rev, $uuid);
  }
@@@ -804,29 -804,20 +804,29 @@@ sub cmt_metadata 
  
  sub working_head_info {
        my ($head, $refs) = @_;
 -      my ($fh, $ctx) = command_output_pipe('rev-list', $head);
 -      while (my $hash = <$fh>) {
 -              chomp($hash);
 -              my ($url, $rev, $uuid) = cmt_metadata($hash);
 +      my ($fh, $ctx) = command_output_pipe('log', $head);
 +      my $hash;
 +      my %max;
 +      while (<$fh>) {
 +              if ( m{^commit ($::sha1)$} ) {
 +                      unshift @$refs, $hash if $hash and $refs;
 +                      $hash = $1;
 +                      next;
 +              }
 +              next unless s{^\s*(git-svn-id:)}{$1};
 +              my ($url, $rev, $uuid) = extract_metadata($_);
                if (defined $url && defined $rev) {
 +                      next if $max{$url} and $max{$url} < $rev;
                        if (my $gs = Git::SVN->find_by_url($url)) {
                                my $c = $gs->rev_db_get($rev);
                                if ($c && $c eq $hash) {
                                        close $fh; # break the pipe
                                        return ($url, $rev, $uuid, $gs);
 +                              } else {
 +                                      $max{$url} ||= $gs->rev_db_max;
                                }
                        }
                }
 -              unshift @$refs, $hash if $refs;
        }
        command_close_pipe($fh, $ctx);
        (undef, undef, undef, undef);
@@@ -1975,19 -1966,16 +1975,19 @@@ sub rebuild 
                return;
        }
        print "Rebuilding $db_path ...\n";
 -      my ($rev_list, $ctx) = command_output_pipe("rev-list", $self->refname);
 +      my ($log, $ctx) = command_output_pipe("log", $self->refname);
        my $latest;
        my $full_url = $self->full_url;
        remove_username($full_url);
        my $svn_uuid;
 -      while (<$rev_list>) {
 -              chomp;
 -              my $c = $_;
 -              die "Non-SHA1: $c\n" unless $c =~ /^$::sha1$/o;
 -              my ($url, $rev, $uuid) = ::cmt_metadata($c);
 +      my $c;
 +      while (<$log>) {
 +              if ( m{^commit ($::sha1)$} ) {
 +                      $c = $1;
 +                      next;
 +              }
 +              next unless s{^\s*(git-svn-id:)}{$1};
 +              my ($url, $rev, $uuid) = ::extract_metadata($_);
                remove_username($url);
  
                # ignore merges (from set-tree)
                $self->rev_db_set($rev, $c);
                print "r$rev = $c\n";
        }
 -      command_close_pipe($rev_list, $ctx);
 +      command_close_pipe($log, $ctx);
        print "Done rebuilding $db_path\n";
  }
  
@@@ -2937,6 -2925,7 +2937,7 @@@ sub new 
            SVN::Client::get_ssl_server_trust_file_provider(),
            SVN::Client::get_simple_prompt_provider(
              \&Git::SVN::Prompt::simple, 2),
+           SVN::Client::get_ssl_client_cert_file_provider(),
            SVN::Client::get_ssl_client_cert_prompt_provider(
              \&Git::SVN::Prompt::ssl_client_cert, 2),
            SVN::Client::get_ssl_client_cert_pw_prompt_provider(