Fossil Wrapper

Check-in [3ac24d1cd2]
Login

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

Overview
Comment:tidy up.
Timelines: family | ancestors | descendants | both | dresden
Files: files | file ages | folders
SHA1: 3ac24d1cd2bcf246d49157961beeca63c0d2f143
User & Date: j 2013-01-11 12:24:00
Context
2013-01-11
20:53
small fixes. check-in: 37ea358f3a user: j tags: dresden
12:24
tidy up. check-in: 3ac24d1cd2 user: j tags: dresden
2013-01-10
22:44
small fix. check-in: ced1483e1b user: j tags: dresden
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to fsl.

389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
...
405
406
407
408
409
410
411
412
413
414
415

416
417
418
419
420
421
422
423
424
425
426
...
444
445
446
447
448
449
450
451
452
453

454
455
456
457
458
459
460
461
462
463
464
465
466


467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
...
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
   set indent {         }

   set out {}
   set buf ""
   set usertag ""
   set rgxdate {^=== [0-9-]+ ===$}
   set rgxtime {^\d\d:\d\d:\d\d}
   set rgxrvsn {\[([a-f\d]{10})([^\]]*)\]}
   set rgxuser {\(user: .*\)}

   set maxrev [dict size $revnums]

   foreach record $records {
      # temporarily get rid of the record terminating newline:
      set record "[string trimright $record]"
................................................................................
      if {[regexp $rgxdate $record]} {
         # a "date" line is passed through as is (plus linefeeds)
         lappend out $record\n
         continue
      } 

      regexp $rgxtime $record time
      regexp $rgxrvsn $record rvsn
      regexp $rgxuser $record usertag
      set revnum [dict get $revnums $rvsn]
      lappend out "$time ($revnum):$rvsn $usertag\n"


      regsub $rgxuser $record "" record
      regsub $time    $record "" record
      regsub $rgxrvsn $record "" record

      set message [string trim $record]
      set words [split $message]
      set line $indent[lindex $words 0]
      set len [string length $line]

      set words [lreplace $words 0 0]
................................................................................
      }
      if {$isAppended == 0} {lappend out $line\n}
      lappend out \n
   }
   return $out
}

proc computeRevnums records {
#-----------------------------------------------------------------------
#generate a dictionary SHA1 (key) vs. chron. rev. number (value)

#-----------------------------------------------------------------------
   set huge 1000000
   set rgxtime {^\d\d:\d\d:\d\d}
   set rgxrvsn {\[([a-f\d]{10})([^\]]*)\]}

   catch {exec fossil time -n $huge } buf
   set lizzy [split $buf \n]
   set lizzy [unwrapTimeline $lizzy]

   set revcnt -1
   foreach line $lizzy {
      if {[regexp $rgxtime $line]} {
         incr revcnt


      }
   } 

   set iter -1
   foreach line $lizzy {
      if {[regexp $rgxtime $line]} {
         incr iter
         regexp $rgxrvsn $line rvsn
         dict set revnums $rvsn [expr {$revcnt - $iter}]
      }
   }
   return $revnums
}

# --( Fossil )----------------------------------------------------------

proc fossil {args} {
    #if `true' generate some noise:
................................................................................
                break
            }
        }
    }

    if {[interactive? $command] == false} {
       if {$command == "timeline" && [llength $lines] > 1} { 
          set revnums [computeRevnums $lines]
          set lines [unwrapTimeline $lines]
          set lines [reformTimeline $lines $revnums]
       }
       foreach line $lines {
          if {$debug == true} {
             puts -nonewline "IN: $line"
             puts -nonewline "OU: "







|







 







|

|
|
>



|







 







|

|
>

|

|
|
|
<
|

|
|


>
>



<
<
<
<
<
<
<
<







 







|







389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
...
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
...
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461

462
463
464
465
466
467
468
469
470
471
472








473
474
475
476
477
478
479
...
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
   set indent {         }

   set out {}
   set buf ""
   set usertag ""
   set rgxdate {^=== [0-9-]+ ===$}
   set rgxtime {^\d\d:\d\d:\d\d}
   set rgxrev {\[([a-f\d]{10})([^\]]*)\]}
   set rgxuser {\(user: .*\)}

   set maxrev [dict size $revnums]

   foreach record $records {
      # temporarily get rid of the record terminating newline:
      set record "[string trimright $record]"
................................................................................
      if {[regexp $rgxdate $record]} {
         # a "date" line is passed through as is (plus linefeeds)
         lappend out $record\n
         continue
      } 

      regexp $rgxtime $record time
      regexp $rgxrev $record rev
      regexp $rgxuser $record usertag
      set numrev [expr { $maxrev - [dict get $revnums $rev] }]
      lappend out "$time $numrev:$rev $usertag\n"
      #lappend out "$time $rev:$numrev\n$usertag\n"

      regsub $rgxuser $record "" record
      regsub $time    $record "" record
      regsub $rgxrev  $record "" record

      set message [string trim $record]
      set words [split $message]
      set line $indent[lindex $words 0]
      set len [string length $line]

      set words [lreplace $words 0 0]
................................................................................
      }
      if {$isAppended == 0} {lappend out $line\n}
      lappend out \n
   }
   return $out
}

proc computeRevnums {} {
#-----------------------------------------------------------------------
# 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})([^\]]*)\]}
   
   catch {exec fossil time -n $huge } 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
}

# --( Fossil )----------------------------------------------------------

proc fossil {args} {
    #if `true' generate some noise:
................................................................................
                break
            }
        }
    }

    if {[interactive? $command] == false} {
       if {$command == "timeline" && [llength $lines] > 1} { 
          set revnums [computeRevnums]
          set lines [unwrapTimeline $lines]
          set lines [reformTimeline $lines $revnums]
       }
       foreach line $lines {
          if {$debug == true} {
             puts -nonewline "IN: $line"
             puts -nonewline "OU: "