[svnbook commit] r2778 - in trunk/src/nb: . bin

sunny256 noreply at red-bean.com
Wed Apr 11 10:36:36 CDT 2007


Author: sunny256
Date: Wed Apr 11 10:36:35 2007
New Revision: 2778

Log:
Remove line numbers and size information from src/nb/TRANSLATION-STATUS, 
it polluted the revision diffs too much.

* src/nb/bin/genstat
  Don’t generate line number and size information by default. Added two 
  options — "--lines"/"-l" and "--size"/"-s" — for situations when it’s 
  really, really, really needed.
  (read_file): Print only file name by default, or size information if 
    the --size option is specified.
  (file_entry): Don’t print line number ranges unless --lines is 
    specified. Added total number of lines in blocks to first line.
  (block): Added "lines" keyword, returns number of lines in all blocks 
    for a specific marker.
  (usage): Document --lines and --size.

* src/nb/TRANSLATION-STATUS
  And that’s how it looks now. Generated by make status.


Modified:
   trunk/src/nb/TRANSLATION-STATUS
   trunk/src/nb/bin/genstat

Modified: trunk/src/nb/TRANSLATION-STATUS
==============================================================================
--- trunk/src/nb/TRANSLATION-STATUS	(original)
+++ trunk/src/nb/TRANSLATION-STATUS	Wed Apr 11 10:36:35 2007
@@ -7,81 +7,44 @@
 
 $Id$
 
-* book/book.xml - 3391 bytes, 131 lines
+* book/book.xml
     Translation complete
-* book/foreword.xml - 6860 bytes, 145 lines
+* book/foreword.xml
     Translation complete
-* book/ch-preface.xml - 44146 bytes, 1004 lines
+* book/ch-preface.xml
     Translation complete
-* book/ch-fundamental-concepts.xml - 44848 bytes, 1015 lines
-    Untranslated: 0.92% - 2 blocks
-        Line 888-899 (10)
-        Line 1098-1110 (11)
-* book/ch-basic-usage.xml - 95177 bytes, 2370 lines
-    Untranslated: 1.34% - 6 blocks
-        Line 2921-2940 (18)
-        Line 2959-2967 (7)
-        Line 2976-2983 (6)
-        Line 3010-3023 (12)
-        Line 3602-3616 (13)
-        Line 4177-4187 (9)
-* book/ch-advanced-topics.xml - 109485 bytes, 2339 lines
-    Untranslated: 80.92% - 3 blocks
-        Line 570-587 (16)
-        Line 887-896 (8)
-        Line 962-2813 (1850)
-    Need proofreading: 19.71% - 1 block
-        Line 1-957 (955)
-* book/ch-branching-and-merging.xml - 123803 bytes, 2698 lines
-    Untranslated: 5.06% - 1 block
-        Line 4861-4987 (125)
-    Need proofreading: 10.22% - 1 block
-        Line 4368-4851 (482)
-* book/ch-repository-admin.xml - 136576 bytes, 3011 lines
-    Untranslated: 2.84% - 9 blocks
-        Line 1983-1993 (9)
-        Line 2489-2502 (12)
-        Line 2838-2849 (10)
-        Line 2959-2969 (9)
-        Line 3090-3109 (18)
-        Line 4151-4159 (7)
-        Line 4376-4388 (11)
-        Line 4455-4484 (28)
-        Line 5532-5560 (27)
-* book/ch-server-configuration.xml - 109701 bytes, 2510 lines
-    Untranslated: 1.45% - 4 blocks
-        Line 562-582 (19)
-        Line 1541-1554 (12)
-        Line 3025-3040 (14)
-        Line 3145-3154 (8)
-    Need proofreading: 83.82% - 1 block
-        Line 784-4759 (3974)
-* book/ch-customizing-svn.xml - 52698 bytes, 1137 lines
-    Untranslated: 35.90% - 2 blocks
-        Line 270-275 (4)
-        Line 1251-1660 (408)
-    Need proofreading: 63.74% - 1 block
-        Line 5-1241 (1235)
-* book/ch-developer-info.xml - 68215 bytes, 1429 lines
-    Untranslated: 100.00% - 1 block
-        Line 1-1429 (1427)
-* book/ch-reference.xml - 204379 bytes, 6484 lines
-    Untranslated: 100.00% - 1 block
-        Line 1-6484 (6482)
-* book/app-quickstart.xml - 12293 bytes, 290 lines
+* book/ch-fundamental-concepts.xml
+    Untranslated: 0.92% - 21 lines in 2 blocks
+* book/ch-basic-usage.xml
+    Untranslated: 1.34% - 65 lines in 6 blocks
+* book/ch-advanced-topics.xml
+    Untranslated: 80.92% - 1874 lines in 3 blocks
+    Need proofreading: 19.71% - 481 lines in 1 block
+* book/ch-branching-and-merging.xml
+    Untranslated: 5.06% - 125 lines in 1 block
+    Need proofreading: 10.22% - 242 lines in 1 block
+* book/ch-repository-admin.xml
+    Untranslated: 2.84% - 131 lines in 9 blocks
+* book/ch-server-configuration.xml
+    Untranslated: 1.45% - 53 lines in 4 blocks
+    Need proofreading: 83.82% - 2070 lines in 1 block
+* book/ch-customizing-svn.xml
+    Untranslated: 35.90% - 412 lines in 2 blocks
+    Need proofreading: 63.74% - 706 lines in 1 block
+* book/ch-developer-info.xml
+    Untranslated: 100.00% - 1427 lines in 1 block
+* book/ch-reference.xml
+    Untranslated: 100.00% - 6482 lines in 1 block
+* book/app-quickstart.xml
     Translation complete
