Fossil

Check-in [f550bdc7]
Login

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

Overview
Comment:Added a missing error code check - now properly fails if no checkout is available (e.g. when called using -R repofile).
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | usage-command
Files: files | file ages | folders
SHA1:f550bdc7b9e37889855ab202ae2af9bd3eb740d6
User & Date: stephan 2013-09-03 22:01:22
Context
2013-09-04
11:33
merged in trunk for sqlite build fixes. check-in: 11547d9f user: stephan tags: usage-command
2013-09-03
22:01
Added a missing error code check - now properly fails if no checkout is available (e.g. when called using -R repofile). check-in: f550bdc7 user: stephan tags: usage-command
21:51
Added -n|-count ### option to list the most recent (or all) history entries, ordered descending by time. check-in: b613c52b user: stephan tags: usage-command
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/main.c.

506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
...
541
542
543
544
545
546
547
548


549
550
551
552
553
554
555
    }
  }
  return zCode;
}

static void update_cmd_usage_stats(char const * zCommand){
  if(!g.localOpen || g.isHTTP) return
    /* we need a checkout and do not want to log the 'ui' bits forked
       by local ui mode.*/;
  db_multi_exec("CREATE TABLE IF NOT EXISTS "
                "cmd_usage (name TEXT,mtime FLOAT);"
                "INSERT INTO cmd_usage (name,mtime) VALUES (%Q,julianday('now'));",
                zCommand);

}

................................................................................
  int rc;
  Stmt q;
  int i = 0;
  int fClear = find_option("clear","c",0)!=0;
  char const *zLimit = find_option("n","count",1);
  int fLimit = zLimit ? atoi(zLimit) : -1;
  char const * sql;
  db_open_local(0);


  if(fLimit>=0){
      sql = "SELECT name, strftime('%%Y-%%m-%%d %%H:%%M:%%S',mtime) "
          "FROM cmd_usage ORDER BY mtime DESC";
  }else{
      sql = "SELECT name, count(*) AS n "
          "FROM cmd_usage GROUP BY name "
          "ORDER BY n DESC";







|
|







 







|
>
>







506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
...
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
    }
  }
  return zCode;
}

static void update_cmd_usage_stats(char const * zCommand){
  if(!g.localOpen || g.isHTTP) return
    /* We need an opened checkout and do not want to log the 'ui' bits
       forked by local ui mode. */;
  db_multi_exec("CREATE TABLE IF NOT EXISTS "
                "cmd_usage (name TEXT,mtime FLOAT);"
                "INSERT INTO cmd_usage (name,mtime) VALUES (%Q,julianday('now'));",
                zCommand);

}

................................................................................
  int rc;
  Stmt q;
  int i = 0;
  int fClear = find_option("clear","c",0)!=0;
  char const *zLimit = find_option("n","count",1);
  int fLimit = zLimit ? atoi(zLimit) : -1;
  char const * sql;
  if(!db_open_local(0)){
    fossil_fatal("'usage' requires a checkout.");
  }
  if(fLimit>=0){
      sql = "SELECT name, strftime('%%Y-%%m-%%d %%H:%%M:%%S',mtime) "
          "FROM cmd_usage ORDER BY mtime DESC";
  }else{
      sql = "SELECT name, count(*) AS n "
          "FROM cmd_usage GROUP BY name "
          "ORDER BY n DESC";