Fossil Wrapper

Check-in [de9dfa49ae]
Login

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

Overview
Comment:added new proc `reformTimeline' for reformatting the `timeline' output.
Timelines: family | ancestors | descendants | both | dresden
Files: files | file ages | folders
SHA1: de9dfa49ae08f841304e6c57bb4cc0a51dc14798
User & Date: j 2013-01-06 17:26:16
Context
2013-01-06
18:42
restore usual meaning of "line" in `timeline' processing (avoid embedded newlines). check-in: d183a47466 user: j tags: dresden
17:26
added new proc `reformTimeline' for reformatting the `timeline' output. check-in: de9dfa49ae user: j tags: dresden
2013-01-05
20:21
fixed comment sytnax bug. check-in: 6c76c5ec8d user: j tags: dresden
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to fsl.

365
366
367
368
369
370
371




































































372
373
374
375
376
377
378
      # actually, in the commit message itself):
      regsub -all {([[:alnum:]])- ([[:alnum:]])} $record \\1-\\2 record

      lappend out "$record"
   }
   return $out
}





































































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

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








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







365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
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
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
      # actually, in the commit message itself):
      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: reformatted `timeline' where user/tags information
# is put directly after the time and SHA1 hash on the same
# line and the commit message is put on the following line(s)
# using an 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]
      set msg $indent[lindex $words 0]
      set len [string length $msg]

      set words [lreplace $words 0 0]
      foreach word $words {
         #if {[string length $word] == 0} {continue}
         set len [expr {$len + 1 + [string length $word]}]
         if {$len <= $maxlen} {
            set msg "$msg $word"
         } else {
            set msg $msg\n$indent$word
            set lindent [string length $indent]
            set len [expr {$lindent + [string length $word]}] 
         }
      }
      # the commit message yields a single list element
      # (i.e. is treated by the subsequent filters as a single line):
      lappend out $msg\n\n
   }
   return $out
}

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

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

421
422
423
424
425
426
427

428
429
430
431
432
433
434
            }
        }
    }

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

       }
       foreach line $lines {
          if {$debug == true} {
             puts -nonewline "IN: $line"
             puts -nonewline "OU: "
          }
          filter_with $chain "$line"







>







489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
            }
        }
    }

    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"