-* book/app-svn-for-cvs-users.xml - 26330 bytes, 594 lines
+* book/app-svn-for-cvs-users.xml
     Translation complete
-    Need proofreading: 100.00% - 1 block
-        Line 1-1059 (1057)
-* book/app-webdav.xml - 37627 bytes, 830 lines
-    Untranslated: 100.00% - 1 block
-        Line 1-830 (828)
-* book/app-third-party-tools.xml - 737 bytes, 22 lines
-    Untranslated: 100.00% - 1 block
-        Line 1-22 (20)
-* book/copyright.xml - 14776 bytes, 312 lines
-    Untranslated: 100.00% - 1 block
-        Line 1-312 (310)
+    Need proofreading: 100.00% - 592 lines in 1 block
+* book/app-webdav.xml
+    Untranslated: 100.00% - 828 lines in 1 block
+* book/app-third-party-tools.xml
+    Untranslated: 100.00% - 20 lines in 1 block
+* book/copyright.xml
+    Untranslated: 100.00% - 310 lines in 1 block
 
 Summa summarum: 59.06% translated, 17.06% need proofreading

Modified: trunk/src/nb/bin/genstat
==============================================================================
--- trunk/src/nb/bin/genstat	(original)
+++ trunk/src/nb/bin/genstat	Wed Apr 11 10:36:35 2007
@@ -25,7 +25,9 @@
     'directory' => "",
     'full' => 0,
     'help' => 0,
+    'lines' => 0,
     'precision' => $STD_PRECISION,
+    'size' => 0,
     'verbose' => 0,
     'version' => 0,
     # }}}
@@ -45,7 +47,9 @@
     "directory|d=s" => \$Opt{'directory'},
     "full|f" => \$Opt{'full'},
     "help|h" => \$Opt{'help'},
+    "lines|l" => \$Opt{'lines'},
     "precision|p=i" => \$Opt{'precision'},
+    "size|s" => \$Opt{'size'},
     "verbose|v+" => \$Opt{'verbose'},
     "version" => \$Opt{'version'},
     # }}}
@@ -131,7 +135,8 @@
         my $total_lines = count_lines(strip_english($Data));
         my $est_size = length(strip_english($Data));
         $All{'total'} += $est_size;
-        printf("* %s - %u byte%s, %u line%s\n",
+        printf($Opt{'size'} ? "* %s - %u byte%s, %u line%s\n"
+                            : "* %s\n",
             $File,
             $est_size,
             $est_size == 1 ? "" : "s",
@@ -154,15 +159,20 @@
     my $perc_untrans = block("percent", strip_english($Data), $Marker);
     D("perc_untrans = '$perc_untrans'");
     my $block_count = block("count", strip_english($Data), $Marker);
+    my $block_lines = block("lines", strip_english($Data), $Marker);
     my $block_size = block("size", strip_english($Data), $Marker);
     $All{$Marker} += $block_size;
     if ($perc_untrans != 0) {
-        $Retval .= sprintf("    $Title: %.$Opt{'precision'}f%% - %u block%s\n",
+        $Retval .= sprintf("    $Title: %.$Opt{'precision'}f%% - %u line%s in %u block%s\n",
             $perc_untrans,
+            $block_lines,
+            $block_lines == 1 ? "" : "s",
             $block_count,
             $block_count == 1 ? "" : "s"
         );
-        $Retval .= line_numbers($Data, $Marker);
+        if ($Opt{'lines'}) {
+            $Retval .= line_numbers($Data, $Marker);
+        }
     } else {
         $Retval .= ("    Translation complete\n") if ($Marker eq "TR");
     }
@@ -235,6 +245,25 @@
     } elsif ($What eq "count") {
         # Return number of blocks
         $Retval = ($Txt =~ s/<!-- \@$Marker {{ .*? \@$Marker }} -->//gs);
+    } elsif ($What eq "lines") {
+        # Return number of lines in all blocks with a specific marker
+        $Retval = 0;
+        while ($Txt =~
+            /^
+                (.*?)
+                (<!--\s\@$Marker\s{{\s-->)
+                (\n?)
+                (.*?)
+                (\n?)
+                (<!--\s\@$Marker\s}}\s-->)
+                (.*)
+            $/sx
+        ) {
+            my ($lf1, $Content, $lf2, $Rest) = ($3, $4, $5, $7);
+            $Retval += count_lines("$Content$lf2");
+            $Txt = $Rest;
+        }
+        ($Retval < 1) && ($Retval = 1);
     } elsif ($What eq "size") {
         # Return number of bytes the blocks occupy
         $Txt =~ s/<!-- \@$Marker {{ .*? \@$Marker }} -->//gs;
@@ -300,8 +329,12 @@
     TRANSLATION-STATUS file.
   -h, --help
     Show this help.
+  -l, --lines
+    Include line number ranges for blocks.
   -p, --precision x
     Use x decimal places in percent calculations. Default: $STD_PRECISION.
+  -s, --size
+    Include estimated size and number of lines per file.
   -v, --verbose
     Increase level of verbosity. Can be repeated.
   --version




More information about the svnbook-dev mailing list