Fossil Wrapper

Check-in [fe3d253157]
Login

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

Overview
Comment:tentative bug fix. needs improvements.
Timelines: family | ancestors | descendants | both | dresden
Files: files | file ages | folders
SHA1: fe3d253157797b9a747634f5df0fc21d3749be14
User & Date: j 2013-01-16 15:50:14
Context
2013-01-16
15:57
remove spurious `puts'. check-in: db8044a913 user: j tags: dresden
15:50
tentative bug fix. needs improvements. check-in: fe3d253157 user: j tags: dresden
14:17
bug fix and one more alias. check-in: fbb73aca09 user: j tags: dresden
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to fsl.

406
407
408
409
410
411
412

413
414
415
416
417
418
419
...
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485













486
487
488
489
490
491
492
493
494
495
496

497
498
499
500
501
502
503
...
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
# --------------------------------------------------------

   #these parameters should be user settable:
   set maxlen 78
   set indent {........ }
   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: .*\)}
................................................................................
         # through as is.
         lappend out $record\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} {
................................................................................
                break
            }
        }
    }

    if {[interactive? $command] == false} {
       if {$command == "timeline" && [llength $lines] > 1} { 
          set revnums [computeRevnums]
          set lines [unwrapTimeline $lines]
          set lines [reformTimeline $lines $revnums]
       } elseif {$command == "finfo" && [llength $lines] > 1} { 
          # let's see whether `-p' is there:
          set catmode false
          foreach word $params {
             switch -regexp $word {







>







 







|







|
>
>
>
>
>
>
>
>
>
>
>
>
>
|










>







 







|







406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
...
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
...
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
# --------------------------------------------------------

   #these parameters should be user settable:
   set maxlen 78
   set indent {........ }
   set indent {         }

   set isAppended 0
   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: .*\)}
................................................................................
         # through as is.
         lappend out $record\n
      }
   }
   return $out
}

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 call which prevents simple
   # construction of the call). anyway, the purpose is to make
   # revnum computation work for the case where `-R' is used in the call:
   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 $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}]
      }
   } 
   puts $revnums

   return $revnums
}

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

proc fossil {args} {
................................................................................
                break
            }
        }
    }

    if {[interactive? $command] == false} {
       if {$command == "timeline" && [llength $lines] > 1} { 
          set revnums [computeRevnums $params]
          set lines [unwrapTimeline $lines]
          set lines [reformTimeline $lines $revnums]
       } elseif {$command == "finfo" && [llength $lines] > 1} { 
          # let's see whether `-p' is there:
          set catmode false
          foreach word $params {
             switch -regexp $word {