Fossil Wrapper

Check-in [d9327358eb]
Login

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

Overview
Comment:simplied `computeRevnums'.
Timelines: family | ancestors | descendants | both | dresden
Files: files | file ages | folders
SHA1: d9327358eb8675c8a4357f7ea644814b9b21cc85
User & Date: j 2013-07-28 18:20:14
Context
2013-07-28
18:34
the `revnums' dictionary no longer uses reverse revision numbers as keys. check-in: 796166346a user: j tags: dresden
18:20
simplied `computeRevnums'. check-in: d9327358eb user: j tags: dresden
16:09
fixed typo. minor cosmetics. check-in: 8958476da0 user: j tags: dresden
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to fsl.

423
424
425
426
427
428
429
430

431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448

449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
}

proc computeRevnums {params} {
#-----------------------------------------------------------------------
# generate a dictionary of SHA1 keys vs. "reverse" revision numbers 
# (last checkin = 1)
#-----------------------------------------------------------------------
   set huge 1000000        ;# should not be reached by most projects ...

   set rgxtime {^\d\d:\d\d:\d\d}
   set rgxrev {\[([a-f\d]{10})([^\]]*)\]}

   # very preliminary (need to learn a bit more Tcl, notably regarding 
   # how `exec'  is parsing its input: all variables seem to be
   # inserted as quoted strings in the `exec' call which prevents simple
   # construction of this call). anyway, the purpose is to make
   # revnum computation work for the case where `-R' is specified on the
   # command line:
   #
   set rflag {}
   regsub {^timeline}  $params {} repo
   regsub { \-t [^ ]*}   $repo {} repo
   regsub { \-n [^ ]*}   $repo {} repo
   regsub { \-showfiles} $repo {} repo
   regsub { \-R }        $repo {} repo
   if {[string length $repo] > 0} { set rflag {-R} }
   

   catch {exec fossil timeline -n $huge before now $rflag $repo} timeline
   set lines [split $timeline \n]

   set revcnt 0
   foreach line $lines {
      if {[regexp $rgxtime $line]} {
         incr revcnt
         regexp $rgxrev $line rev
         dict set revnums $rev [expr {$revcnt}]
      }
   } 

   return $revnums
}

proc preparse argv {
# -------------------------------------------------------------------
# purpose: preprocessing of provided argument string by looking
# for `fsl' specific option/value arguments, which are eliminated







|
>

|
<
|
<
<
<
<
<
<
|
<
<
<
<
<
<
|
>
|


<







<







423
424
425
426
427
428
429
430
431
432
433

434






435






436
437
438
439
440

441
442
443
444
445
446
447

448
449
450
451
452
453
454
}

proc computeRevnums {params} {
#-----------------------------------------------------------------------
# generate a dictionary of SHA1 keys vs. "reverse" revision numbers 
# (last checkin = 1)
#-----------------------------------------------------------------------
   set huge    1000000        ;# should not be reached by most projects ...
   set revcnt  0
   set rgxtime {^\d\d:\d\d:\d\d}
   set rgxrev  {\[([a-f\d]{10})([^\]]*)\]}

   set rgxrepo {\-R[[:blank:]]+.+} 






   set repo    ""







   regexp $rgxrepo $params repo
   catch {exec fossil timeline -n $huge {*}$repo} timeline
   set lines [split $timeline \n]


   foreach line $lines {
      if {[regexp $rgxtime $line]} {
         incr revcnt
         regexp $rgxrev $line rev
         dict set revnums $rev [expr {$revcnt}]
      }
   } 

   return $revnums
}

proc preparse argv {
# -------------------------------------------------------------------
# purpose: preprocessing of provided argument string by looking
# for `fsl' specific option/value arguments, which are eliminated