aboutsummaryrefslogtreecommitdiffstats
path: root/copypage.pl
diff options
context:
space:
mode:
authorJavier Fernandez-Sanguino Peña <jfs>2010-10-15 21:42:32 +0000
committerJavier Fernandez-Sanguino Peña <jfs>2010-10-15 21:42:32 +0000
commita9fadb7638571555bf5e063cf1f5cde619e63570 (patch)
treeb24289ef186cd7812f2976c7f27cd71d79d02073 /copypage.pl
parentb7a4f7d8cad1755e9ab6d6ff55ff19b8f2657f74 (diff)
Improve code that checks for files in the Attic
CVS version numbers copypage.pl: 1.32 -> 1.33
Diffstat (limited to 'copypage.pl')
-rwxr-xr-xcopypage.pl40
1 files changed, 26 insertions, 14 deletions
diff --git a/copypage.pl b/copypage.pl
index 85be3cb20c4..6669aedfb97 100755
--- a/copypage.pl
+++ b/copypage.pl
@@ -327,7 +327,8 @@ sub decodeentity
# Find for old translations in the CVS Attic
sub find_files_attic
{
- $dstfile =~ s/'//;
+ my ($file) = @_;
+ $file =~ s/'//;
# Create a temporary file for the cvs results
my ($tempfh, $tmpfile) = tempfile("cvsinfo.XXXXXX", DIR => File::Spec->tmpdir, UNLINK => 0) ;
@@ -335,7 +336,7 @@ sub find_files_attic
# Run 'cvs status'. Unfortunately, this is the only way
# to look for files in the Attic
- system "cvs status '$dstfile' >$tmpfile 2>&1";
+ system "cvs status '$file' >$tmpfile 2>&1";
# If CVS does not return an error then there is a file in CVS
# even if $dstfile is not in the filesystem
@@ -345,6 +346,7 @@ sub find_files_attic
if ( $? == 0 ) {
my $deleted_version = "<latest_version>";
my $previous_version = "<version_before_deletion>";
+ my $cvs_location = "";
# Parse the result of cvs status
open(TF, $tmpfile) || die ("Cannot open temporary file: $?");
@@ -360,18 +362,28 @@ sub find_files_attic
unlink $tmpfile;
# Now determine in which situation we are in
- if ( $cvs_location =~ /Attic\// ) {
- print STDERR "ERROR: An old translation exists in the Attic, you should restore it using:\n";
- print STDERR "\tcvs update -j $deleted_version -j $previous_version $dstfile\n";
- print STDERR "\t[Edit and update the file]\n";
- print STDERR "\tcvs ci $dstfile\n";
- die ("Old translation found\n");
- } else {
- die ("ERROR: A translation already exist in CVS for this file.\nPlease update your CVS copy using 'cvs update'.\n");
- }
- }
-
-# Return if cvs returns an error
+ if ( $cvs_location ne "" ) {
+ # We need CVS information to continue here
+ if ( $cvs_location =~ /Attic\// ) {
+ # Situation 1 - There is a translation in the Attic
+ # Give information on how to restore
+ print STDERR "ERROR: An old translation exists in the Attic, you should restore it using:\n";
+ print STDERR "\tcvs update -j $deleted_version -j $previous_version $dstfile\n";
+ print STDERR "\t[Edit and update the file]\n";
+ print STDERR "\tcvs ci $dstfile\n";
+ die ("Old translation found\n");
+ } else {
+ # Situation 2 - There is already a file in CVS with this
+ # name, since it does not exist in the local copy maybe
+ # the local copy is not up to date
+ die ("ERROR: A translation already exist in CVS for this file.\nPlease update your CVS copy using 'cvs update'.\n");
+ } # of if $cvs_location Attic
+ } # of if $cvs_location ne ""
+ } # of if $?
+# Nothing to do if cvs returns an error, maybe its because we have
+# no network access
+
+# Cleanup
unlink $tmpfile;
return 0;

© 2014-2024 Faster IT GmbH | imprint | privacy policy