Fossil Wrapper

Check-in [614b48ebe9]
Login

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

Overview
Comment:postpone revision number computation until it is really needed.
Timelines: family | ancestors | descendants | both | dresden
Files: files | file ages | folders
SHA1: 614b48ebe9358046e3911e087a6d7708d040944b
User & Date: j 2013-07-27 22:06:49
Context
2013-07-28
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
19:56
added some comments as a personal memo. check-in: c0a6e8052f user: j tags: dresden
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to fsl.

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
   # further `diff' arguments.
   # This call is mapped to
   #
   # fsl (g)di ... -r sha1_n (--to sha1_m) ...
   #
   # where `sha1_n, sha1_m' are the sha1 hashes of the respective checkins.
   # ------------------------------------------------------------------------
   set hash2num [computeRevnums {}]
   set dim [dict size $hash2num]

   # exchange keys and values in the above dictonary. at the same time,
   # strip the square brackets around the hash value:
   dict for {key val} $hash2num {
      regexp {[a-f\d]{10}} $key sha1
      dict set num2hash [expr {$dim - $val}] $sha1
   }

   # map this interceptor command to `fossil (g)diff'. actually, we use `di'
   # instead of `diff' since only the former will trigger the `diff' filter:
   regsub {^(g?d)f} $params {\1i} params

   # extract the revison number information from `params'. contrary to
   # `fossil' it is acceptable to omit blanks between `-r' and `n:m':
   set rgx { \-r[[:blank:]]*}
   set rgxrevnum {[[:digit:]]+(:[[:digit:]]+)?}
   set rgx $rgx$rgxrevnum

   # without `-r' argument we can return already:
   if {![regexp $rgx $params revarg]} {return $params}











   # translate rev. numbers to sha1 hashes and construct the 
   # required `diff' arguments:
   regexp $rgxrevnum $revarg numbers
   set revs [split $numbers :]
   set to {}
   set cnt 0







<
<
<
<
<
<
<
<
<
<












>
>
>
>
>
>
>
>
>
>







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
   # further `diff' arguments.
   # This call is mapped to
   #
   # fsl (g)di ... -r sha1_n (--to sha1_m) ...
   #
   # where `sha1_n, sha1_m' are the sha1 hashes of the respective checkins.
   # ------------------------------------------------------------------------










   # map this interceptor command to `fossil (g)diff'. actually, we use `di'
   # instead of `diff' since only the former will trigger the `diff' filter:
   regsub {^(g?d)f} $params {\1i} params

   # extract the revison number information from `params'. contrary to
   # `fossil' it is acceptable to omit blanks between `-r' and `n:m':
   set rgx { \-r[[:blank:]]*}
   set rgxrevnum {[[:digit:]]+(:[[:digit:]]+)?}
   set rgx $rgx$rgxrevnum

   # without `-r' argument we can return already:
   if {![regexp $rgx $params revarg]} {return $params}

   set hash2num [computeRevnums {}]
   set dim [dict size $hash2num]

   # exchange keys and values in the above dictonary. at the same time,
   # strip the square brackets around the hash value:
   dict for {key val} $hash2num {
      regexp {[a-f\d]{10}} $key sha1
      dict set num2hash [expr {$dim - $val}] $sha1
   }

   # translate rev. numbers to sha1 hashes and construct the 
   # required `diff' arguments:
   regexp $rgxrevnum $revarg numbers
   set revs [split $numbers :]
   set to {}
   set cnt 0