cvsimport: style fixup.
This should not change any functionality, but just makes it readable by having a space between syntactic construct keyword and open parenthesis (e.g. "if (expr", not "if(expr") and between close parenthesis and open brace (e.g. "if (expr) {" not "if (expr){"). Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
parent
6f23ebf600
commit
86d11cf264
@ -29,7 +29,7 @@ use IPC::Open2;
|
|||||||
$SIG{'PIPE'}="IGNORE";
|
$SIG{'PIPE'}="IGNORE";
|
||||||
$ENV{'TZ'}="UTC";
|
$ENV{'TZ'}="UTC";
|
||||||
|
|
||||||
our($opt_h,$opt_o,$opt_v,$opt_k,$opt_u,$opt_d,$opt_p,$opt_C,$opt_z,$opt_i,$opt_P, $opt_s,$opt_m,$opt_M,$opt_A,$opt_S,$opt_L);
|
our ($opt_h,$opt_o,$opt_v,$opt_k,$opt_u,$opt_d,$opt_p,$opt_C,$opt_z,$opt_i,$opt_P, $opt_s,$opt_m,$opt_M,$opt_A,$opt_S,$opt_L);
|
||||||
my (%conv_author_name, %conv_author_email);
|
my (%conv_author_name, %conv_author_email);
|
||||||
|
|
||||||
sub usage() {
|
sub usage() {
|
||||||
@ -90,15 +90,15 @@ usage if $opt_h;
|
|||||||
|
|
||||||
@ARGV <= 1 or usage();
|
@ARGV <= 1 or usage();
|
||||||
|
|
||||||
if($opt_d) {
|
if ($opt_d) {
|
||||||
$ENV{"CVSROOT"} = $opt_d;
|
$ENV{"CVSROOT"} = $opt_d;
|
||||||
} elsif(-f 'CVS/Root') {
|
} elsif (-f 'CVS/Root') {
|
||||||
open my $f, '<', 'CVS/Root' or die 'Failed to open CVS/Root';
|
open my $f, '<', 'CVS/Root' or die 'Failed to open CVS/Root';
|
||||||
$opt_d = <$f>;
|
$opt_d = <$f>;
|
||||||
chomp $opt_d;
|
chomp $opt_d;
|
||||||
close $f;
|
close $f;
|
||||||
$ENV{"CVSROOT"} = $opt_d;
|
$ENV{"CVSROOT"} = $opt_d;
|
||||||
} elsif($ENV{"CVSROOT"}) {
|
} elsif ($ENV{"CVSROOT"}) {
|
||||||
$opt_d = $ENV{"CVSROOT"};
|
$opt_d = $ENV{"CVSROOT"};
|
||||||
} else {
|
} else {
|
||||||
die "CVSROOT needs to be set";
|
die "CVSROOT needs to be set";
|
||||||
@ -141,7 +141,7 @@ use File::Temp qw(tempfile);
|
|||||||
use POSIX qw(strftime dup2);
|
use POSIX qw(strftime dup2);
|
||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
my($what,$repo,$subdir) = @_;
|
my ($what,$repo,$subdir) = @_;
|
||||||
$what=ref($what) if ref($what);
|
$what=ref($what) if ref($what);
|
||||||
|
|
||||||
my $self = {};
|
my $self = {};
|
||||||
@ -161,38 +161,38 @@ sub new {
|
|||||||
sub conn {
|
sub conn {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $repo = $self->{'fullrep'};
|
my $repo = $self->{'fullrep'};
|
||||||
if($repo =~ s/^:pserver(?:([^:]*)):(?:(.*?)(?::(.*?))?@)?([^:\/]*)(?::(\d*))?//) {
|
if ($repo =~ s/^:pserver(?:([^:]*)):(?:(.*?)(?::(.*?))?@)?([^:\/]*)(?::(\d*))?//) {
|
||||||
my($param,$user,$pass,$serv,$port) = ($1,$2,$3,$4,$5);
|
my ($param,$user,$pass,$serv,$port) = ($1,$2,$3,$4,$5);
|
||||||
|
|
||||||
my($proxyhost,$proxyport);
|
my ($proxyhost,$proxyport);
|
||||||
if($param && ($param =~ m/proxy=([^;]+)/)) {
|
if ($param && ($param =~ m/proxy=([^;]+)/)) {
|
||||||
$proxyhost = $1;
|
$proxyhost = $1;
|
||||||
# Default proxyport, if not specified, is 8080.
|
# Default proxyport, if not specified, is 8080.
|
||||||
$proxyport = 8080;
|
$proxyport = 8080;
|
||||||
if($ENV{"CVS_PROXY_PORT"}) {
|
if ($ENV{"CVS_PROXY_PORT"}) {
|
||||||
$proxyport = $ENV{"CVS_PROXY_PORT"};
|
$proxyport = $ENV{"CVS_PROXY_PORT"};
|
||||||
}
|
}
|
||||||
if($param =~ m/proxyport=([^;]+)/){
|
if ($param =~ m/proxyport=([^;]+)/) {
|
||||||
$proxyport = $1;
|
$proxyport = $1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$user="anonymous" unless defined $user;
|
$user="anonymous" unless defined $user;
|
||||||
my $rr2 = "-";
|
my $rr2 = "-";
|
||||||
unless($port) {
|
unless ($port) {
|
||||||
$rr2 = ":pserver:$user\@$serv:$repo";
|
$rr2 = ":pserver:$user\@$serv:$repo";
|
||||||
$port=2401;
|
$port=2401;
|
||||||
}
|
}
|
||||||
my $rr = ":pserver:$user\@$serv:$port$repo";
|
my $rr = ":pserver:$user\@$serv:$port$repo";
|
||||||
|
|
||||||
unless($pass) {
|
unless ($pass) {
|
||||||
open(H,$ENV{'HOME'}."/.cvspass") and do {
|
open(H,$ENV{'HOME'}."/.cvspass") and do {
|
||||||
# :pserver:cvs@mea.tmt.tele.fi:/cvsroot/zmailer Ah<Z
|
# :pserver:cvs@mea.tmt.tele.fi:/cvsroot/zmailer Ah<Z
|
||||||
while(<H>) {
|
while (<H>) {
|
||||||
chomp;
|
chomp;
|
||||||
s/^\/\d+\s+//;
|
s/^\/\d+\s+//;
|
||||||
my ($w,$p) = split(/\s/,$_,2);
|
my ($w,$p) = split(/\s/,$_,2);
|
||||||
if($w eq $rr or $w eq $rr2) {
|
if ($w eq $rr or $w eq $rr2) {
|
||||||
$pass = $p;
|
$pass = $p;
|
||||||
last;
|
last;
|
||||||
}
|
}
|
||||||
@ -202,7 +202,7 @@ sub conn {
|
|||||||
$pass="A" unless $pass;
|
$pass="A" unless $pass;
|
||||||
|
|
||||||
my ($s, $rep);
|
my ($s, $rep);
|
||||||
if($proxyhost) {
|
if ($proxyhost) {
|
||||||
|
|
||||||
# Use a HTTP Proxy. Only works for HTTP proxies that
|
# Use a HTTP Proxy. Only works for HTTP proxies that
|
||||||
# don't require user authentication
|
# don't require user authentication
|
||||||
@ -218,7 +218,7 @@ sub conn {
|
|||||||
$rep = <$s>;
|
$rep = <$s>;
|
||||||
|
|
||||||
# The answer should look like 'HTTP/1.x 2yy ....'
|
# The answer should look like 'HTTP/1.x 2yy ....'
|
||||||
if(!($rep =~ m#^HTTP/1\.. 2[0-9][0-9]#)) {
|
if (!($rep =~ m#^HTTP/1\.. 2[0-9][0-9]#)) {
|
||||||
die "Proxy connect: $rep\n";
|
die "Proxy connect: $rep\n";
|
||||||
}
|
}
|
||||||
# Skip up to the empty line of the proxy server output
|
# Skip up to the empty line of the proxy server output
|
||||||
@ -239,7 +239,7 @@ sub conn {
|
|||||||
|
|
||||||
$rep = <$s>;
|
$rep = <$s>;
|
||||||
|
|
||||||
if($rep ne "I LOVE YOU\n") {
|
if ($rep ne "I LOVE YOU\n") {
|
||||||
$rep="<unknown>" unless $rep;
|
$rep="<unknown>" unless $rep;
|
||||||
die "AuthReply: $rep\n";
|
die "AuthReply: $rep\n";
|
||||||
}
|
}
|
||||||
@ -271,7 +271,7 @@ sub conn {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unless($pid) {
|
unless ($pid) {
|
||||||
$pr->writer();
|
$pr->writer();
|
||||||
$pw->reader();
|
$pw->reader();
|
||||||
dup2($pw->fileno(),0);
|
dup2($pw->fileno(),0);
|
||||||
@ -294,7 +294,7 @@ sub conn {
|
|||||||
$self->{'socketo'}->flush();
|
$self->{'socketo'}->flush();
|
||||||
|
|
||||||
chomp(my $rep=$self->readline());
|
chomp(my $rep=$self->readline());
|
||||||
if($rep !~ s/^Valid-requests\s*//) {
|
if ($rep !~ s/^Valid-requests\s*//) {
|
||||||
$rep="<unknown>" unless $rep;
|
$rep="<unknown>" unless $rep;
|
||||||
die "Expected Valid-requests from server, but got: $rep\n";
|
die "Expected Valid-requests from server, but got: $rep\n";
|
||||||
}
|
}
|
||||||
@ -306,14 +306,14 @@ sub conn {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub readline {
|
sub readline {
|
||||||
my($self) = @_;
|
my ($self) = @_;
|
||||||
return $self->{'socketi'}->getline();
|
return $self->{'socketi'}->getline();
|
||||||
}
|
}
|
||||||
|
|
||||||
sub _file {
|
sub _file {
|
||||||
# Request a file with a given revision.
|
# Request a file with a given revision.
|
||||||
# Trial and error says this is a good way to do it. :-/
|
# Trial and error says this is a good way to do it. :-/
|
||||||
my($self,$fn,$rev) = @_;
|
my ($self,$fn,$rev) = @_;
|
||||||
$self->{'socketo'}->write("Argument -N\n") or return undef;
|
$self->{'socketo'}->write("Argument -N\n") or return undef;
|
||||||
$self->{'socketo'}->write("Argument -P\n") or return undef;
|
$self->{'socketo'}->write("Argument -P\n") or return undef;
|
||||||
# -kk: Linus' version doesn't use it - defaults to off
|
# -kk: Linus' version doesn't use it - defaults to off
|
||||||
@ -335,12 +335,12 @@ sub _file {
|
|||||||
sub _line {
|
sub _line {
|
||||||
# Read a line from the server.
|
# Read a line from the server.
|
||||||
# ... except that 'line' may be an entire file. ;-)
|
# ... except that 'line' may be an entire file. ;-)
|
||||||
my($self, $fh) = @_;
|
my ($self, $fh) = @_;
|
||||||
die "Not in lines" unless defined $self->{'lines'};
|
die "Not in lines" unless defined $self->{'lines'};
|
||||||
|
|
||||||
my $line;
|
my $line;
|
||||||
my $res=0;
|
my $res=0;
|
||||||
while(defined($line = $self->readline())) {
|
while (defined($line = $self->readline())) {
|
||||||
# M U gnupg-cvs-rep/AUTHORS
|
# M U gnupg-cvs-rep/AUTHORS
|
||||||
# Updated gnupg-cvs-rep/
|
# Updated gnupg-cvs-rep/
|
||||||
# /daten/src/rsync/gnupg-cvs-rep/AUTHORS
|
# /daten/src/rsync/gnupg-cvs-rep/AUTHORS
|
||||||
@ -349,7 +349,7 @@ sub _line {
|
|||||||
# 0
|
# 0
|
||||||
# ok
|
# ok
|
||||||
|
|
||||||
if($line =~ s/^(?:Created|Updated) //) {
|
if ($line =~ s/^(?:Created|Updated) //) {
|
||||||
$line = $self->readline(); # path
|
$line = $self->readline(); # path
|
||||||
$line = $self->readline(); # Entries line
|
$line = $self->readline(); # Entries line
|
||||||
my $mode = $self->readline(); chomp $mode;
|
my $mode = $self->readline(); chomp $mode;
|
||||||
@ -360,12 +360,12 @@ sub _line {
|
|||||||
die "Duh: Filesize $cnt" if $cnt !~ /^\d+$/;
|
die "Duh: Filesize $cnt" if $cnt !~ /^\d+$/;
|
||||||
$line="";
|
$line="";
|
||||||
$res = $self->_fetchfile($fh, $cnt);
|
$res = $self->_fetchfile($fh, $cnt);
|
||||||
} elsif($line =~ s/^ //) {
|
} elsif ($line =~ s/^ //) {
|
||||||
print $fh $line;
|
print $fh $line;
|
||||||
$res += length($line);
|
$res += length($line);
|
||||||
} elsif($line =~ /^M\b/) {
|
} elsif ($line =~ /^M\b/) {
|
||||||
# output, do nothing
|
# output, do nothing
|
||||||
} elsif($line =~ /^Mbinary\b/) {
|
} elsif ($line =~ /^Mbinary\b/) {
|
||||||
my $cnt;
|
my $cnt;
|
||||||
die "EOF from server after 'Mbinary'" unless defined ($cnt = $self->readline());
|
die "EOF from server after 'Mbinary'" unless defined ($cnt = $self->readline());
|
||||||
chomp $cnt;
|
chomp $cnt;
|
||||||
@ -374,12 +374,12 @@ sub _line {
|
|||||||
$res += $self->_fetchfile($fh, $cnt);
|
$res += $self->_fetchfile($fh, $cnt);
|
||||||
} else {
|
} else {
|
||||||
chomp $line;
|
chomp $line;
|
||||||
if($line eq "ok") {
|
if ($line eq "ok") {
|
||||||
# print STDERR "S: ok (".length($res).")\n";
|
# print STDERR "S: ok (".length($res).")\n";
|
||||||
return $res;
|
return $res;
|
||||||
} elsif($line =~ s/^E //) {
|
} elsif ($line =~ s/^E //) {
|
||||||
# print STDERR "S: $line\n";
|
# print STDERR "S: $line\n";
|
||||||
} elsif($line =~ /^(Remove-entry|Removed) /i) {
|
} elsif ($line =~ /^(Remove-entry|Removed) /i) {
|
||||||
$line = $self->readline(); # filename
|
$line = $self->readline(); # filename
|
||||||
$line = $self->readline(); # OK
|
$line = $self->readline(); # OK
|
||||||
chomp $line;
|
chomp $line;
|
||||||
@ -393,7 +393,7 @@ sub _line {
|
|||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
sub file {
|
sub file {
|
||||||
my($self,$fn,$rev) = @_;
|
my ($self,$fn,$rev) = @_;
|
||||||
my $res;
|
my $res;
|
||||||
|
|
||||||
my ($fh, $name) = tempfile('gitcvs.XXXXXX',
|
my ($fh, $name) = tempfile('gitcvs.XXXXXX',
|
||||||
@ -417,7 +417,7 @@ sub _fetchfile {
|
|||||||
my ($self, $fh, $cnt) = @_;
|
my ($self, $fh, $cnt) = @_;
|
||||||
my $res = 0;
|
my $res = 0;
|
||||||
my $bufsize = 1024 * 1024;
|
my $bufsize = 1024 * 1024;
|
||||||
while($cnt) {
|
while ($cnt) {
|
||||||
if ($bufsize > $cnt) {
|
if ($bufsize > $cnt) {
|
||||||
$bufsize = $cnt;
|
$bufsize = $cnt;
|
||||||
}
|
}
|
||||||
@ -438,7 +438,7 @@ my $cvs = CVSconn->new($opt_d, $cvs_tree);
|
|||||||
|
|
||||||
|
|
||||||
sub pdate($) {
|
sub pdate($) {
|
||||||
my($d) = @_;
|
my ($d) = @_;
|
||||||
m#(\d{2,4})/(\d\d)/(\d\d)\s(\d\d):(\d\d)(?::(\d\d))?#
|
m#(\d{2,4})/(\d\d)/(\d\d)\s(\d\d):(\d\d)(?::(\d\d))?#
|
||||||
or die "Unparseable date: $d\n";
|
or die "Unparseable date: $d\n";
|
||||||
my $y=$1; $y-=1900 if $y>1900;
|
my $y=$1; $y-=1900 if $y>1900;
|
||||||
@ -446,22 +446,22 @@ sub pdate($) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub pmode($) {
|
sub pmode($) {
|
||||||
my($mode) = @_;
|
my ($mode) = @_;
|
||||||
my $m = 0;
|
my $m = 0;
|
||||||
my $mm = 0;
|
my $mm = 0;
|
||||||
my $um = 0;
|
my $um = 0;
|
||||||
for my $x(split(//,$mode)) {
|
for my $x(split(//,$mode)) {
|
||||||
if($x eq ",") {
|
if ($x eq ",") {
|
||||||
$m |= $mm&$um;
|
$m |= $mm&$um;
|
||||||
$mm = 0;
|
$mm = 0;
|
||||||
$um = 0;
|
$um = 0;
|
||||||
} elsif($x eq "u") { $um |= 0700;
|
} elsif ($x eq "u") { $um |= 0700;
|
||||||
} elsif($x eq "g") { $um |= 0070;
|
} elsif ($x eq "g") { $um |= 0070;
|
||||||
} elsif($x eq "o") { $um |= 0007;
|
} elsif ($x eq "o") { $um |= 0007;
|
||||||
} elsif($x eq "r") { $mm |= 0444;
|
} elsif ($x eq "r") { $mm |= 0444;
|
||||||
} elsif($x eq "w") { $mm |= 0222;
|
} elsif ($x eq "w") { $mm |= 0222;
|
||||||
} elsif($x eq "x") { $mm |= 0111;
|
} elsif ($x eq "x") { $mm |= 0111;
|
||||||
} elsif($x eq "=") { # do nothing
|
} elsif ($x eq "=") { # do nothing
|
||||||
} else { die "Unknown mode: $mode\n";
|
} else { die "Unknown mode: $mode\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -485,7 +485,7 @@ sub get_headref ($$) {
|
|||||||
my $git_dir = shift;
|
my $git_dir = shift;
|
||||||
|
|
||||||
my $f = "$git_dir/refs/heads/$name";
|
my $f = "$git_dir/refs/heads/$name";
|
||||||
if(open(my $fh, $f)) {
|
if (open(my $fh, $f)) {
|
||||||
chomp(my $r = <$fh>);
|
chomp(my $r = <$fh>);
|
||||||
is_sha1($r) or die "Cannot get head id for $name ($r): $!";
|
is_sha1($r) or die "Cannot get head id for $name ($r): $!";
|
||||||
return $r;
|
return $r;
|
||||||
@ -512,7 +512,7 @@ $orig_git_index = $ENV{GIT_INDEX_FILE} if exists $ENV{GIT_INDEX_FILE};
|
|||||||
|
|
||||||
my %index; # holds filenames of one index per branch
|
my %index; # holds filenames of one index per branch
|
||||||
|
|
||||||
unless(-d $git_dir) {
|
unless (-d $git_dir) {
|
||||||
system("git-init-db");
|
system("git-init-db");
|
||||||
die "Cannot init the GIT db at $git_tree: $?\n" if $?;
|
die "Cannot init the GIT db at $git_tree: $?\n" if $?;
|
||||||
system("git-read-tree");
|
system("git-read-tree");
|
||||||
@ -531,7 +531,7 @@ unless(-d $git_dir) {
|
|||||||
chomp ($last_branch = <F>);
|
chomp ($last_branch = <F>);
|
||||||
$last_branch = basename($last_branch);
|
$last_branch = basename($last_branch);
|
||||||
close(F);
|
close(F);
|
||||||
unless($last_branch) {
|
unless ($last_branch) {
|
||||||
warn "Cannot read the last branch name: $! -- assuming 'master'\n";
|
warn "Cannot read the last branch name: $! -- assuming 'master'\n";
|
||||||
$last_branch = "master";
|
$last_branch = "master";
|
||||||
}
|
}
|
||||||
@ -542,7 +542,7 @@ unless(-d $git_dir) {
|
|||||||
my $fmt = '($ref, $author) = (%(refname), %(author));';
|
my $fmt = '($ref, $author) = (%(refname), %(author));';
|
||||||
open(H, "git-for-each-ref --perl --format='$fmt' refs/heads |") or
|
open(H, "git-for-each-ref --perl --format='$fmt' refs/heads |") or
|
||||||
die "Cannot run git-for-each-ref: $!\n";
|
die "Cannot run git-for-each-ref: $!\n";
|
||||||
while(defined(my $entry = <H>)) {
|
while (defined(my $entry = <H>)) {
|
||||||
my ($ref, $author);
|
my ($ref, $author);
|
||||||
eval($entry) || die "cannot eval refs list: $@";
|
eval($entry) || die "cannot eval refs list: $@";
|
||||||
my ($head) = ($ref =~ m|^refs/heads/(.*)|);
|
my ($head) = ($ref =~ m|^refs/heads/(.*)|);
|
||||||
@ -572,7 +572,7 @@ unless ($opt_P) {
|
|||||||
print "Running cvsps...\n" if $opt_v;
|
print "Running cvsps...\n" if $opt_v;
|
||||||
my $pid = open(CVSPS,"-|");
|
my $pid = open(CVSPS,"-|");
|
||||||
die "Cannot fork: $!\n" unless defined $pid;
|
die "Cannot fork: $!\n" unless defined $pid;
|
||||||
unless($pid) {
|
unless ($pid) {
|
||||||
my @opt;
|
my @opt;
|
||||||
@opt = split(/,/,$opt_p) if defined $opt_p;
|
@opt = split(/,/,$opt_p) if defined $opt_p;
|
||||||
unshift @opt, '-z', $opt_z if defined $opt_z;
|
unshift @opt, '-z', $opt_z if defined $opt_z;
|
||||||
@ -642,8 +642,8 @@ sub write_tree () {
|
|||||||
return $tree;
|
return $tree;
|
||||||
}
|
}
|
||||||
|
|
||||||
my($patchset,$date,$author_name,$author_email,$branch,$ancestor,$tag,$logmsg);
|
my ($patchset,$date,$author_name,$author_email,$branch,$ancestor,$tag,$logmsg);
|
||||||
my(@old,@new,@skipped,%ignorebranch);
|
my (@old,@new,@skipped,%ignorebranch);
|
||||||
|
|
||||||
# commits that cvsps cannot place anywhere...
|
# commits that cvsps cannot place anywhere...
|
||||||
$ignorebranch{'#CVSPS_NO_BRANCH'} = 1;
|
$ignorebranch{'#CVSPS_NO_BRANCH'} = 1;
|
||||||
@ -684,7 +684,7 @@ sub commit {
|
|||||||
foreach my $rx (@mergerx) {
|
foreach my $rx (@mergerx) {
|
||||||
next unless $logmsg =~ $rx && $1;
|
next unless $logmsg =~ $rx && $1;
|
||||||
my $mparent = $1 eq 'HEAD' ? $opt_o : $1;
|
my $mparent = $1 eq 'HEAD' ? $opt_o : $1;
|
||||||
if(my $sha1 = get_headref($mparent, $git_dir)) {
|
if (my $sha1 = get_headref($mparent, $git_dir)) {
|
||||||
push @commit_args, '-p', $mparent;
|
push @commit_args, '-p', $mparent;
|
||||||
print "Merge parent branch: $mparent\n" if $opt_v;
|
print "Merge parent branch: $mparent\n" if $opt_v;
|
||||||
}
|
}
|
||||||
@ -725,9 +725,9 @@ sub commit {
|
|||||||
system("git-update-ref refs/heads/$branch $cid") == 0
|
system("git-update-ref refs/heads/$branch $cid") == 0
|
||||||
or die "Cannot write branch $branch for update: $!\n";
|
or die "Cannot write branch $branch for update: $!\n";
|
||||||
|
|
||||||
if($tag) {
|
if ($tag) {
|
||||||
my($in, $out) = ('','');
|
my ($in, $out) = ('','');
|
||||||
my($xtag) = $tag;
|
my ($xtag) = $tag;
|
||||||
$xtag =~ s/\s+\*\*.*$//; # Remove stuff like ** INVALID ** and ** FUNKY **
|
$xtag =~ s/\s+\*\*.*$//; # Remove stuff like ** INVALID ** and ** FUNKY **
|
||||||
$xtag =~ tr/_/\./ if ( $opt_u );
|
$xtag =~ tr/_/\./ if ( $opt_u );
|
||||||
$xtag =~ s/[\/]/$opt_s/g;
|
$xtag =~ s/[\/]/$opt_s/g;
|
||||||
@ -762,25 +762,25 @@ sub commit {
|
|||||||
};
|
};
|
||||||
|
|
||||||
my $commitcount = 1;
|
my $commitcount = 1;
|
||||||
while(<CVS>) {
|
while (<CVS>) {
|
||||||
chomp;
|
chomp;
|
||||||
if($state == 0 and /^-+$/) {
|
if ($state == 0 and /^-+$/) {
|
||||||
$state = 1;
|
$state = 1;
|
||||||
} elsif($state == 0) {
|
} elsif ($state == 0) {
|
||||||
$state = 1;
|
$state = 1;
|
||||||
redo;
|
redo;
|
||||||
} elsif(($state==0 or $state==1) and s/^PatchSet\s+//) {
|
} elsif (($state==0 or $state==1) and s/^PatchSet\s+//) {
|
||||||
$patchset = 0+$_;
|
$patchset = 0+$_;
|
||||||
$state=2;
|
$state=2;
|
||||||
} elsif($state == 2 and s/^Date:\s+//) {
|
} elsif ($state == 2 and s/^Date:\s+//) {
|
||||||
$date = pdate($_);
|
$date = pdate($_);
|
||||||
unless($date) {
|
unless ($date) {
|
||||||
print STDERR "Could not parse date: $_\n";
|
print STDERR "Could not parse date: $_\n";
|
||||||
$state=0;
|
$state=0;
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
$state=3;
|
$state=3;
|
||||||
} elsif($state == 3 and s/^Author:\s+//) {
|
} elsif ($state == 3 and s/^Author:\s+//) {
|
||||||
s/\s+$//;
|
s/\s+$//;
|
||||||
if (/^(.*?)\s+<(.*)>/) {
|
if (/^(.*?)\s+<(.*)>/) {
|
||||||
($author_name, $author_email) = ($1, $2);
|
($author_name, $author_email) = ($1, $2);
|
||||||
@ -791,34 +791,34 @@ while(<CVS>) {
|
|||||||
$author_name = $author_email = $_;
|
$author_name = $author_email = $_;
|
||||||
}
|
}
|
||||||
$state = 4;
|
$state = 4;
|
||||||
} elsif($state == 4 and s/^Branch:\s+//) {
|
} elsif ($state == 4 and s/^Branch:\s+//) {
|
||||||
s/\s+$//;
|
s/\s+$//;
|
||||||
s/[\/]/$opt_s/g;
|
s/[\/]/$opt_s/g;
|
||||||
$branch = $_;
|
$branch = $_;
|
||||||
$state = 5;
|
$state = 5;
|
||||||
} elsif($state == 5 and s/^Ancestor branch:\s+//) {
|
} elsif ($state == 5 and s/^Ancestor branch:\s+//) {
|
||||||
s/\s+$//;
|
s/\s+$//;
|
||||||
$ancestor = $_;
|
$ancestor = $_;
|
||||||
$ancestor = $opt_o if $ancestor eq "HEAD";
|
$ancestor = $opt_o if $ancestor eq "HEAD";
|
||||||
$state = 6;
|
$state = 6;
|
||||||
} elsif($state == 5) {
|
} elsif ($state == 5) {
|
||||||
$ancestor = undef;
|
$ancestor = undef;
|
||||||
$state = 6;
|
$state = 6;
|
||||||
redo;
|
redo;
|
||||||
} elsif($state == 6 and s/^Tag:\s+//) {
|
} elsif ($state == 6 and s/^Tag:\s+//) {
|
||||||
s/\s+$//;
|
s/\s+$//;
|
||||||
if($_ eq "(none)") {
|
if ($_ eq "(none)") {
|
||||||
$tag = undef;
|
$tag = undef;
|
||||||
} else {
|
} else {
|
||||||
$tag = $_;
|
$tag = $_;
|
||||||
}
|
}
|
||||||
$state = 7;
|
$state = 7;
|
||||||
} elsif($state == 7 and /^Log:/) {
|
} elsif ($state == 7 and /^Log:/) {
|
||||||
$logmsg = "";
|
$logmsg = "";
|
||||||
$state = 8;
|
$state = 8;
|
||||||
} elsif($state == 8 and /^Members:/) {
|
} elsif ($state == 8 and /^Members:/) {
|
||||||
$branch = $opt_o if $branch eq "HEAD";
|
$branch = $opt_o if $branch eq "HEAD";
|
||||||
if(defined $branch_date{$branch} and $branch_date{$branch} >= $date) {
|
if (defined $branch_date{$branch} and $branch_date{$branch} >= $date) {
|
||||||
# skip
|
# skip
|
||||||
print "skip patchset $patchset: $date before $branch_date{$branch}\n" if $opt_v;
|
print "skip patchset $patchset: $date before $branch_date{$branch}\n" if $opt_v;
|
||||||
$state = 11;
|
$state = 11;
|
||||||
@ -829,17 +829,17 @@ while(<CVS>) {
|
|||||||
$state = 11;
|
$state = 11;
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
if($ancestor) {
|
if ($ancestor) {
|
||||||
if($ancestor eq $branch) {
|
if ($ancestor eq $branch) {
|
||||||
print STDERR "Branch $branch erroneously stems from itself -- changed ancestor to $opt_o\n";
|
print STDERR "Branch $branch erroneously stems from itself -- changed ancestor to $opt_o\n";
|
||||||
$ancestor = $opt_o;
|
$ancestor = $opt_o;
|
||||||
}
|
}
|
||||||
if(-f "$git_dir/refs/heads/$branch") {
|
if (-f "$git_dir/refs/heads/$branch") {
|
||||||
print STDERR "Branch $branch already exists!\n";
|
print STDERR "Branch $branch already exists!\n";
|
||||||
$state=11;
|
$state=11;
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
unless(open(H,"$git_dir/refs/heads/$ancestor")) {
|
unless (open(H,"$git_dir/refs/heads/$ancestor")) {
|
||||||
print STDERR "Branch $ancestor does not exist!\n";
|
print STDERR "Branch $ancestor does not exist!\n";
|
||||||
$ignorebranch{$branch} = 1;
|
$ignorebranch{$branch} = 1;
|
||||||
$state=11;
|
$state=11;
|
||||||
@ -847,7 +847,7 @@ while(<CVS>) {
|
|||||||
}
|
}
|
||||||
chomp(my $id = <H>);
|
chomp(my $id = <H>);
|
||||||
close(H);
|
close(H);
|
||||||
unless(open(H,"> $git_dir/refs/heads/$branch")) {
|
unless (open(H,"> $git_dir/refs/heads/$branch")) {
|
||||||
print STDERR "Could not create branch $branch: $!\n";
|
print STDERR "Could not create branch $branch: $!\n";
|
||||||
$ignorebranch{$branch} = 1;
|
$ignorebranch{$branch} = 1;
|
||||||
$state=11;
|
$state=11;
|
||||||
@ -860,9 +860,9 @@ while(<CVS>) {
|
|||||||
}
|
}
|
||||||
$last_branch = $branch if $branch ne $last_branch;
|
$last_branch = $branch if $branch ne $last_branch;
|
||||||
$state = 9;
|
$state = 9;
|
||||||
} elsif($state == 8) {
|
} elsif ($state == 8) {
|
||||||
$logmsg .= "$_\n";
|
$logmsg .= "$_\n";
|
||||||
} elsif($state == 9 and /^\s+(.+?):(INITIAL|\d+(?:\.\d+)+)->(\d+(?:\.\d+)+)\s*$/) {
|
} elsif ($state == 9 and /^\s+(.+?):(INITIAL|\d+(?:\.\d+)+)->(\d+(?:\.\d+)+)\s*$/) {
|
||||||
# VERSION:1.96->1.96.2.1
|
# VERSION:1.96->1.96.2.1
|
||||||
my $init = ($2 eq "INITIAL");
|
my $init = ($2 eq "INITIAL");
|
||||||
my $fn = $1;
|
my $fn = $1;
|
||||||
@ -875,7 +875,7 @@ while(<CVS>) {
|
|||||||
}
|
}
|
||||||
print "Fetching $fn v $rev\n" if $opt_v;
|
print "Fetching $fn v $rev\n" if $opt_v;
|
||||||
my ($tmpname, $size) = $cvs->file($fn,$rev);
|
my ($tmpname, $size) = $cvs->file($fn,$rev);
|
||||||
if($size == -1) {
|
if ($size == -1) {
|
||||||
push(@old,$fn);
|
push(@old,$fn);
|
||||||
print "Drop $fn\n" if $opt_v;
|
print "Drop $fn\n" if $opt_v;
|
||||||
} else {
|
} else {
|
||||||
@ -893,14 +893,14 @@ while(<CVS>) {
|
|||||||
push(@new,[$mode, $sha, $fn]); # may be resurrected!
|
push(@new,[$mode, $sha, $fn]); # may be resurrected!
|
||||||
}
|
}
|
||||||
unlink($tmpname);
|
unlink($tmpname);
|
||||||
} elsif($state == 9 and /^\s+(.+?):\d+(?:\.\d+)+->(\d+(?:\.\d+)+)\(DEAD\)\s*$/) {
|
} elsif ($state == 9 and /^\s+(.+?):\d+(?:\.\d+)+->(\d+(?:\.\d+)+)\(DEAD\)\s*$/) {
|
||||||
my $fn = $1;
|
my $fn = $1;
|
||||||
$fn =~ s#^/+##;
|
$fn =~ s#^/+##;
|
||||||
push(@old,$fn);
|
push(@old,$fn);
|
||||||
print "Delete $fn\n" if $opt_v;
|
print "Delete $fn\n" if $opt_v;
|
||||||
} elsif($state == 9 and /^\s*$/) {
|
} elsif ($state == 9 and /^\s*$/) {
|
||||||
$state = 10;
|
$state = 10;
|
||||||
} elsif(($state == 9 or $state == 10) and /^-+$/) {
|
} elsif (($state == 9 or $state == 10) and /^-+$/) {
|
||||||
$commitcount++;
|
$commitcount++;
|
||||||
if ($opt_L && $commitcount > $opt_L) {
|
if ($opt_L && $commitcount > $opt_L) {
|
||||||
last;
|
last;
|
||||||
@ -910,11 +910,11 @@ while(<CVS>) {
|
|||||||
system("git repack -a -d");
|
system("git repack -a -d");
|
||||||
}
|
}
|
||||||
$state = 1;
|
$state = 1;
|
||||||
} elsif($state == 11 and /^-+$/) {
|
} elsif ($state == 11 and /^-+$/) {
|
||||||
$state = 1;
|
$state = 1;
|
||||||
} elsif(/^-+$/) { # end of unknown-line processing
|
} elsif (/^-+$/) { # end of unknown-line processing
|
||||||
$state = 1;
|
$state = 1;
|
||||||
} elsif($state != 11) { # ignore stuff when skipping
|
} elsif ($state != 11) { # ignore stuff when skipping
|
||||||
print "* UNKNOWN LINE * $_\n";
|
print "* UNKNOWN LINE * $_\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -943,7 +943,7 @@ if (defined $orig_git_index) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Now switch back to the branch we were in before all of this happened
|
# Now switch back to the branch we were in before all of this happened
|
||||||
if($orig_branch) {
|
if ($orig_branch) {
|
||||||
print "DONE.\n" if $opt_v;
|
print "DONE.\n" if $opt_v;
|
||||||
if ($opt_i) {
|
if ($opt_i) {
|
||||||
exit 0;
|
exit 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user