Fossil

Check-in [52860aa6]
Login

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

Overview
Comment:Add the /uvlist webpage.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | unversioned-files
Files: files | file ages | folders
SHA1:52860aa6ab27dc1a7595e8033006fda8e288dfed
User & Date: drh 2016-08-17 09:28:28
Context
2016-08-17
09:57
Do not show a blank table on the /uvlist page if the server contains no unversioned files. Instead show a message explaining that no unversioned files are present. check-in: 49007ece user: drh tags: unversioned-files
09:28
Add the /uvlist webpage. check-in: 52860aa6 user: drh tags: unversioned-files
2016-08-16
20:49
Merge trunk changes. check-in: 78ccf4bc user: drh tags: unversioned-files
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/unversioned.c.

341
342
343
344
345
346
347



































































    }
    db_unset("uv-hash", 0);
    db_end_transaction(0);
  }else{
    usage("add|cat|export|ls|revert|rm|sync|touch");
  }
}










































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
    }
    db_unset("uv-hash", 0);
    db_end_transaction(0);
  }else{
    usage("add|cat|export|ls|revert|rm|sync|touch");
  }
}

/*
** WEBPAGE: uvlist
**
** Display a list of all unversioned files in the repository.
*/
void uvstat_page(void){
  Stmt q;
  sqlite3_int64 iNow;
  sqlite3_int64 iTotalSz = 0;
  int cnt = 0;
  char zSzName[100];

  login_check_credentials();
  if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
  style_header("Unversioned Files");
  if( !db_table_exists("repository","unversioned") ){
    @ No unversioned files on this server
    style_footer();
    return;
  }
  db_prepare(&q,
     "SELECT"
     "   name,"
     "   mtime,"
     "   hash IS NULL,"
     "   sz"
     " FROM unversioned"
   );
   iNow = db_int64(0, "SELECT strftime('%%s','now');");
   @ <div class="uvlist">
   @ <table cellpadding="2" cellspacing="0" border="1" id="uvtab">
   @ <thead><tr>
   @   <th> Name
   @   <th> Age
   @   <th> Size
   @ </tr></thead>
   @ <tbody>
   while( db_step(&q)==SQLITE_ROW ){
     const char *zName = db_column_text(&q, 0);
     sqlite3_int64 mtime = db_column_int(&q, 1);
     int isDeleted = db_column_int(&q, 2);
     int fullSize = db_column_int(&q, 3);
     char *zAge = human_readable_age((iNow - mtime)/86400.0);
     if( isDeleted ){
       sqlite3_snprintf(sizeof(zSzName), zSzName, "<i>Deleted</i>");
       fullSize = 0;
     }else{
       approxSizeName(sizeof(zSzName), zSzName, fullSize);
       iTotalSz += fullSize;
       cnt++;
     }
     @ <tr>
     @ <td> <a href='%R/uv/%T(zName)'>%h(zName)</a> </td>
     @ <td data-sortkey='%016llx(-mtime)'> %s(zAge) </td>
     @ <td data-sortkey='%08x(fullSize)'> %s(zSzName) </td>
     @ </tr>
     fossil_free(zAge);
   }
   approxSizeName(sizeof(zSzName), zSzName, iTotalSz);
   @ </tbody>
   @ <tfoot><tr><td><b>Total over %d(cnt) files</b><td><td>%s(zSzName)</tfoot>
   @ </table></div>
   db_finalize(&q);
   output_table_sorting_javascript("uvtab","tKk",1);
   style_footer();
}