X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=git-svn.perl;h=b1510495a7f003991a37d0810c551404c6c1252c;hb=d6958a1a32814af69a7571daa45252018c61f969;hp=9e2faf90aa1676974234882a2f557c17f7bc59f4;hpb=7385a42572977c000c361aaad3e5ec066bd240ec;p=git.git diff --git a/git-svn.perl b/git-svn.perl index 9e2faf90a..b1510495a 100755 --- a/git-svn.perl +++ b/git-svn.perl @@ -522,7 +522,8 @@ sub cmd_dcommit { } sub cmd_find_rev { - my $revision_or_hash = shift; + my $revision_or_hash = shift or die "SVN or git revision required ", + "as a command-line argument\n"; my $result; if ($revision_or_hash =~ /^r\d+$/) { my $head = shift; @@ -957,9 +958,10 @@ sub complete_url_ls_init { "wanted to set to: $gs->{url}\n"; } command_oneline('config', $k, $gs->{url}) unless $orig_url; - my $remote_path = "$ra->{svn_path}/$repo_path/*"; + my $remote_path = "$ra->{svn_path}/$repo_path"; $remote_path =~ s#/+#/#g; $remote_path =~ s#^/##g; + $remote_path .= "/*" if $remote_path !~ /\*/; my ($n) = ($switch =~ /^--(\w+)/); if (length $pfx && $pfx !~ m#/$#) { die "--prefix='$pfx' must have a trailing slash '/'\n"; @@ -1118,7 +1120,7 @@ sub cmt_metadata { sub working_head_info { my ($head, $refs) = @_; - my @args = ('log', '--no-color', '--first-parent'); + my @args = ('log', '--no-color', '--first-parent', '--pretty=medium'); my ($fh, $ctx) = command_output_pipe(@args, $head); my $hash; my %max; @@ -1540,9 +1542,14 @@ sub find_by_url { # repos_root and, path are optional $remotes->{$repo_id}->{$_}); } my $p = $path; + my $rwr = rewrite_root({repo_id => $repo_id}); unless (defined $p) { $p = $full_url; - $p =~ s#^\Q$u\E(?:/|$)## or next; + my $z = $u; + if ($rwr) { + $z = $rwr; + } + $p =~ s#^\Q$z\E(?:/|$)## or next; } foreach my $f (keys %$fetch) { next if $f ne $p; @@ -1893,7 +1900,7 @@ sub prop_walk { foreach (sort keys %$dirent) { next if $dirent->{$_}->{kind} != $SVN::Node::dir; - $self->prop_walk($path . '/' . $_, $rev, $sub); + $self->prop_walk($p . $_, $rev, $sub); } } @@ -2232,12 +2239,13 @@ sub find_parent_branch { # just grow a tail if we're not unique enough :x $ref_id .= '-' while find_ref($ref_id); print STDERR "Initializing parent: $ref_id\n"; - my ($u, $p) = ($new_url, ''); + my ($u, $p, $repo_id) = ($new_url, '', $ref_id); if ($u =~ s#^\Q$url\E(/|$)##) { $p = $u; $u = $url; + $repo_id = $self->{repo_id}; } - $gs = Git::SVN->init($u, $p, $self->{repo_id}, $ref_id, 1); + $gs = Git::SVN->init($u, $p, $repo_id, $ref_id, 1); } my ($r0, $parent) = $gs->find_rev_before($r, 1); if (!defined $r0 || !defined $parent) { @@ -2367,8 +2375,7 @@ sub check_author { my ($author) = @_; if (!defined $author || length $author == 0) { $author = '(no author)'; - } - if (defined $::_authors && ! defined $::users{$author}) { + } elsif (defined $::_authors && ! defined $::users{$author}) { die "Author: $author not defined in $::_authors file\n"; } $author; @@ -2511,6 +2518,7 @@ sub rebuild_from_rev_db { my ($self, $path) = @_; my $r = -1; open my $fh, '<', $path or croak "open: $!"; + binmode $fh or croak "binmode: $!"; while (<$fh>) { length($_) == 41 or croak "inconsistent size in ($_) != 41"; chomp($_); @@ -2608,6 +2616,7 @@ sub rebuild { sub _rev_map_set { my ($fh, $rev, $commit) = @_; + binmode $fh or croak "binmode: $!"; my $size = (stat($fh))[7]; ($size % 24) == 0 or croak "inconsistent size: $size"; @@ -2711,6 +2720,7 @@ sub rev_map_max { my $map_path = $self->map_path; stat $map_path or return $want_commit ? (0, undef) : 0; sysopen(my $fh, $map_path, O_RDONLY) or croak "open: $!"; + binmode $fh or croak "binmode: $!"; my $size = (stat($fh))[7]; ($size % 24) == 0 or croak "inconsistent size: $size"; @@ -2743,6 +2753,7 @@ sub rev_map_get { return undef unless -e $map_path; sysopen(my $fh, $map_path, O_RDONLY) or croak "open: $!"; + binmode $fh or croak "binmode: $!"; my $size = (stat($fh))[7]; ($size % 24) == 0 or croak "inconsistent size: $size"; @@ -3658,7 +3669,7 @@ sub escape_uri_only { my ($uri) = @_; my @tmp; foreach (split m{/}, $uri) { - s/([^\w.-])/sprintf("%%%02X",ord($1))/eg; + s/([^\w.%-]|%(?![a-fA-F0-9]{2}))/sprintf("%%%02X",ord($1))/eg; push @tmp, $_; } join('/', @tmp);