From 29361c4625bd0b5cf10a3334946028131c6974f1 Mon Sep 17 00:00:00 2001
From: Magali Ruffier <mr6@ebi.ac.uk>
Date: Fri, 16 Nov 2012 15:57:27 +0000
Subject: [PATCH] do not use the same variable name for two distinct things
 when looping, if looking for previous_dbname, would always be defined because
 of the last loop, so comparing the wrong databases

---
 misc-scripts/update_mapping_set.pl | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/misc-scripts/update_mapping_set.pl b/misc-scripts/update_mapping_set.pl
index 11f6ee566e..5dc2e3c9f6 100644
--- a/misc-scripts/update_mapping_set.pl
+++ b/misc-scripts/update_mapping_set.pl
@@ -98,11 +98,12 @@ my $port = 3306;
 my $oldport = 3306;
 my $olduser = "ensro";
 my $oldpass = undef;
-my $previous_dbname = undef;
+my $compare_dbname = undef;
 my $help = undef;
 my $release = undef;
 my $dry_run = undef;
 my $dbtype = "core";
+my $previous_dbname;
 
 GetOptions('host=s'    => \$host,
 	   'dbname=s'  => \$dbname,
@@ -114,7 +115,7 @@ GetOptions('host=s'    => \$host,
 	   'oldport=s' => \$oldport,
 	   'olduser=s' => \$olduser,
 	   'oldpass=s' => \$oldpass,
-           'previous_dbname=s'  => \$previous_dbname,
+           'previous_dbname=s'  => \$compare_dbname,
 	   'help'      => \$help,
 	   'dry_run'   => \$dry_run,
            'dbtype=s'    => \$dbtype,
@@ -159,8 +160,10 @@ foreach my $h ($host,$host2) {
     my $count_added = 0;
 
     $sth_update_build->execute($schema_build) unless $dry_run;
-    if (!$previous_dbname) {
+    if (!$compare_dbname) {
        $previous_dbname = &get_previous_dbname($old_dbh,$current_dbname,$release);
+    } else {
+       $previous_dbname = $compare_dbname;
     }
 
 # If there is no previous database, no mapping needed
-- 
GitLab