texlive[46608] Master/tlpkg/TeXLive/TLTREE.pm: TLTREE: from git:

commits+preining at tug.org commits+preining at tug.org
Mon Feb 12 07:49:50 CET 2018


Revision: 46608
          http://tug.org/svn/texlive?view=revision&revision=46608
Author:   preining
Date:     2018-02-12 07:49:49 +0100 (Mon, 12 Feb 2018)
Log Message:
-----------
TLTREE: from git: support removed files (don't include them)

Modified Paths:
--------------
    trunk/Master/tlpkg/TeXLive/TLTREE.pm

Modified: trunk/Master/tlpkg/TeXLive/TLTREE.pm
===================================================================
--- trunk/Master/tlpkg/TeXLive/TLTREE.pm	2018-02-12 05:37:25 UTC (rev 46607)
+++ trunk/Master/tlpkg/TeXLive/TLTREE.pm	2018-02-12 06:49:49 UTC (rev 46608)
@@ -78,9 +78,10 @@
   my $svnroot = $self->{'svnroot'};
   my $retval = $?;
   my %files;
+  my %deletedfiles;
   my @lines;
 
-  my @foo = `cd $svnroot; git log --pretty=format:COMMIT=%h --name-only`;
+  my @foo = `cd $svnroot; git log --pretty=format:COMMIT=%h --no-renames --name-status`;
   if ($retval != 0) {
     $retval /= 256 if $retval > 0;
     tldie("TLTree: git log in $svnroot returned $retval, stopping.\n");
@@ -97,9 +98,27 @@
       $rev++;
       next;
     } else {
-      # we only use the first occurrence of $f from the top,
-      # that is the most recent change
-      $files{$l} = $rev if (not(defined($files{$l})));
+      # output is 
+      #   STATUS FILENAME
+      # where STATUS is as follows:
+      #   Added (A), Copied (C), Deleted (D), Modified (M), Renamed (R), have their type (i.e. regular file,
+      #   symlink, submodule, ...) changed (T), are Unmerged (U), are Unknown (X), or have had their pairing Broken (B).
+      if ($l =~ m/^(A|C|D|M|R|T|U|X|B)\S*\s+(.*)$/) {
+        my $status = $1;
+        my $curfile = $2;
+        #
+        # check whether the file was already removed
+        if (!defined($files{$curfile}) && !defined($deletedfiles{$curfile})) {
+          # first occurrence of that file
+          if ($status eq "D") {
+            $deletedfiles{$curfile} = 1;
+          } else {
+            $files{$curfile} = $rev;
+          }
+        }
+      } else {
+        print STDERR "Unknown line in git output: >>$l<<\n";
+      }
     }
   }
 



More information about the tex-live-commits mailing list