Fossil Wrapper

Check-in [23d147961a]
Login

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

Overview
Comment:a hack to make grep work for non-standard hash-digits setting.
Timelines: family | ancestors | dresden
Files: files | file ages | folders
SHA1: 23d147961af336afd2739617f39853ea4b85e0d6
User & Date: j 2019-11-14 22:28:07
Context
2019-11-14
22:28
a hack to make grep work for non-standard hash-digits setting. Leaf check-in: 23d147961a user: j tags: dresden
2019-11-13
13:17
more flexible pattern for localizing the sha1/3 hashes (allowing for adjusting the no. of displayed hash digits via `fossil set hash-digits'). empirically, `fossil' displays at least 6 digits irrespective of a possibly smaller hash-digits setting. hence the {6,} or {2,} repetitions in the assorted patterns. check-in: dee40a390a user: j tags: dresden
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to fsl.

572
573
574
575
576
577
578





579
580
581
582
583
584
585
   foreach line $finfo {
      regexp "$rgxdate $rgxhash" $line _ cihash
      regexp ", artifact: $rgxhash, branch: .*\\)" $line _ fhash
      # an artifact 'fhash' can be part of multiple checkins. so we
      # have to collect all of them via `dict lappend'
      dict lappend cihashes $fhash \[$cihash\]
   }





   set revnums [computeRevnums {}]
   set f1 [last $grepflags]
   set f2 [first $grepflags]
   if {$f1 + $f2 > 0} {
      set buf $lines
      set lines {}
      if {$f1} { lappend lines [first $buf] } 







>
>
>
>
>







572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
   foreach line $finfo {
      regexp "$rgxdate $rgxhash" $line _ cihash
      regexp ", artifact: $rgxhash, branch: .*\\)" $line _ fhash
      # an artifact 'fhash' can be part of multiple checkins. so we
      # have to collect all of them via `dict lappend'
      dict lappend cihashes $fhash \[$cihash\]
   }
   # a hack to account for fossil grep not honouring hash-digits setting, start
   # presuming that hash-digits <= 10 (as used by grep output)
   set hashlen [string length [lindex $cihashes 0]]
   # a hack to account for fossil grep not honouring hash-digits setting, end

   set revnums [computeRevnums {}]
   set f1 [last $grepflags]
   set f2 [first $grepflags]
   if {$f1 + $f2 > 0} {
      set buf $lines
      set lines {}
      if {$f1} { lappend lines [first $buf] } 
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
      # against the real line content (so that anchoring of the
      # pattern works and spurious coloring of hash or line number
      # is prevented).
      set field  [split $line :]
      set fhash  [string trimright [first $field]]
      set lino   [lindex $field 1]
      set line   [join [lrange $field 2 end]]
      set cihash [dict get $cihashes $fhash]
      set revnum {}
      foreach hash $cihash {
         append revnum [dict get $revnums $hash] " "
      }
      set revnum [join $revnum ,]
      regsub -all "$greppat" $line [coloured redbold &] line
      # for now, we just preprend the chronological revision numbers







|







599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
      # against the real line content (so that anchoring of the
      # pattern works and spurious coloring of hash or line number
      # is prevented).
      set field  [split $line :]
      set fhash  [string trimright [first $field]]
      set lino   [lindex $field 1]
      set line   [join [lrange $field 2 end]]
      set cihash [dict get $cihashes [string range $fhash 0 $hashlen-1]]
      set revnum {}
      foreach hash $cihash {
         append revnum [dict get $revnums $hash] " "
      }
      set revnum [join $revnum ,]
      regsub -all "$greppat" $line [coloured redbold &] line
      # for now, we just preprend the chronological revision numbers