Collection of themes/skins for the Fossil SCM. Public write access, just make an account.

⌈⌋ branch:  Fossil Skins Extra


Check-in [6d24f6c61f]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Use HEX() in query, and hex2bin() in PHP for safer CSV export and binary extraction. Add .erb file type alias.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:6d24f6c61f8e1fb0c144b1e33d573e7543749bcc
User & Date: mario 2015-02-24 20:45:12
Context
2015-04-30
06:17
Repurpose `ignore-glob` to also exclude file type from statistics. check-in: 6a899c4640 user: mario tags: trunk
2015-02-24
20:45
Use HEX() in query, and hex2bin() in PHP for safer CSV export and binary extraction. Add .erb file type alias. check-in: 6d24f6c61f user: mario tags: trunk
2015-02-12
09:51
Fix config length field (must include card prefix size). check-in: 892c5f4a68 user: mario tags: trunk
Changes

Changes to features/fossil-stats-table.php.


1
2
3
4
5
6
7
..
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
..
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
...
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
...
118
119
120
121
122
123
124

125
126
127
128
129
130
131
...
224
225
226
227
228
229
230

231
232
233
234
235
236
237

<?php
/**
 * type: cli
 * description: Create/update `fx_stats` table in fossil repositories
 * version: 0.9.1
 * depends: fossil:json, fossil:th1-setup
 *
................................................................................
 *   stores project-info, project-description
 *   in associative "name": { ... }, list.
 *   Together with `tickets` subarray.
 *
 */


// Configure repository locations
$repo = "/www/fossil.d/*.fossil";
#$repo = "/www/fossil.d/freshcode.fossil";

// Repository urls
define("PUBLIC_URL", "http://fossil.include-once.org/%s/");

// Populate `fx_stats` source code language percentages
define("FX_STATS", 1);

................................................................................





