1
1

Update search_compare as we no longer support svn - only repo we support is git

Этот коммит содержится в:
Ralph Castain 2015-03-05 08:24:56 -08:00
родитель 90fb33c1ce
Коммит 07587892da

Просмотреть файл

@ -38,8 +38,6 @@ my $diff_file = "";
my $diff_arg; my $diff_arg;
my $update_arg; my $update_arg;
my $modified_arg; my $modified_arg;
my $git_arg = 0;
my $svn_arg = 0;
my $repo_type; my $repo_type;
my $cmd; my $cmd;
@ -48,7 +46,7 @@ sub construct {
# "special" directories # "special" directories
if ( -l $_ ) { return; } if ( -l $_ ) { return; }
if ( -d $_ ) { if ( -d $_ ) {
if ((/\.svn/) || (/\.deps/) || (/\.libs/) || (/\.hg/) || (/\.git/) || (/\.dSYM/) || ($_ eq "autom4te.cache") || ($_ eq "libltdl")) { if ((/\.deps/) || (/\.libs/) || (/\.git/) || (/\.dSYM/) || ($_ eq "autom4te.cache") || ($_ eq "libltdl")) {
$File::Find::prune = true; $File::Find::prune = true;
} }
return; return;
@ -87,9 +85,7 @@ my $ok = Getopt::Long::GetOptions("help|h" => \$help_arg,
"tgt=s" => \$tgt_arg, "tgt=s" => \$tgt_arg,
"diff=s" => \$diff_arg, "diff=s" => \$diff_arg,
"update" => \$update_arg, "update" => \$update_arg,
"update-modified" => \$modified_arg, "update-modified" => \$modified_arg
"git" => \$git_arg,
"svn" => \$svn_arg
); );
if (!$ok || $help_arg) { if (!$ok || $help_arg) {
@ -100,9 +96,7 @@ if (!$ok || $help_arg) {
--src | -src Head of source directory --src | -src Head of source directory
--tgt | -tgt Head of target directory --tgt | -tgt Head of target directory
--update | -update Apply changes to update target --update | -update Apply changes to update target
--update-modified Only update modified files (do not add/delete files) --update-modified Only update modified files (do not add/delete files)\n";
--git Target is a git repo, so use git commands to add/delete files
--svn Target is a svn repo, so use svn commands to add/delete files\n";
exit($ok ? 0 : 1); exit($ok ? 0 : 1);
} }
@ -111,16 +105,6 @@ if (!$src_arg || !$tgt_arg) {
exit(1); exit(1);
} }
if (!$git_arg && !$svn_arg) {
print "Missing repo type argument\n";
exit(1);
}
if ($git_arg) {
$repo_type = 1;
} else {
$repo_type = 0;
}
$src_dir = File::Spec->rel2abs($src_arg); $src_dir = File::Spec->rel2abs($src_arg);
$target_dir = File::Spec->rel2abs($tgt_arg); $target_dir = File::Spec->rel2abs($tgt_arg);
my @srcpth = (); my @srcpth = ();
@ -228,20 +212,12 @@ foreach $src (@src_tree) {
exit; exit;
} }
print "Adding $tpath to repo\n"; print "Adding $tpath to repo\n";
if (1 == $repo_type) {
$cmd = "pushd $target_dir >& /dev/null; git add $tpath >& /dev/null; popd >& /dev/null"; $cmd = "pushd $target_dir >& /dev/null; git add $tpath >& /dev/null; popd >& /dev/null";
} else {
$cmd = "pushd $target_dir >& /dev/null; svn add $tpath >& /dev/null; popd >& /dev/null";
}
system($cmd); system($cmd);
} }
print "Adding $src to repo\n"; print "Adding $src to repo\n";
copy("$src", "$targetpath") or die "Update failed: src=$src tgt=$targetpath\n"; copy("$src", "$targetpath") or die "Update failed: src=$src tgt=$targetpath\n";
if (1 == $repo_type) {
$cmd = "pushd $target_dir >& /dev/null; git add $targetpath >& /dev/null; popd >& /dev/null"; $cmd = "pushd $target_dir >& /dev/null; git add $targetpath >& /dev/null; popd >& /dev/null";
} else {
$cmd = "pushd $target_dir >& /dev/null; svn add $targetpath >& /dev/null; popd >& /dev/null";
}
system($cmd); system($cmd);
} else { } else {
print "Add: " . $src . "\n"; print "Add: " . $src . "\n";
@ -269,11 +245,7 @@ if (!$modified_arg) {
if ($found == 0) { if ($found == 0) {
if ($update_arg) { if ($update_arg) {
print "Removing $tgt_file from repo\n"; print "Removing $tgt_file from repo\n";
if (1 == $repo_type) {
$cmd = "pushd $target_dir >& /dev/null; git rm .$tgt_file >& /dev/null; popd >& /dev/null"; $cmd = "pushd $target_dir >& /dev/null; git rm .$tgt_file >& /dev/null; popd >& /dev/null";
} else {
$cmd = "pushd $target_dir >& /dev/null; svn del $tgt >& /dev/null; popd >& /dev/null";
}
system($cmd); system($cmd);
} else { } else {
print "Delete: " . $tgt . "\n"; print "Delete: " . $tgt . "\n";