chiark / gitweb /
check_tree.pl migrate_tree.pl: Move necessary eop stuff into END blocks.
authorSven Eden <yamakuzure@gmx.net>
Wed, 16 May 2018 05:01:59 +0000 (07:01 +0200)
committerSven Eden <yamakuzure@gmx.net>
Wed, 16 May 2018 05:05:40 +0000 (07:05 +0200)
pwx/check_tree.pl
pwx/last_mutual_commits.csv
pwx/migrate_tree.pl

index 5a261e227f75b6a1c6f7f399aca9491034e8abca..20ec87891d4d52a3f4117c2c8db27692ccf000fb 100755 (executable)
@@ -319,37 +319,6 @@ for my $file_part (@source_files) {
        }
 } ## End of main loop
 
-# -------------------------------------------------------------------------
-# --- Print out the list of files that only exist here and not upstream ---
-# -------------------------------------------------------------------------
-if (scalar @only_here) {
-       my $count = scalar @only_here;
-       my $fmt   = sprintf("%%d %d: %%s\n", length("$count"));
-
-       printf("\n%d file%s only found in $WORKDIR:\n", $count, $count > 1 ? "s": "");
-
-       for (my $i = 0; $i < $count; ++$i) {
-               printf($fmt, $i + 1, $only_here[$i]);
-       }
-}
-
-# -------------------------------------------------------------------------
-# --- Print out the list of failed hunks -> bug in hunk or program?     ---
-# -------------------------------------------------------------------------
-if (scalar @lFails) {
-       my $count = scalar @lFails;
-
-       printf("\n%d file%s %s have at least one fishy hunk:\n", $count,
-              $count > 1 ? "s" : "", $count > 1 ? "have" : "has");
-
-       for (my $i = 0; $i < $count; ++$i) {
-               print "=== $lFails[$i]{part} ===\n";
-               print " => $lFails[$i]{msg} <=\n";
-               print "---------------------------\n";
-               print "$_\n" foreach(@{$lFails[$i]{hunk}});
-       }
-}
-
 # ===========================
 # === END OF MAIN PROGRAM ===
 # ===========================