// Loop over *.fossil files
$json_project_list = array();
foreach (glob($repo) as $repo) {

   $fn = basename($repo, ".fossil");
   print "<li>$fn\n";

   if (FX_STATS) {
       mk_table($repo, $fn);
   }
................................................................................

   #-- setup table
   $db->query("DROP TABLE IF EXISTS fx_search"); // obsolete


   #-- loop through files
   $sql = escapeshellarg("
      SELECT 'file' AS type,   name AS name,    uuid,    CONTENT(uuid) AS content
         FROM (SELECT  filename.name, bf.uuid, filename.fnid 
               FROM filename  JOIN mlink ON mlink.fnid=filename.fnid JOIN blob bf ON bf.rid=mlink.fid
                    JOIN event ON event.objid=mlink.mid
               WHERE (mlink.fnid NOT IN (SELECT fnid FROM mlink WHERE fid=0))
               GROUP BY filename.name
               ORDER BY event.mtime DESC
              )
................................................................................
   // Just retrieve as CSV list from fossil directly, instead of using PDO handle and `fossil artifact` on each UUID
   $pipe = popen("fossil sqlite -R $R \".mode csv\" $sql", "rb");
   while ($row = fgetcsv($pipe, 0, ",", '"', '"')) {

      #-- prepare entry attributes
      if (count($row) != 4) { continue; }
      list($type, $name, $uuid, $content) = $row;

      echo "→ ", $name, " ", strlen($content), "\n";

      #-- statistics
      if (FX_STATS and $type == "file") {
          if ($lang = language_type($name, $content) or FX_STATS_BIN and $lang = "bin") {

              // add
................................................................................
    
    // aliases
    $map = array(
        "c++" => "cpp",     "cxx" => "cpp",      "h++" => "cpp",     "hxx" => "cpp",     "hpp" => "cpp",     "hh" => "cpp",
        "cc" => "c",        "h" => "c",
        "tclsh" => "tcl",   "wish" => "tcl",     "th1" => "tcl",
        "python" => "py",   "python3" => "py",

        "bash" => "sh",     "dash" => "sh",      "csh" => "sh",     "ksh" => "sh",
        "j" => "java",      "jsp" => "java",
        "perl" => "pl",     "pm" => "pl",
        "svg" => "xml",
        "htm" => "html",    "shtml" => "html",   "xhtml" => "html",
        "phtml" => "php",   "php4" => "php",     "php5" => "php",   "inc" => "php",
        "txt" => "text",    "asc" => "text",     "pot" => "text",
>







 







|
|
|







 







|







 







|







 







>







 







>







1
2
3
4
5
6
7
8
..
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
..
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
...
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
...
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
...
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
#!/usr/bin/php -qC
<?php
/**
 * type: cli
 * description: Create/update `fx_stats` table in fossil repositories
 * version: 0.9.1
 * depends: fossil:json, fossil:th1-setup
 *
................................................................................
 *   stores project-info, project-description
 *   in associative "name": { ... }, list.
 *   Together with `tickets` subarray.
 *
 */


// Configure repository locations (unless cmdline argument given)
$repos = array_slice($_SERVER["argv"], 1) or
$repos = glob("/www/fossil.d/*.fossil");

// Repository urls
define("PUBLIC_URL", "http://fossil.include-once.org/%s/");

// Populate `fx_stats` source code language percentages
define("FX_STATS", 1);

................................................................................





// Loop over *.fossil files
$json_project_list = array();
foreach ($repos as $repo) {

   $fn = basename($repo, ".fossil");
   print "<li>$fn\n";

   if (FX_STATS) {
       mk_table($repo, $fn);
   }
................................................................................

   #-- setup table
   $db->query("DROP TABLE IF EXISTS fx_search"); // obsolete


   #-- loop through files
   $sql = escapeshellarg("
      SELECT 'file' AS type,   name AS name,    uuid,    HEX(CONTENT(uuid)) AS content
         FROM (SELECT  filename.name, bf.uuid, filename.fnid 
               FROM filename  JOIN mlink ON mlink.fnid=filename.fnid JOIN blob bf ON bf.rid=mlink.fid
                    JOIN event ON event.objid=mlink.mid
               WHERE (mlink.fnid NOT IN (SELECT fnid FROM mlink WHERE fid=0))
               GROUP BY filename.name
               ORDER BY event.mtime DESC
              )
................................................................................
   // Just retrieve as CSV list from fossil directly, instead of using PDO handle and `fossil artifact` on each UUID
   $pipe = popen("fossil sqlite -R $R \".mode csv\" $sql", "rb");
   while ($row = fgetcsv($pipe, 0, ",", '"', '"')) {

      #-- prepare entry attributes
      if (count($row) != 4) { continue; }
      list($type, $name, $uuid, $content) = $row;
      $content = hex2bin($content);
      echo "→ ", $name, " ", strlen($content), "\n";

      #-- statistics
      if (FX_STATS and $type == "file") {
          if ($lang = language_type($name, $content) or FX_STATS_BIN and $lang = "bin") {

              // add
................................................................................
    
    // aliases
    $map = array(
        "c++" => "cpp",     "cxx" => "cpp",      "h++" => "cpp",     "hxx" => "cpp",     "hpp" => "cpp",     "hh" => "cpp",
        "cc" => "c",        "h" => "c",
        "tclsh" => "tcl",   "wish" => "tcl",     "th1" => "tcl",
        "python" => "py",   "python3" => "py",
        "erb" => "rb",
        "bash" => "sh",     "dash" => "sh",      "csh" => "sh",     "ksh" => "sh",
        "j" => "java",      "jsp" => "java",
        "perl" => "pl",     "pm" => "pl",
        "svg" => "xml",
        "htm" => "html",    "shtml" => "html",   "xhtml" => "html",
        "phtml" => "php",   "php4" => "php",     "php5" => "php",   "inc" => "php",
        "txt" => "text",    "asc" => "text",     "pot" => "text",