Fossil Wrapper

Check-in [abc0e49ac5]
Login

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

Overview
Comment:tentative addition of chronological revision numbers to timeline output.
Timelines: family | ancestors | descendants | both | dresden
Files: files | file ages | folders
SHA1: abc0e49ac51c6597058eab1dd7b831dd6950788e
User & Date: j 2013-01-10 18:07:02
Context
2013-01-10
20:51
bug fix (skipping of single word remaining on last line of reformatted checkin message). check-in: b84e704411 user: j tags: dresden
18:07
tentative addition of chronological revision numbers to timeline output. check-in: abc0e49ac5 user: j tags: dresden
2013-01-06
18:42
restore usual meaning of "line" in `timeline' processing (avoid embedded newlines). check-in: d183a47466 user: j tags: dresden
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to fsl.

366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
...
383
384
385
386
387
388
389

390
391
392
393
394
395
396


397
398
399
400
401
402
403
...
404
405
406
407
408
409
410


411

412
413
414
415
416
417
418
...
436
437
438
439
440
441
442






























443
444
445
446
447
448
449
...
491
492
493
494
495
496
497

498
499
500
501
502
503
504
505
506
      regsub -all {([[:alnum:]])- ([[:alnum:]])} $record \\1-\\2 record

      lappend out "$record"
   }
   return $out
}

proc reformTimeline records {
# --------------------------------------------------------
# expected input: list of timeline entries as provided by
# `unwrapTimeline', i.e. either "date lines" or "commit"
# lines containing the whole commit including the commit
# message.
#
# output: a list of newline terminated lines where the user/tags
................................................................................
# indent string `indent' and a line length `maxlen'.
# --------------------------------------------------------

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


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



   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


      lappend out "$time $rvsn $usertag\n"


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

      set message [string trim $record]
      set words [split $message]
................................................................................
         }
      }
      if {$isAppended == 0} {lappend out $line\n}
      lappend out \n
   }
   return $out
}































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

proc fossil {args} {
    #if `true' generate some noise:
    set debug false

................................................................................
                break
            }
        }
    }

    if {[interactive? $command] == false} {
       if {$command == "timeline"} { 

          set lines [unwrapTimeline $lines]
          set lines [reformTimeline $lines]
       }
       foreach line $lines {
          if {$debug == true} {
             puts -nonewline "IN: $line"
             puts -nonewline "OU: "
          }
          filter_with $chain "$line"







|







 







>







>
>







 







>
>
|
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>

|







366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
...
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
...
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
...
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
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
...
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
      regsub -all {([[:alnum:]])- ([[:alnum:]])} $record \\1-\\2 record

      lappend out "$record"
   }
   return $out
}

proc reformTimeline {records revnums} {
# --------------------------------------------------------
# expected input: list of timeline entries as provided by
# `unwrapTimeline', i.e. either "date lines" or "commit"
# lines containing the whole commit including the commit
# message.
#
# output: a list of newline terminated lines where the user/tags
................................................................................
# indent string `indent' and a line length `maxlen'.
# --------------------------------------------------------

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

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

   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"
      #lappend out "$time $rvsn $usertag {$revnum}\n"
      #lappend out "chkin: $revnum\n$time $rvsn $usertag\n"

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

      set message [string trim $record]
      set words [split $message]
................................................................................
         }
      }
      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})([^\]]*)\]}
   set revcnt -1

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

   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:
    set debug false

................................................................................
                break
            }
        }
    }

    if {[interactive? $command] == false} {
       if {$command == "timeline"} { 
          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: "
          }
          filter_with $chain "$line"