@@ -358,7 +327,41 @@ if (scalar @lFails) {
 # ===        ==> --------     Cleanup      -------- <==        ===
 # ================================================================
 
-$do_stay or length($previous_commit) and checkout_upstream($previous_commit);
+END {
+       # -------------------------------------------------------------------------
+       # --- Print out the list of files that only exist here and not upstream ---
+       # -------------------------------------------------------------------------
+       if (scalar @only_here) {
+               my $count = scalar @only_here;
+               my $fmt   = sprintf("%%d %d: %%s\n", length("$count"));
+       
+               printf("\n%d file%s only found in $WORKDIR:\n", $count, $count > 1 ? "s": "");
+       
+               for (my $i = 0; $i < $count; ++$i) {
+                       printf($fmt, $i + 1, $only_here[$i]);
+               }
+       }
+       
+       # -------------------------------------------------------------------------
+       # --- Print out the list of failed hunks -> bug in hunk or program?     ---
+       # -------------------------------------------------------------------------
+       if (scalar @lFails) {
+               my $count = scalar @lFails;
+       
+               printf("\n%d file%s %s have at least one fishy hunk:\n", $count,
+                      $count > 1 ? "s" : "", $count > 1 ? "have" : "has");
+       
+               for (my $i = 0; $i < $count; ++$i) {
+                       print "=== $lFails[$i]{part} ===\n";
+                       print " => $lFails[$i]{msg} <=\n";
+                       print "---------------------------\n";
+                       print "$_\n" foreach(@{$lFails[$i]{hunk}});
+               }
+       }
+
+       $do_stay or length($previous_commit) and checkout_upstream($previous_commit);
+}
+
 
 # ================================================================
 # ===        ==> ---- Function Implementations ---- <==        ===
index 6a5ad34f766c74787639a3dd06e1426040a397d2..6e67488fafedef10ee9ae1223c2a672dec48d98a 100644 (file)
@@ -1,11 +1,14 @@
-master      265710c2055254a98ed6dcd6aa172ca509a33553 src-efaa3176ad0e763a0fafd4519d4391813a88ba0e x
-v229-stable c7f5a7d897491ceea90138d412a641b3225a1936 x x
-v231-stable 33628598ef1af73f8f50f96b4ce18f8a95733913 x x
-v232-stable 79a5d862a7abe903f456a75d6d1ca3c11adfa379 x x
-v233-stable 589fa9087a49e4250099bb6a4cf00358379fa3a4 x x
-v234        d6d0473dc9688dbfcd9e9b6ed005de26dd1131b7 src-782c925f7fa2e6e716ca9ac901954f3349d07ad8 x
-v234-stable 782c925f7fa2e6e716ca9ac901954f3349d07ad8 x x
-v235-stable b3e823e43c45b6233405d62e5f095c11130e638f x x
-v236        83fefc8888620ce27ba39d906bd879bbcb6bc84e src-f78a88beca362e62ca242499950a097fbcdb10d2 x
-v236-stable b3e823e43c45b6233405d62e5f095c11130e638f x x
-v237        f1d34068ef8d657238235d04ea291ee1ca095129 src-f1d34068ef8d657238235d04ea291ee1ca095129 tgt-cd4eee64482187443a097b2ce297bab27503a840
+# Automatically generated commit information
+# Only edit if you know what these do!
+
+master         265710c20       src-efaa3176a   x          
+v229-stable    c7f5a7d89       x               x          
+v231-stable    33628598e       x               x          
+v232-stable    79a5d862a       x               x          
+v233-stable    589fa9087       x               x          
+v234           d6d0473dc       src-782c925f7   x          
+v234-stable    782c925f7       x               x          
+v235-stable    b3e823e43       x               x          
+v236           83fefc888       src-f78a88bec   x          
+v236-stable    b3e823e43       x               x          
+v237           590171d1c       src-6d8c71eb8   x          
index 9772301010d077eb7bee04145a611c1f1c1d7c71..9ecaee6b27e8cfa92612e18f263b6470630f3542 100755 (executable)
@@ -201,10 +201,10 @@ for ( my $i = 0 ; $i < $commit_count ; ++$i ) {
        # ----------------------------------------------------------
        if ( scalar @lFiles > 1 ) {
                print "\nERROR: $fmt results in more than one patch!\n";
-               return 0;
+               exit 1;
        } elsif ( 1 > scalar @lFiles ) {
                print "\nERROR: No patches found for $fmt!";
-               return 0;
+               exit 1;
        }
 
        show_prg( sprintf("Reworking %s", basename( $lFiles[0] ) ) );
@@ -223,9 +223,6 @@ for ( my $i = 0 ; $i < $commit_count ; ++$i ) {
 } ## end for ( my $i = 0 ; $i < ...)
 show_prg("");
 
-# -----------------------------------------------------------------
-# --- 6) Write back the CSV file of mutual commits              ---
-set_last_mutual;
 
 # ===========================
 # === END OF MAIN PROGRAM ===
@@ -235,7 +232,11 @@ set_last_mutual;
 # ===        ==> --------     Cleanup      -------- <==        ===
 # ================================================================
 
-length($previous_refid) and checkout_upstream($previous_refid);
+END {
+       set_last_mutual;
+       length($previous_refid) and checkout_upstream($previous_refid);
+}
+
 
 # ================================================================
 # ===        ==> ---- Function Implementations ---- <==        ===
@@ -903,7 +904,7 @@ sub set_last_mutual {
                defined($hMutuals{$refid}{src}) and length($hMutuals{$refid}{src})
                        and $hMutuals{$refid}{src} = "src-" . $hMutuals{$refid}{src}
                         or $hMutuals{$refid}{src} = "x";
-               ($hMutuals{$refid}{src})    > $ref_len and $ref_len = length($hMutuals{$refid}{src});
+               length($hMutuals{$refid}{src})    > $ref_len and $ref_len = length($hMutuals{$refid}{src});
                defined($hMutuals{$refid}{tgt}) and length($hMutuals{$refid}{tgt})
                        and $hMutuals{$refid}{tgt} = "tgt-" . $hMutuals{$refid}{tgt}
                         or $hMutuals{$refid}{tgt} = "x";