Fossil Wrapper

Check-in [9187755636]
Login

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

Overview
Comment:tentative changes to timeline formatting. modifcations to the `expect' block as suggested by marc.
Timelines: family | ancestors | descendants | both | dresden
Files: files | file ages | folders
SHA1: 9187755636f7578e15073dc74f14721044186d3b
User & Date: j 2013-01-25 11:42:55
Context
2013-03-24
01:16
minor fixes. check-in: e8e0d695ab user: j tags: dresden
2013-01-25
11:42
tentative changes to timeline formatting. modifcations to the `expect' block as suggested by marc. check-in: 9187755636 user: j tags: dresden
2013-01-16
16:07
bug fix to get colors right even when output is piped through `less'. check-in: a745700c2a user: j tags: dresden
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to fsl.

112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
...
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
...
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
...
552
553
554
555
556
557
558
559











560

561
562
563
564
565
566









567
568
569
570
571
572
573
       #modifications are:
       #
       # -- more specific `artifact_rx' to avoid unintentional hits
       # -- augmented `date_rx' to account for `finfo' output 
       # -- use (tags|branch)   to account for `finfo' output
       # -- add (artifact:)     to account for `finfo' output
       #
       if {[regexp "\n=== .* ===" $line]} {
           return [coloured yellow $line]
       }
       # Expressions to match:
       set artifact_rx {\[([a-f\d]{4})([a-f\d]{6}\]*)\]}
       set date_rx     {\n(\d\d:\d\d:\d\d)|^\d{4}-\d\d-\d\d}
       set current_rx  {\*CURRENT\*}
       set frkmrg_rx   {\*(FORK|MERGE|BRANCH)\*}
       # Colour the output (repeated substitutions on $line):
       set line [regsub -all $artifact_rx $line\
                     [format {[%s%s]} [coloured red {\1}] {\2}]]
       set line [regsub $date_rx    $line [coloured blue \\1]]
       set line [regsub $current_rx $line [display reversed &]]
................................................................................

   foreach record $records {
      # temporarily get rid of the record/line terminating newline:
      set record "[string trimright $record]"

      if {[regexp $rgxdate $record]} {
         # a "date" line is passed through (plus additional linefeed):
         lappend out \n$record\n
      } elseif {[regexp $rgxrev $record]} {
         # this line contains the checkin message:
         regexp $rgxtime $record time
         regexp $rgxrev $record rev
         regexp $rgxuser $record usertag
         set numrev [expr { $maxrev - [dict get $revnums $rev] }]
         lappend out "\n$time $numrev:$rev $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]
................................................................................
   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
................................................................................
        }
        expect {
            eof { break }
            \n {
            #collect everything and postpone filtering
            lappend lines $expect_out(buffer)
        }
            -re {[\?:] $} {











                # Transfer control to user following prompt:

                if {![log_user]} {
                    send_user $expect_out(buffer)
                }
                interact -o \n { send_user \r\n }
                break
            }









        }
    }

    if {[interactive? $command] == false} {
       if {$command == "timeline" && [llength $lines] > 1} { 
          set revnums [computeRevnums $params]
          set lines [unwrapTimeline $lines]







|
|



|







 







|











>
>
>
>
>







 







|







 







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

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







112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
...
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
...
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
...
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
       #modifications are:
       #
       # -- more specific `artifact_rx' to avoid unintentional hits
       # -- augmented `date_rx' to account for `finfo' output 
       # -- use (tags|branch)   to account for `finfo' output
       # -- add (artifact:)     to account for `finfo' output
       #
       if {[regexp "\n(=== .* ===)" $line]} {
           return [regsub {(\n)(=== .* ===)} $line [format {%s%s} \\1 [coloured yellow \\2]]]
       }
       # Expressions to match:
       set artifact_rx {\[([a-f\d]{4})([a-f\d]{6}\]*)\]}
       set date_rx     {(\d\d:\d\d:\d\d)|^\d{4}-\d\d-\d\d}
       set current_rx  {\*CURRENT\*}
       set frkmrg_rx   {\*(FORK|MERGE|BRANCH)\*}
       # Colour the output (repeated substitutions on $line):
       set line [regsub -all $artifact_rx $line\
                     [format {[%s%s]} [coloured red {\1}] {\2}]]
       set line [regsub $date_rx    $line [coloured blue \\1]]
       set line [regsub $current_rx $line [display reversed &]]
................................................................................

   foreach record $records {
      # temporarily get rid of the record/line terminating newline:
      set record "[string trimright $record]"

      if {[regexp $rgxdate $record]} {
         # a "date" line is passed through (plus additional linefeed):
         lappend out \n$record
      } elseif {[regexp $rgxrev $record]} {
         # this line contains the checkin message:
         regexp $rgxtime $record time
         regexp $rgxrev $record rev
         regexp $rgxuser $record usertag
         set numrev [expr { $maxrev - [dict get $revnums $rev] }]
         lappend out "\n$time $numrev:$rev $usertag\n"

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

         ###### patch ######
         lappend out $record\n
         continue    ;###### for now we skip the line wrapping....
         ###### patch ######

         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]
................................................................................
   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
................................................................................
        }
        expect {
            eof { break }
            \n {
            #collect everything and postpone filtering
            lappend lines $expect_out(buffer)
        }
            -notransfer -re {[?:] $} {
                # [*] Under certain conditions, an incomplete output
                # fragment will match this pattern; check whether
                # there's a pending newline character:
                set timeout 0
                #after 1
                expect -notransfer \n {
                    # Let the standard {\n} pattern match this line:
                    unset timeout
                    continue
                }
                unset timeout
                # Transfer control to user following prompt:
                expect -re {[?:] $} {
                    if {![log_user]} {
                        send_user $expect_out(buffer)
                    }
                    interact -o \n { send_user \r\n }
                    break
                }
            }
            #-re {[\?:] $} {
                # Transfer control to user following prompt:
                #if {![log_user]} {
                    #send_user $expect_out(buffer)
                #}
                #interact -o \n { send_user \r\n }
                #break
            #}
        }
    }

    if {[interactive? $command] == false} {
       if {$command == "timeline" && [llength $lines] > 1} { 
          set revnums [computeRevnums $params]
          set lines [unwrapTimeline $lines]