summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 91b0328)
raw | patch | inline | side by side (parent: 91b0328)
author | Eric Wong <normalperson@yhbt.net> | |
Sun, 11 Feb 2007 09:20:26 +0000 (01:20 -0800) | ||
committer | Eric Wong <normalperson@yhbt.net> | |
Fri, 23 Feb 2007 08:57:12 +0000 (00:57 -0800) |
Switch max_rev storage over to using it for globbing
branches and tags.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
branches and tags.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
git-svn.perl | patch | blob | history |
diff --git a/git-svn.perl b/git-svn.perl
index becf2e0d896687842a068240b213b8aaafa7620a..b62cc067d8458597572161e34b73519a0e71805c 100755 (executable)
--- a/git-svn.perl
+++ b/git-svn.perl
foreach my $t (qw/branches tags/) {
defined $remote->{$t} or next;
push @globs, $remote->{$t};
- my $f = "$ENV{GIT_DIR}/svn/.$uuid.$t";
- if (open my $fh, '<', $f) {
- chomp(my $max_rev = <$fh>);
- close $fh or die "Error closing $f: $!\n";
-
- if ($max_rev !~ /^\d+$/) {
- die "$max_rev (in $f) is not an integer!\n";
- }
- $remote->{$t}->{max_rev} = $max_rev;
- $base = $max_rev if ($max_rev < $base);
+ my $max_rev = eval { tmp_config(qw/--int --get/,
+ "svn-remote.$repo_id.${t}-maxRev") };
+ if (defined $max_rev && ($max_rev < $base)) {
+ $base = $max_rev;
}
}
my ($p, $g) = ($3, $4);
my $rs = $r->{$1}->{$2} = {
t => $2,
+ remote => $1,
path => Git::SVN::GlobSpec->new($p),
ref => Git::SVN::GlobSpec->new($g) };
if (length($rs->{ref}->{right}) != 0) {
# see if we have it in our config, first:
eval {
$self->{svm} = {
- source => $self->tmp_config('--get', "$section.svm-source"),
- uuid => $self->tmp_config('--get', "$section.svm-uuid"),
+ source => tmp_config('--get', "$section.svm-source"),
+ uuid => tmp_config('--get', "$section.svm-uuid"),
}
};
return $ra if ($self->{svm}->{source} && $self->{svm}->{uuid});
# username is of no interest
$src =~ s{!$}{};
$src =~ s{(^[a-z\+]*://)[^/@]*@}{$1};
- $self->tmp_config('--add', "$section.svm-source", $src);
+ tmp_config('--add', "$section.svm-source", $src);
my $uuid = $props->{'svm:uuid'};
$uuid =~ m{^[0-9a-f\-]{30,}$}
or die "doesn't look right - svm:uuid is '$uuid'\n";
- $self->tmp_config('--add', "$section.svm-uuid", $uuid);
+ tmp_config('--add', "$section.svm-uuid", $uuid);
$self->{svm} = { source => $src , uuid => $uuid };
}
}
sub tmp_config {
- my ($self, @args) = @_;
- unless (-f $self->{config}) {
- open my $fh, '>', $self->{config} or
- die "Can't open $self->{config}: $!\n";
+ my (@args) = @_;
+ my $config = "$ENV{GIT_DIR}/svn/config";
+ unless (-f $config) {
+ open my $fh, '>', $config or
+ die "Can't open $config: $!\n";
print $fh "; This file is used internally by git-svn\n" or
- die "Couldn't write to $self->{config}: $!\n";
+ die "Couldn't write to $config: $!\n";
print $fh "; You should not have to edit it\n" or
- die "Couldn't write to $self->{config}: $!\n";
- close $fh or die "Couldn't close $self->{config}: $!\n";
+ die "Couldn't write to $config: $!\n";
+ close $fh or die "Couldn't close $config: $!\n";
}
my $old_config = $ENV{GIT_CONFIG};
- $ENV{GIT_CONFIG} = $self->{config};
+ $ENV{GIT_CONFIG} = $config;
$@ = undef;
my @ret = eval { command('config', @args) };
my $err = $@;
}
}
foreach my $g (@$globs) {
- my $f = "$ENV{GIT_DIR}/svn/." .
- $self->uuid . ".$g->{t}";
- open my $fh, '>', "$f.tmp" or
- die "Can't open $f.tmp for writing: $!";
- print $fh "$r\n" or
- die "Couldn't write to $f: $!\n";
- close $fh or die "Error closing $f: $!\n";
- rename "$f.tmp", $f or
- die "Couldn't rename ",
- "$f.tmp => $f: $!\n";
+ my $k = "svn-remote.$g->{remote}." .
+ "$g->{t}-maxRev";
+ Git::SVN::tmp_config($k, $r);
}
}
# pre-fill the .rev_db since it'll eventually get filled in