mirror of
https://github.com/git/git.git
synced 2024-11-17 22:44:49 +01:00
Merge branch 'ml/cvs' into next
* ml/cvs: Change to allow subdir updates from Eclipse Many fixes for most operations in Eclipse. Added logged warnings for CVS error returns cvsserver: use git-rev-list instead of git-log git-cvsexportcommit: Add -f(orce) and -m(essage prefix) flags, small cleanups.
This commit is contained in:
commit
adcb913c77
3 changed files with 182 additions and 92 deletions
|
@ -8,7 +8,7 @@ git-cvsexportcommit - Export a commit to a CVS checkout
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
--------
|
--------
|
||||||
'git-cvsexportcommmit' [-h] [-v] [-c] [-p] [PARENTCOMMIT] COMMITID
|
'git-cvsexportcommmit' [-h] [-v] [-c] [-p] [-f] [-m msgprefix] [PARENTCOMMIT] COMMITID
|
||||||
|
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
|
@ -39,6 +39,13 @@ OPTIONS
|
||||||
Be pedantic (paranoid) when applying patches. Invokes patch with
|
Be pedantic (paranoid) when applying patches. Invokes patch with
|
||||||
--fuzz=0
|
--fuzz=0
|
||||||
|
|
||||||
|
-f::
|
||||||
|
Force the merge even if the files are not up to date.
|
||||||
|
|
||||||
|
-m::
|
||||||
|
Prepend the commit message with the provided prefix.
|
||||||
|
Useful for patch series and the like.
|
||||||
|
|
||||||
-v::
|
-v::
|
||||||
Verbose.
|
Verbose.
|
||||||
|
|
||||||
|
|
|
@ -10,9 +10,9 @@
|
||||||
die "GIT_DIR is not defined or is unreadable";
|
die "GIT_DIR is not defined or is unreadable";
|
||||||
}
|
}
|
||||||
|
|
||||||
our ($opt_h, $opt_p, $opt_v, $opt_c );
|
our ($opt_h, $opt_p, $opt_v, $opt_c, $opt_f, $opt_m );
|
||||||
|
|
||||||
getopts('hpvc');
|
getopts('hpvcfm:');
|
||||||
|
|
||||||
$opt_h && usage();
|
$opt_h && usage();
|
||||||
|
|
||||||
|
@ -77,12 +77,16 @@
|
||||||
$opt_v && print "Applying to CVS commit $commit from parent $parent\n";
|
$opt_v && print "Applying to CVS commit $commit from parent $parent\n";
|
||||||
|
|
||||||
# grab the commit message
|
# grab the commit message
|
||||||
`git-cat-file commit $commit | sed -e '1,/^\$/d' > .msg`;
|
open(MSG, ">.msg") or die "Cannot open .msg for writing";
|
||||||
|
print MSG $opt_m;
|
||||||
|
close MSG;
|
||||||
|
|
||||||
|
`git-cat-file commit $commit | sed -e '1,/^\$/d' >> .msg`;
|
||||||
$? && die "Error extracting the commit message";
|
$? && die "Error extracting the commit message";
|
||||||
|
|
||||||
my (@afiles, @dfiles, @mfiles);
|
my (@afiles, @dfiles, @mfiles);
|
||||||
my @files = safe_pipe_capture('git-diff-tree', '-r', $parent, $commit);
|
my @files = safe_pipe_capture('git-diff-tree', '-r', $parent, $commit);
|
||||||
print @files;
|
#print @files;
|
||||||
$? && die "Error in git-diff-tree";
|
$? && die "Error in git-diff-tree";
|
||||||
foreach my $f (@files) {
|
foreach my $f (@files) {
|
||||||
chomp $f;
|
chomp $f;
|
||||||
|
@ -109,7 +113,7 @@
|
||||||
if (@status > 1) { warn 'Strange! cvs status returned more than one line?'};
|
if (@status > 1) { warn 'Strange! cvs status returned more than one line?'};
|
||||||
unless ($status[0] =~ m/Status: Unknown$/) {
|
unless ($status[0] =~ m/Status: Unknown$/) {
|
||||||
$dirty = 1;
|
$dirty = 1;
|
||||||
warn "File $f is already known in your CVS checkout!\n";
|
warn "File $f is already known in your CVS checkout -- perhaps it has been added by another user. Or this may indicate that it exists on a different branch. If this is the case, use -f to force the merge.\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach my $f (@mfiles, @dfiles) {
|
foreach my $f (@mfiles, @dfiles) {
|
||||||
|
@ -122,7 +126,11 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($dirty) {
|
if ($dirty) {
|
||||||
die "Exiting: your CVS tree is not clean for this merge.";
|
if ($opt_f) { warn "The tree is not clean -- forced merge\n";
|
||||||
|
$dirty = 0;
|
||||||
|
} else {
|
||||||
|
die "Exiting: your CVS tree is not clean for this merge.";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
###
|
###
|
||||||
|
@ -215,7 +223,7 @@
|
||||||
}
|
}
|
||||||
sub usage {
|
sub usage {
|
||||||
print STDERR <<END;
|
print STDERR <<END;
|
||||||
Usage: GIT_DIR=/path/to/.git ${\basename $0} [-h] [-p] [-v] [-c] [ parent ] commit
|
Usage: GIT_DIR=/path/to/.git ${\basename $0} [-h] [-p] [-v] [-c] [-f] [-m msgprefix] [ parent ] commit
|
||||||
END
|
END
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -214,8 +214,7 @@ sub req_Globaloption
|
||||||
{
|
{
|
||||||
my ( $cmd, $data ) = @_;
|
my ( $cmd, $data ) = @_;
|
||||||
$log->debug("req_Globaloption : $data");
|
$log->debug("req_Globaloption : $data");
|
||||||
|
$state->{globaloptions}{$data} = 1;
|
||||||
# TODO : is this data useful ???
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Valid-responses request-list \n
|
# Valid-responses request-list \n
|
||||||
|
@ -267,12 +266,32 @@ sub req_Directory
|
||||||
|
|
||||||
$state->{localdir} = $data;
|
$state->{localdir} = $data;
|
||||||
$state->{repository} = $repository;
|
$state->{repository} = $repository;
|
||||||
$state->{directory} = $repository;
|
$state->{path} = $repository;
|
||||||
$state->{directory} =~ s/^$state->{CVSROOT}\///;
|
$state->{path} =~ s/^$state->{CVSROOT}\///;
|
||||||
$state->{module} = $1 if ($state->{directory} =~ s/^(.*?)(\/|$)//);
|
$state->{module} = $1 if ($state->{path} =~ s/^(.*?)(\/|$)//);
|
||||||
|
$state->{path} .= "/" if ( $state->{path} =~ /\S/ );
|
||||||
|
|
||||||
|
$state->{directory} = $state->{localdir};
|
||||||
|
$state->{directory} = "" if ( $state->{directory} eq "." );
|
||||||
$state->{directory} .= "/" if ( $state->{directory} =~ /\S/ );
|
$state->{directory} .= "/" if ( $state->{directory} =~ /\S/ );
|
||||||
|
|
||||||
$log->debug("req_Directory : localdir=$data repository=$repository directory=$state->{directory} module=$state->{module}");
|
if ( not defined($state->{prependdir}) and $state->{localdir} eq "." and $state->{path} =~ /\S/ )
|
||||||
|
{
|
||||||
|
$log->info("Setting prepend to '$state->{path}'");
|
||||||
|
$state->{prependdir} = $state->{path};
|
||||||
|
foreach my $entry ( keys %{$state->{entries}} )
|
||||||
|
{
|
||||||
|
$state->{entries}{$state->{prependdir} . $entry} = $state->{entries}{$entry};
|
||||||
|
delete $state->{entries}{$entry};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( defined ( $state->{prependdir} ) )
|
||||||
|
{
|
||||||
|
$log->debug("Prepending '$state->{prependdir}' to state|directory");
|
||||||
|
$state->{directory} = $state->{prependdir} . $state->{directory}
|
||||||
|
}
|
||||||
|
$log->debug("req_Directory : localdir=$data repository=$repository path=$state->{path} directory=$state->{directory} module=$state->{module}");
|
||||||
}
|
}
|
||||||
|
|
||||||
# Entry entry-line \n
|
# Entry entry-line \n
|
||||||
|
@ -290,7 +309,7 @@ sub req_Entry
|
||||||
{
|
{
|
||||||
my ( $cmd, $data ) = @_;
|
my ( $cmd, $data ) = @_;
|
||||||
|
|
||||||
$log->debug("req_Entry : $data");
|
#$log->debug("req_Entry : $data");
|
||||||
|
|
||||||
my @data = split(/\//, $data);
|
my @data = split(/\//, $data);
|
||||||
|
|
||||||
|
@ -300,6 +319,22 @@ sub req_Entry
|
||||||
options => $data[4],
|
options => $data[4],
|
||||||
tag_or_date => $data[5],
|
tag_or_date => $data[5],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$log->info("Received entry line '$data' => '" . $state->{directory} . $data[1] . "'");
|
||||||
|
}
|
||||||
|
|
||||||
|
# Questionable filename \n
|
||||||
|
# Response expected: no. Additional data: no. Tell the server to check
|
||||||
|
# whether filename should be ignored, and if not, next time the server
|
||||||
|
# sends responses, send (in a M response) `?' followed by the directory and
|
||||||
|
# filename. filename must not contain `/'; it needs to be a file in the
|
||||||
|
# directory named by the most recent Directory request.
|
||||||
|
sub req_Questionable
|
||||||
|
{
|
||||||
|
my ( $cmd, $data ) = @_;
|
||||||
|
|
||||||
|
$log->debug("req_Questionable : $data");
|
||||||
|
$state->{entries}{$state->{directory}.$data}{questionable} = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
# add \n
|
# add \n
|
||||||
|
@ -332,8 +367,7 @@ sub req_add
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
my ( $filepart, $dirpart ) = filenamesplit($filename, 1);
|
||||||
my ( $filepart, $dirpart ) = filenamesplit($filename);
|
|
||||||
|
|
||||||
print "E cvs add: scheduling file `$filename' for addition\n";
|
print "E cvs add: scheduling file `$filename' for addition\n";
|
||||||
|
|
||||||
|
@ -414,7 +448,7 @@ sub req_remove
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
my ( $filepart, $dirpart ) = filenamesplit($filename);
|
my ( $filepart, $dirpart ) = filenamesplit($filename, 1);
|
||||||
|
|
||||||
print "E cvs remove: scheduling `$filename' for removal\n";
|
print "E cvs remove: scheduling `$filename' for removal\n";
|
||||||
|
|
||||||
|
@ -502,22 +536,6 @@ sub req_Unchanged
|
||||||
#$log->debug("req_Unchanged : $data");
|
#$log->debug("req_Unchanged : $data");
|
||||||
}
|
}
|
||||||
|
|
||||||
# Questionable filename \n
|
|
||||||
# Response expected: no. Additional data: no.
|
|
||||||
# Tell the server to check whether filename should be ignored,
|
|
||||||
# and if not, next time the server sends responses, send (in
|
|
||||||
# a M response) `?' followed by the directory and filename.
|
|
||||||
# filename must not contain `/'; it needs to be a file in the
|
|
||||||
# directory named by the most recent Directory request.
|
|
||||||
sub req_Questionable
|
|
||||||
{
|
|
||||||
my ( $cmd, $data ) = @_;
|
|
||||||
|
|
||||||
$state->{entries}{$state->{directory}.$data}{questionable} = 1;
|
|
||||||
|
|
||||||
#$log->debug("req_Questionable : $data");
|
|
||||||
}
|
|
||||||
|
|
||||||
# Argument text \n
|
# Argument text \n
|
||||||
# Response expected: no. Save argument for use in a subsequent command.
|
# Response expected: no. Save argument for use in a subsequent command.
|
||||||
# Arguments accumulate until an argument-using command is given, at which
|
# Arguments accumulate until an argument-using command is given, at which
|
||||||
|
@ -757,8 +775,7 @@ sub req_update
|
||||||
|
|
||||||
$updater->update();
|
$updater->update();
|
||||||
|
|
||||||
# if no files were specified, we need to work out what files we should be providing status on ...
|
argsfromdir($updater);
|
||||||
argsfromdir($updater) if ( scalar ( @{$state->{args}} ) == 0 );
|
|
||||||
|
|
||||||
#$log->debug("update state : " . Dumper($state));
|
#$log->debug("update state : " . Dumper($state));
|
||||||
|
|
||||||
|
@ -767,6 +784,8 @@ sub req_update
|
||||||
{
|
{
|
||||||
$filename = filecleanup($filename);
|
$filename = filecleanup($filename);
|
||||||
|
|
||||||
|
$log->debug("Processing file $filename");
|
||||||
|
|
||||||
# if we have a -C we should pretend we never saw modified stuff
|
# if we have a -C we should pretend we never saw modified stuff
|
||||||
if ( exists ( $state->{opt}{C} ) )
|
if ( exists ( $state->{opt}{C} ) )
|
||||||
{
|
{
|
||||||
|
@ -821,13 +840,16 @@ sub req_update
|
||||||
|
|
||||||
if ( $meta->{filehash} eq "deleted" )
|
if ( $meta->{filehash} eq "deleted" )
|
||||||
{
|
{
|
||||||
my ( $filepart, $dirpart ) = filenamesplit($filename);
|
my ( $filepart, $dirpart ) = filenamesplit($filename,1);
|
||||||
|
|
||||||
$log->info("Removing '$filename' from working copy (no longer in the repo)");
|
$log->info("Removing '$filename' from working copy (no longer in the repo)");
|
||||||
|
|
||||||
print "E cvs update: `$filename' is no longer in the repository\n";
|
print "E cvs update: `$filename' is no longer in the repository\n";
|
||||||
print "Removed $dirpart\n";
|
# Don't want to actually _DO_ the update if -n specified
|
||||||
print "$filepart\n";
|
unless ( $state->{globaloptions}{-n} ) {
|
||||||
|
print "Removed $dirpart\n";
|
||||||
|
print "$filepart\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
elsif ( not defined ( $state->{entries}{$filename}{modified_hash} )
|
elsif ( not defined ( $state->{entries}{$filename}{modified_hash} )
|
||||||
or $state->{entries}{$filename}{modified_hash} eq $oldmeta->{filehash} )
|
or $state->{entries}{$filename}{modified_hash} eq $oldmeta->{filehash} )
|
||||||
|
@ -840,34 +862,42 @@ sub req_update
|
||||||
print "MT newline\n";
|
print "MT newline\n";
|
||||||
print "MT -updated\n";
|
print "MT -updated\n";
|
||||||
|
|
||||||
my ( $filepart, $dirpart ) = filenamesplit($filename);
|
my ( $filepart, $dirpart ) = filenamesplit($filename,1);
|
||||||
$dirpart =~ s/^$state->{directory}//;
|
|
||||||
|
|
||||||
if ( defined ( $wrev ) )
|
# Don't want to actually _DO_ the update if -n specified
|
||||||
{
|
unless ( $state->{globaloptions}{-n} )
|
||||||
# instruct client we're sending a file to put in this path as a replacement
|
{
|
||||||
print "Update-existing $dirpart\n";
|
if ( defined ( $wrev ) )
|
||||||
$log->debug("Updating existing file 'Update-existing $dirpart'");
|
{
|
||||||
} else {
|
# instruct client we're sending a file to put in this path as a replacement
|
||||||
# instruct client we're sending a file to put in this path as a new file
|
print "Update-existing $dirpart\n";
|
||||||
print "Created $dirpart\n";
|
$log->debug("Updating existing file 'Update-existing $dirpart'");
|
||||||
$log->debug("Creating new file 'Created $dirpart'");
|
} else {
|
||||||
}
|
# instruct client we're sending a file to put in this path as a new file
|
||||||
print $state->{CVSROOT} . "/$state->{module}/$filename\n";
|
print "Clear-static-directory $dirpart\n";
|
||||||
|
print $state->{CVSROOT} . "/$state->{module}/$dirpart\n";
|
||||||
|
print "Clear-sticky $dirpart\n";
|
||||||
|
print $state->{CVSROOT} . "/$state->{module}/$dirpart\n";
|
||||||
|
|
||||||
# this is an "entries" line
|
$log->debug("Creating new file 'Created $dirpart'");
|
||||||
$log->debug("/$filepart/1.$meta->{revision}///");
|
print "Created $dirpart\n";
|
||||||
print "/$filepart/1.$meta->{revision}///\n";
|
}
|
||||||
|
print $state->{CVSROOT} . "/$state->{module}/$filename\n";
|
||||||
|
|
||||||
# permissions
|
# this is an "entries" line
|
||||||
$log->debug("SEND : u=$meta->{mode},g=$meta->{mode},o=$meta->{mode}");
|
$log->debug("/$filepart/1.$meta->{revision}///");
|
||||||
print "u=$meta->{mode},g=$meta->{mode},o=$meta->{mode}\n";
|
print "/$filepart/1.$meta->{revision}///\n";
|
||||||
|
|
||||||
# transmit file
|
# permissions
|
||||||
transmitfile($meta->{filehash});
|
$log->debug("SEND : u=$meta->{mode},g=$meta->{mode},o=$meta->{mode}");
|
||||||
|
print "u=$meta->{mode},g=$meta->{mode},o=$meta->{mode}\n";
|
||||||
|
|
||||||
|
# transmit file
|
||||||
|
transmitfile($meta->{filehash});
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$log->info("Updating '$filename'");
|
$log->info("Updating '$filename'");
|
||||||
my ( $filepart, $dirpart ) = filenamesplit($meta->{name});
|
my ( $filepart, $dirpart ) = filenamesplit($meta->{name},1);
|
||||||
|
|
||||||
my $dir = tempdir( DIR => $TEMP_DIR, CLEANUP => 1 ) . "/";
|
my $dir = tempdir( DIR => $TEMP_DIR, CLEANUP => 1 ) . "/";
|
||||||
|
|
||||||
|
@ -892,19 +922,29 @@ sub req_update
|
||||||
$log->info("Merged successfully");
|
$log->info("Merged successfully");
|
||||||
print "M M $filename\n";
|
print "M M $filename\n";
|
||||||
$log->debug("Update-existing $dirpart");
|
$log->debug("Update-existing $dirpart");
|
||||||
print "Update-existing $dirpart\n";
|
|
||||||
$log->debug($state->{CVSROOT} . "/$state->{module}/$filename");
|
# Don't want to actually _DO_ the update if -n specified
|
||||||
print $state->{CVSROOT} . "/$state->{module}/$filename\n";
|
unless ( $state->{globaloptions}{-n} )
|
||||||
$log->debug("/$filepart/1.$meta->{revision}///");
|
{
|
||||||
print "/$filepart/1.$meta->{revision}///\n";
|
print "Update-existing $dirpart\n";
|
||||||
|
$log->debug($state->{CVSROOT} . "/$state->{module}/$filename");
|
||||||
|
print $state->{CVSROOT} . "/$state->{module}/$filename\n";
|
||||||
|
$log->debug("/$filepart/1.$meta->{revision}///");
|
||||||
|
print "/$filepart/1.$meta->{revision}///\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
elsif ( $return == 1 )
|
elsif ( $return == 1 )
|
||||||
{
|
{
|
||||||
$log->info("Merged with conflicts");
|
$log->info("Merged with conflicts");
|
||||||
print "M C $filename\n";
|
print "M C $filename\n";
|
||||||
print "Update-existing $dirpart\n";
|
|
||||||
print $state->{CVSROOT} . "/$state->{module}/$filename\n";
|
# Don't want to actually _DO_ the update if -n specified
|
||||||
print "/$filepart/1.$meta->{revision}/+//\n";
|
unless ( $state->{globaloptions}{-n} )
|
||||||
|
{
|
||||||
|
print "Update-existing $dirpart\n";
|
||||||
|
print $state->{CVSROOT} . "/$state->{module}/$filename\n";
|
||||||
|
print "/$filepart/1.$meta->{revision}/+//\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -912,17 +952,21 @@ sub req_update
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
|
||||||
# permissions
|
# Don't want to actually _DO_ the update if -n specified
|
||||||
$log->debug("SEND : u=$meta->{mode},g=$meta->{mode},o=$meta->{mode}");
|
unless ( $state->{globaloptions}{-n} )
|
||||||
print "u=$meta->{mode},g=$meta->{mode},o=$meta->{mode}\n";
|
{
|
||||||
|
# permissions
|
||||||
|
$log->debug("SEND : u=$meta->{mode},g=$meta->{mode},o=$meta->{mode}");
|
||||||
|
print "u=$meta->{mode},g=$meta->{mode},o=$meta->{mode}\n";
|
||||||
|
|
||||||
# transmit file, format is single integer on a line by itself (file
|
# transmit file, format is single integer on a line by itself (file
|
||||||
# size) followed by the file contents
|
# size) followed by the file contents
|
||||||
# TODO : we should copy files in blocks
|
# TODO : we should copy files in blocks
|
||||||
my $data = `cat $file_local`;
|
my $data = `cat $file_local`;
|
||||||
$log->debug("File size : " . length($data));
|
$log->debug("File size : " . length($data));
|
||||||
print length($data) . "\n";
|
print length($data) . "\n";
|
||||||
print $data;
|
print $data;
|
||||||
|
}
|
||||||
|
|
||||||
chdir "/";
|
chdir "/";
|
||||||
}
|
}
|
||||||
|
@ -950,6 +994,7 @@ sub req_ci
|
||||||
|
|
||||||
if ( -e $state->{CVSROOT} . "/index" )
|
if ( -e $state->{CVSROOT} . "/index" )
|
||||||
{
|
{
|
||||||
|
$log->warn("file 'index' already exists in the git repository");
|
||||||
print "error 1 Index already exists in git repo\n";
|
print "error 1 Index already exists in git repo\n";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
@ -957,6 +1002,7 @@ sub req_ci
|
||||||
my $lockfile = "$state->{CVSROOT}/refs/heads/$state->{module}.lock";
|
my $lockfile = "$state->{CVSROOT}/refs/heads/$state->{module}.lock";
|
||||||
unless ( sysopen(LOCKFILE,$lockfile,O_EXCL|O_CREAT|O_WRONLY) )
|
unless ( sysopen(LOCKFILE,$lockfile,O_EXCL|O_CREAT|O_WRONLY) )
|
||||||
{
|
{
|
||||||
|
$log->warn("lockfile '$lockfile' already exists, please try again");
|
||||||
print "error 1 Lock file '$lockfile' already exists, please try again\n";
|
print "error 1 Lock file '$lockfile' already exists, please try again\n";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
@ -988,6 +1034,7 @@ sub req_ci
|
||||||
# foreach file specified on the commandline ...
|
# foreach file specified on the commandline ...
|
||||||
foreach my $filename ( @{$state->{args}} )
|
foreach my $filename ( @{$state->{args}} )
|
||||||
{
|
{
|
||||||
|
my $committedfile = $filename;
|
||||||
$filename = filecleanup($filename);
|
$filename = filecleanup($filename);
|
||||||
|
|
||||||
next unless ( exists $state->{entries}{$filename}{modified_filename} or not $state->{entries}{$filename}{unchanged} );
|
next unless ( exists $state->{entries}{$filename}{modified_filename} or not $state->{entries}{$filename}{unchanged} );
|
||||||
|
@ -1022,7 +1069,7 @@ sub req_ci
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
push @committedfiles, $filename;
|
push @committedfiles, $committedfile;
|
||||||
$log->info("Committing $filename");
|
$log->info("Committing $filename");
|
||||||
|
|
||||||
system("mkdir","-p",$dirpart) unless ( -d $dirpart );
|
system("mkdir","-p",$dirpart) unless ( -d $dirpart );
|
||||||
|
@ -1105,7 +1152,7 @@ sub req_ci
|
||||||
|
|
||||||
my $meta = $updater->getmeta($filename);
|
my $meta = $updater->getmeta($filename);
|
||||||
|
|
||||||
my ( $filepart, $dirpart ) = filenamesplit($filename);
|
my ( $filepart, $dirpart ) = filenamesplit($filename, 1);
|
||||||
|
|
||||||
$log->debug("Checked-in $dirpart : $filename");
|
$log->debug("Checked-in $dirpart : $filename");
|
||||||
|
|
||||||
|
@ -1141,7 +1188,7 @@ sub req_status
|
||||||
$updater->update();
|
$updater->update();
|
||||||
|
|
||||||
# if no files were specified, we need to work out what files we should be providing status on ...
|
# if no files were specified, we need to work out what files we should be providing status on ...
|
||||||
argsfromdir($updater) if ( scalar ( @{$state->{args}} ) == 0 );
|
argsfromdir($updater);
|
||||||
|
|
||||||
# foreach file specified on the commandline ...
|
# foreach file specified on the commandline ...
|
||||||
foreach my $filename ( @{$state->{args}} )
|
foreach my $filename ( @{$state->{args}} )
|
||||||
|
@ -1242,7 +1289,7 @@ sub req_diff
|
||||||
$updater->update();
|
$updater->update();
|
||||||
|
|
||||||
# if no files were specified, we need to work out what files we should be providing status on ...
|
# if no files were specified, we need to work out what files we should be providing status on ...
|
||||||
argsfromdir($updater) if ( scalar ( @{$state->{args}} ) == 0 );
|
argsfromdir($updater);
|
||||||
|
|
||||||
# foreach file specified on the commandline ...
|
# foreach file specified on the commandline ...
|
||||||
foreach my $filename ( @{$state->{args}} )
|
foreach my $filename ( @{$state->{args}} )
|
||||||
|
@ -1384,7 +1431,7 @@ sub req_log
|
||||||
$updater->update();
|
$updater->update();
|
||||||
|
|
||||||
# if no files were specified, we need to work out what files we should be providing status on ...
|
# if no files were specified, we need to work out what files we should be providing status on ...
|
||||||
argsfromdir($updater) if ( scalar ( @{$state->{args}} ) == 0 );
|
argsfromdir($updater);
|
||||||
|
|
||||||
# foreach file specified on the commandline ...
|
# foreach file specified on the commandline ...
|
||||||
foreach my $filename ( @{$state->{args}} )
|
foreach my $filename ( @{$state->{args}} )
|
||||||
|
@ -1460,7 +1507,7 @@ sub req_annotate
|
||||||
$updater->update();
|
$updater->update();
|
||||||
|
|
||||||
# if no files were specified, we need to work out what files we should be providing annotate on ...
|
# if no files were specified, we need to work out what files we should be providing annotate on ...
|
||||||
argsfromdir($updater) if ( scalar ( @{$state->{args}} ) == 0 );
|
argsfromdir($updater);
|
||||||
|
|
||||||
# we'll need a temporary checkout dir
|
# we'll need a temporary checkout dir
|
||||||
my $tmpdir = tempdir ( DIR => $TEMP_DIR );
|
my $tmpdir = tempdir ( DIR => $TEMP_DIR );
|
||||||
|
@ -1655,13 +1702,36 @@ sub argsfromdir
|
||||||
{
|
{
|
||||||
my $updater = shift;
|
my $updater = shift;
|
||||||
|
|
||||||
$state->{args} = [];
|
$state->{args} = [] if ( scalar(@{$state->{args}}) == 1 and $state->{args}[0] eq "." );
|
||||||
|
|
||||||
foreach my $file ( @{$updater->gethead} )
|
return if ( scalar ( @{$state->{args}} ) > 1 );
|
||||||
|
|
||||||
|
if ( scalar(@{$state->{args}}) == 1 )
|
||||||
{
|
{
|
||||||
next if ( $file->{filehash} eq "deleted" and not defined ( $state->{entries}{$file->{name}} ) );
|
my $arg = $state->{args}[0];
|
||||||
next unless ( $file->{name} =~ s/^$state->{directory}// );
|
$arg .= $state->{prependdir} if ( defined ( $state->{prependdir} ) );
|
||||||
push @{$state->{args}}, $file->{name};
|
|
||||||
|
$log->info("Only one arg specified, checking for directory expansion on '$arg'");
|
||||||
|
|
||||||
|
foreach my $file ( @{$updater->gethead} )
|
||||||
|
{
|
||||||
|
next if ( $file->{filehash} eq "deleted" and not defined ( $state->{entries}{$file->{name}} ) );
|
||||||
|
next unless ( $file->{name} =~ /^$arg\// or $file->{name} eq $arg );
|
||||||
|
push @{$state->{args}}, $file->{name};
|
||||||
|
}
|
||||||
|
|
||||||
|
shift @{$state->{args}} if ( scalar(@{$state->{args}}) > 1 );
|
||||||
|
} else {
|
||||||
|
$log->info("Only one arg specified, populating file list automatically");
|
||||||
|
|
||||||
|
$state->{args} = [];
|
||||||
|
|
||||||
|
foreach my $file ( @{$updater->gethead} )
|
||||||
|
{
|
||||||
|
next if ( $file->{filehash} eq "deleted" and not defined ( $state->{entries}{$file->{name}} ) );
|
||||||
|
next unless ( $file->{name} =~ s/^$state->{prependdir}// );
|
||||||
|
push @{$state->{args}}, $file->{name};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1736,11 +1806,17 @@ sub transmitfile
|
||||||
sub filenamesplit
|
sub filenamesplit
|
||||||
{
|
{
|
||||||
my $filename = shift;
|
my $filename = shift;
|
||||||
|
my $fixforlocaldir = shift;
|
||||||
|
|
||||||
my ( $filepart, $dirpart ) = ( $filename, "." );
|
my ( $filepart, $dirpart ) = ( $filename, "." );
|
||||||
( $filepart, $dirpart ) = ( $2, $1 ) if ( $filename =~ /(.*)\/(.*)/ );
|
( $filepart, $dirpart ) = ( $2, $1 ) if ( $filename =~ /(.*)\/(.*)/ );
|
||||||
$dirpart .= "/";
|
$dirpart .= "/";
|
||||||
|
|
||||||
|
if ( $fixforlocaldir )
|
||||||
|
{
|
||||||
|
$dirpart =~ s/^$state->{prependdir}//;
|
||||||
|
}
|
||||||
|
|
||||||
return ( $filepart, $dirpart );
|
return ( $filepart, $dirpart );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1756,8 +1832,7 @@ sub filecleanup
|
||||||
}
|
}
|
||||||
|
|
||||||
$filename =~ s/^\.\///g;
|
$filename =~ s/^\.\///g;
|
||||||
$filename = $state->{directory} . $filename;
|
$filename = $state->{prependdir} . $filename;
|
||||||
|
|
||||||
return $filename;
|
return $filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue