Fossil Wrapper

Check-in [caa682962f]
Login

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

Overview
Comment:added handling of a `--debug n' option for controlling extend of debugging output.
Timelines: family | ancestors | descendants | both | dresden
Files: files | file ages | folders
SHA1: caa682962fc669a1a534d896f3cedb6b8264c178
User & Date: j 2013-07-28 11:11:15
Context
2013-07-28
12:49
move pre-parsing of argv to separate proc. check-in: c4c35bb825 user: j tags: dresden
11:11
added handling of a `--debug n' option for controlling extend of debugging output. check-in: caa682962f user: j tags: dresden
2013-07-27
22:06
postpone revision number computation until it is really needed. check-in: 614b48ebe9 user: j tags: dresden
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to fsl.

240
241
242
243
244
245
246

247
248


249
250
251
252
253
254
255
       # alternate name in `commands_spec (e.g., a, ali, alias etc.)
       # generates a further entry (with identical value).
       dict set config::commands $command $fn
    }
}

proc intercept {params} {

    set command [first $params]
    if {[interceptor? $command]} {


        # here, the interceptor definition is retrieved from the
        # `commands' dictionary and used as the anonymous function
        # argument for `apply' (and `params' as its concrete argument). 
        set params [apply [dict get $config::commands $command] $params]
    }
    return $params
}







>


>
>







240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
       # alternate name in `commands_spec (e.g., a, ali, alias etc.)
       # generates a further entry (with identical value).
       dict set config::commands $command $fn
    }
}

proc intercept {params} {
    global dbglvl
    set command [first $params]
    if {[interceptor? $command]} {

        if {$dbglvl > 0} { puts "*** `$command' interceptor triggered" }
        # here, the interceptor definition is retrieved from the
        # `commands' dictionary and used as the anonymous function
        # argument for `apply' (and `params' as its concrete argument). 
        set params [apply [dict get $config::commands $command] $params]
    }
    return $params
}
598
599
600
601
602
603
604


605






606



607
608
609


610
611
612


613
614
615
616
617
618
619

   return $revnums
}

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

proc fossil {args} {


    #if `true' generate some noise:






    set debug false




    set candidate [first $args]; # candidate for expansion



    # Alias expansion and command interception:
    set params [intercept [expand $args]]
    ###puts "final pars: $params"


    if {[empty? $params]} {
        return 0;                # params cleared, no need to run fossil
    }
    set command [first $params]; # expanded candidate

    # Prepare filters:
    set chain [chain_for $candidate]







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



>
>


|
>
>







601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637

   return $revnums
}

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

proc fossil {args} {
    global dbglvl
    set dbglvl 0

    # check for presence of a `--debug n' option, if present, it
    # defines the debug level which controls how much additional
    # output is generated. after extraction of the debug level the
    # option and its value are eliminated from the argument string
    # since it otherwise would be interpreted as an (unknown) command
    # during further processing.

    set dbgpat {\--debug[[:blank:]]+([[:digit:]]+[ ]*)}
    regexp $dbgpat $args dum dbglvl
    regsub $dbgpat $args "" args

    set candidate [first $args]; # candidate for expansion

    if {$dbglvl > 0} { puts "*** provided argument list: $args" }

    # Alias expansion and command interception:
    set params [intercept [expand $args]]

    if {$dbglvl > 0} { puts "*** expanded argument list: $params" }

    if {[empty? $params]} {
        return 0;                # params cleared, no need to run fossil
    }
    set command [first $params]; # expanded candidate

    # Prepare filters:
    set chain [chain_for $candidate]
689
690
691
692
693
694
695



696
697
698
699
700
701
702
703
704
          }
          # if yes, don't unwrap (but it's still filtered 
          # through `fancy_timeline'. think ...)
          if {!$catmode} {
             set lines [unwrapTimeline $lines]
          }
       }



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







>
>
>

|







707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
          }
          # if yes, don't unwrap (but it's still filtered 
          # through `fancy_timeline'. think ...)
          if {!$catmode} {
             set lines [unwrapTimeline $lines]
          }
       }

       if {$dbglvl == 1} {puts "*** filter chain: $chain"}

       foreach line $lines {
          if {$dbglvl > 2} {
             puts "IN: >$line<"
             puts -nonewline "OU: >"
             filter_with $chain "$line"
             puts "<"
          } else {
             filter_with $chain "$line"
          }