Artifact b25fedd0c7631934c6eb2eab0b5933f61c4bfc4d:
File
tools/cvs2fossil/lib/c2f_prevlink.tcl
part of check-in
[59207428e2]
- Moved the functionality for splitting a changeset based on the sets of revisions for the fragments to be into a separate command, and into the changeset class, for use outside of changeset links.
by
aku on
2007-11-22 02:58:09.
0000: 23 23 20 2d 2a 2d 20 74 63 6c 20 2d 2a 2d 0a 23 ## -*- tcl -*-.#
0010: 20 23 20 23 23 20 23 23 23 20 23 23 23 23 23 20 # ## ### #####
0020: 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23 ######## #######
0030: 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23 ###### #########
0040: 23 23 23 23 23 23 23 23 23 23 23 23 0a 23 23 20 ############.##
0050: 43 6f 70 79 72 69 67 68 74 20 28 63 29 20 32 30 Copyright (c) 20
0060: 30 37 20 41 6e 64 72 65 61 73 20 4b 75 70 72 69 07 Andreas Kupri
0070: 65 73 2e 0a 23 0a 23 20 54 68 69 73 20 73 6f 66 es..#.# This sof
0080: 74 77 61 72 65 20 69 73 20 6c 69 63 65 6e 73 65 tware is license
0090: 64 20 61 73 20 64 65 73 63 72 69 62 65 64 20 69 d as described i
00a0: 6e 20 74 68 65 20 66 69 6c 65 20 4c 49 43 45 4e n the file LICEN
00b0: 53 45 2c 20 77 68 69 63 68 0a 23 20 79 6f 75 20 SE, which.# you
00c0: 73 68 6f 75 6c 64 20 68 61 76 65 20 72 65 63 65 should have rece
00d0: 69 76 65 64 20 61 73 20 70 61 72 74 20 6f 66 20 ived as part of
00e0: 74 68 69 73 20 64 69 73 74 72 69 62 75 74 69 6f this distributio
00f0: 6e 2e 0a 23 0a 23 20 54 68 69 73 20 73 6f 66 74 n..#.# This soft
0100: 77 61 72 65 20 63 6f 6e 73 69 73 74 73 20 6f 66 ware consists of
0110: 20 76 6f 6c 75 6e 74 61 72 79 20 63 6f 6e 74 72 voluntary contr
0120: 69 62 75 74 69 6f 6e 73 20 6d 61 64 65 20 62 79 ibutions made by
0130: 20 6d 61 6e 79 0a 23 20 69 6e 64 69 76 69 64 75 many.# individu
0140: 61 6c 73 2e 20 20 46 6f 72 20 65 78 61 63 74 20 als. For exact
0150: 63 6f 6e 74 72 69 62 75 74 69 6f 6e 20 68 69 73 contribution his
0160: 74 6f 72 79 2c 20 73 65 65 20 74 68 65 20 72 65 tory, see the re
0170: 76 69 73 69 6f 6e 0a 23 20 68 69 73 74 6f 72 79 vision.# history
0180: 20 61 6e 64 20 6c 6f 67 73 2c 20 61 76 61 69 6c and logs, avail
0190: 61 62 6c 65 20 61 74 20 68 74 74 70 3a 2f 2f 66 able at http://f
01a0: 6f 73 73 69 6c 2d 73 63 6d 2e 68 77 61 63 69 2e ossil-scm.hwaci.
01b0: 63 6f 6d 2f 66 6f 73 73 69 6c 0a 23 20 23 20 23 com/fossil.# # #
01c0: 23 20 23 23 23 20 23 23 23 23 23 20 23 23 23 23 # ### ##### ####
01d0: 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23 #### ###########
01e0: 23 23 20 23 23 23 23 23 23 23 23 23 23 23 23 23 ## #############
01f0: 23 23 23 23 23 23 23 23 0a 0a 23 23 20 48 65 6c ########..## Hel
0200: 70 65 72 20 63 6c 61 73 73 20 66 6f 72 20 74 68 per class for th
0210: 65 20 70 61 73 73 20 36 20 63 79 63 6c 65 20 62 e pass 6 cycle b
0220: 72 65 61 6b 65 72 2e 20 45 61 63 68 20 69 6e 73 reaker. Each ins
0230: 74 61 6e 63 65 20 72 65 66 65 72 73 20 74 6f 0a tance refers to.
0240: 23 23 20 74 68 72 65 65 20 63 68 61 6e 67 65 73 ## three changes
0250: 65 74 73 20 41 2c 20 42 2c 20 61 6e 64 20 43 2c ets A, B, and C,
0260: 20 77 69 74 68 20 41 20 61 20 70 72 65 64 65 63 with A a predec
0270: 65 73 73 6f 72 20 6f 66 20 42 2c 20 61 6e 64 20 essor of B, and
0280: 42 0a 23 23 20 70 72 65 64 65 63 65 73 73 6f 72 B.## predecessor
0290: 20 6f 66 20 43 2c 20 61 6e 64 20 74 68 65 20 77 of C, and the w
02a0: 68 6f 6c 65 20 70 61 72 74 20 6f 66 20 61 20 64 hole part of a d
02b0: 65 70 65 6e 64 65 6e 63 79 20 63 79 63 6c 65 2e ependency cycle.
02c0: 0a 0a 23 23 20 49 6e 73 74 61 6e 63 65 73 20 61 ..## Instances a
02d0: 6e 61 6c 79 73 65 20 74 68 65 20 66 69 6c 65 20 nalyse the file
02e0: 6c 65 76 65 6c 20 64 65 70 65 6e 64 65 6e 63 69 level dependenci
02f0: 65 73 20 77 68 69 63 68 20 67 61 76 65 20 72 69 es which gave ri
0300: 73 65 20 74 6f 0a 23 23 20 74 68 65 20 63 68 61 se to.## the cha
0310: 6e 67 65 73 65 74 20 64 65 70 65 6e 64 65 6e 63 ngeset dependenc
0320: 69 65 73 20 6f 66 20 41 2c 20 42 2c 20 61 6e 64 ies of A, B, and
0330: 20 43 2c 20 77 69 74 68 20 74 68 65 20 72 65 73 C, with the res
0340: 75 6c 74 73 20 75 73 65 64 20 62 79 0a 23 23 20 ults used by.##
0350: 74 68 65 20 63 79 63 6c 65 20 62 72 65 61 6b 65 the cycle breake
0360: 72 20 61 6c 67 6f 72 69 74 68 6d 20 74 6f 20 66 r algorithm to f
0370: 69 6e 64 20 61 20 67 6f 6f 64 20 6c 6f 63 61 74 ind a good locat
0380: 69 6f 6e 20 77 68 65 72 65 20 74 6f 20 61 74 0a ion where to at.
0390: 23 23 20 6c 65 61 73 74 20 77 65 61 6b 65 6e 20 ## least weaken
03a0: 61 6e 64 20 61 74 20 62 65 73 74 20 66 75 6c 6c and at best full
03b0: 79 20 62 72 65 61 6b 20 74 68 65 20 63 79 63 6c y break the cycl
03c0: 65 2e 0a 0a 23 20 23 20 23 23 20 23 23 23 20 23 e...# # ## ### #
03d0: 23 23 23 23 20 23 23 23 23 23 23 23 23 20 23 23 #### ######## ##
03e0: 23 23 23 23 23 23 23 23 23 23 23 20 23 23 23 23 ########### ####
03f0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
0400: 23 0a 23 23 20 52 65 71 75 69 72 65 6d 65 6e 74 #.## Requirement
0410: 73 0a 0a 70 61 63 6b 61 67 65 20 72 65 71 75 69 s..package requi
0420: 72 65 20 54 63 6c 20 38 2e 34 20 20 20 20 20 20 re Tcl 8.4
0430: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0440: 20 20 20 20 20 20 20 20 20 3b 20 23 20 52 65 71 ; # Req
0450: 75 69 72 65 64 20 72 75 6e 74 69 6d 65 2e 0a 70 uired runtime..p
0460: 61 63 6b 61 67 65 20 72 65 71 75 69 72 65 20 73 ackage require s
0470: 6e 69 74 20 20 20 20 20 20 20 20 20 20 20 20 20 nit
0480: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0490: 20 20 20 20 20 3b 20 23 20 4f 4f 20 73 79 73 74 ; # OO syst
04a0: 65 6d 2e 0a 70 61 63 6b 61 67 65 20 72 65 71 75 em..package requ
04b0: 69 72 65 20 76 63 3a 3a 74 6f 6f 6c 73 3a 3a 6d ire vc::tools::m
04c0: 69 73 63 20 20 20 20 20 20 20 20 20 20 20 20 20 isc
04d0: 20 20 20 20 20 20 20 20 20 20 3b 20 23 20 54 65 ; # Te
04e0: 78 74 20 66 6f 72 6d 61 74 74 69 6e 67 0a 70 61 xt formatting.pa
04f0: 63 6b 61 67 65 20 72 65 71 75 69 72 65 20 76 63 ckage require vc
0500: 3a 3a 74 6f 6f 6c 73 3a 3a 74 72 6f 75 62 6c 65 ::tools::trouble
0510: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0520: 20 20 20 20 3b 20 23 20 45 72 72 6f 72 20 72 65 ; # Error re
0530: 70 6f 72 74 69 6e 67 2e 0a 70 61 63 6b 61 67 65 porting..package
0540: 20 72 65 71 75 69 72 65 20 76 63 3a 3a 74 6f 6f require vc::too
0550: 6c 73 3a 3a 6c 6f 67 20 20 20 20 20 20 20 20 20 ls::log
0560: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b ;
0570: 20 23 20 55 73 65 72 20 66 65 65 64 62 61 63 6b # User feedback
0580: 2e 0a 70 61 63 6b 61 67 65 20 72 65 71 75 69 72 ..package requir
0590: 65 20 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d e vc::fossil::im
05a0: 70 6f 72 74 3a 3a 63 76 73 3a 3a 73 74 61 74 65 port::cvs::state
05b0: 20 20 20 20 20 20 20 20 3b 20 23 20 53 74 61 74 ; # Stat
05c0: 65 20 73 74 6f 72 61 67 65 2e 0a 70 61 63 6b 61 e storage..packa
05d0: 67 65 20 72 65 71 75 69 72 65 20 76 63 3a 3a 66 ge require vc::f
05e0: 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 ossil::import::c
05f0: 76 73 3a 3a 70 72 6f 6a 65 63 74 3a 3a 72 65 76 vs::project::rev
0600: 20 3b 20 23 20 50 72 6f 6a 65 63 74 20 6c 65 76 ; # Project lev
0610: 65 6c 20 63 68 61 6e 67 65 73 65 74 73 0a 0a 23 el changesets..#
0620: 20 23 20 23 23 20 23 23 23 20 23 23 23 23 23 20 # ## ### #####
0630: 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23 ######## #######
0640: 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23 ###### #########
0650: 23 23 23 23 23 23 23 23 23 23 23 23 0a 23 23 20 ############.##
0660: 0a 0a 73 6e 69 74 3a 3a 74 79 70 65 20 3a 3a 76 ..snit::type ::v
0670: 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 c::fossil::impor
0680: 74 3a 3a 63 76 73 3a 3a 70 72 6f 6a 65 63 74 3a t::cvs::project:
0690: 3a 72 65 76 6c 69 6e 6b 20 7b 0a 20 20 20 20 23 :revlink {. #
06a0: 20 23 20 23 23 20 23 23 23 20 23 23 23 23 23 20 # ## ### #####
06b0: 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23 ######## #######
06c0: 23 23 23 23 23 23 0a 20 20 20 20 23 23 20 50 75 ######. ## Pu
06d0: 62 6c 69 63 20 41 50 49 0a 0a 20 20 20 20 63 6f blic API.. co
06e0: 6e 73 74 72 75 63 74 6f 72 20 7b 70 72 65 76 20 nstructor {prev
06f0: 63 73 65 74 20 6e 65 78 74 7d 20 7b 0a 09 73 65 cset next} {..se
0700: 74 20 6d 79 70 72 65 76 20 24 70 72 65 76 0a 09 t myprev $prev..
0710: 73 65 74 20 6d 79 63 73 65 74 20 24 63 73 65 74 set mycset $cset
0720: 0a 09 73 65 74 20 6d 79 6e 65 78 74 20 24 6e 65 ..set mynext $ne
0730: 78 74 0a 0a 09 23 20 57 65 20 70 65 72 66 6f 72 xt...# We perfor
0740: 6d 20 74 68 65 20 62 75 6c 6b 20 6f 66 20 74 68 m the bulk of th
0750: 65 20 61 6e 61 6c 79 73 69 73 20 64 75 72 69 6e e analysis durin
0760: 67 20 63 6f 6e 73 74 72 75 63 74 69 6f 6e 2e 20 g construction.
0770: 54 68 65 0a 09 23 20 66 69 6c 65 20 72 65 76 69 The..# file revi
0780: 73 69 6f 6e 73 20 68 65 6c 64 20 62 79 20 74 68 sions held by th
0790: 65 20 63 68 61 6e 67 65 73 65 74 20 43 53 45 54 e changeset CSET
07a0: 20 63 61 6e 20 62 65 20 73 6f 72 74 65 64 20 69 can be sorted i
07b0: 6e 74 6f 0a 09 23 20 66 6f 75 72 20 63 61 74 65 nto..# four cate
07c0: 67 6f 72 69 65 73 2e 0a 0a 09 23 20 31 2e 20 52 gories....# 1. R
07d0: 65 76 69 73 69 6f 6e 73 20 77 68 6f 73 65 20 70 evisions whose p
07e0: 72 65 64 65 63 65 73 73 6f 72 73 20 61 72 65 20 redecessors are
07f0: 6e 6f 74 20 69 6e 20 50 52 45 56 2c 20 6e 6f 72 not in PREV, nor
0800: 20 61 72 65 0a 09 23 20 20 20 20 74 68 65 69 72 are..# their
0810: 20 73 75 63 63 65 73 73 6f 72 73 20 66 6f 75 6e successors foun
0820: 64 20 69 6e 20 4e 45 58 54 2e 20 54 68 65 73 65 d in NEXT. These
0830: 20 72 65 76 69 73 69 6f 6e 73 20 64 6f 20 6e 6f revisions do no
0840: 74 0a 09 23 20 20 20 20 63 6f 75 6e 74 2c 20 61 t..# count, a
0850: 73 20 74 68 65 79 20 64 69 64 20 6e 6f 74 20 69 s they did not i
0860: 6e 64 75 63 65 20 61 6e 79 20 6f 66 20 74 68 65 nduce any of the
0870: 20 74 77 6f 20 64 65 70 65 6e 64 65 6e 63 69 65 two dependencie
0880: 73 0a 09 23 20 20 20 20 75 6e 64 65 72 20 63 6f s..# under co
0890: 6e 73 69 64 65 72 61 74 69 6f 6e 2e 20 54 68 65 nsideration. The
08a0: 79 20 63 61 6e 20 62 65 20 69 67 6e 6f 72 65 64 y can be ignored
08b0: 2e 0a 0a 09 23 20 32 2e 20 52 65 76 69 73 69 6f ....# 2. Revisio
08c0: 6e 73 20 77 68 69 63 68 20 68 61 76 65 20 70 72 ns which have pr
08d0: 65 64 65 63 65 73 73 6f 72 73 20 69 6e 20 50 52 edecessors in PR
08e0: 45 56 20 61 6e 64 20 73 75 63 65 73 73 6f 72 73 EV and sucessors
08f0: 0a 09 23 20 20 20 20 69 6e 20 4e 45 58 54 2e 20 ..# in NEXT.
0900: 54 68 65 79 20 61 72 65 20 63 61 6c 6c 65 64 20 They are called
0910: 27 70 61 73 73 74 68 72 6f 75 67 68 27 20 69 6e 'passthrough' in
0920: 20 63 76 73 32 73 76 6e 2e 20 54 68 65 79 0a 09 cvs2svn. They..
0930: 23 20 20 20 20 69 6e 64 75 63 65 20 62 6f 74 68 # induce both
0940: 20 64 65 70 65 6e 64 65 6e 63 69 65 73 20 75 6e dependencies un
0950: 64 65 72 20 63 6f 6e 73 69 64 65 72 61 74 69 6f der consideratio
0960: 6e 20 61 6e 64 20 61 72 65 20 74 68 75 73 0a 09 n and are thus..
0970: 23 20 20 20 20 63 72 69 74 69 63 61 6c 20 69 6e # critical in
0980: 20 74 68 65 20 63 72 65 61 74 69 6f 6e 20 6f 66 the creation of
0990: 20 74 68 65 20 63 79 63 6c 65 2e 20 41 73 20 73 the cycle. As s
09a0: 75 63 68 20 74 68 65 79 20 61 72 65 0a 09 23 20 uch they are..#
09b0: 20 20 20 61 6c 73 6f 20 75 6e 62 72 65 61 6b 61 also unbreaka
09c0: 62 6c 65 20 3a 28 0a 0a 09 23 20 33 2e 20 52 65 ble :(...# 3. Re
09d0: 76 69 73 69 6f 6e 73 20 77 68 69 63 68 20 68 61 visions which ha
09e0: 76 65 20 70 72 65 64 65 63 65 73 73 6f 72 20 69 ve predecessor i
09f0: 6e 20 50 52 45 56 45 2c 20 62 75 74 20 6e 6f 0a n PREVE, but no.
0a00: 09 23 20 20 20 20 73 75 63 63 65 73 73 6f 72 73 .# successors
0a10: 20 69 6e 20 4e 45 58 54 2e 20 41 73 20 73 75 63 in NEXT. As suc
0a20: 68 20 74 68 65 79 20 69 6e 64 75 63 65 64 20 74 h they induced t
0a30: 68 65 20 69 6e 63 6f 6d 69 6e 67 0a 09 23 20 20 he incoming..#
0a40: 20 20 64 65 70 65 6e 64 65 6e 63 79 2c 20 62 75 dependency, bu
0a50: 74 20 6e 6f 74 20 74 68 65 20 6f 75 74 67 6f 69 t not the outgoi
0a60: 6e 67 20 6f 6e 65 2e 0a 0a 09 23 20 34 2e 20 52 ng one....# 4. R
0a70: 65 76 69 73 69 6f 6e 73 20 77 68 69 63 68 20 68 evisions which h
0a80: 61 76 65 20 6e 6f 20 70 72 65 64 65 63 65 73 73 ave no predecess
0a90: 6f 72 73 20 69 6e 20 50 52 45 56 45 2c 20 62 75 ors in PREVE, bu
0aa0: 74 20 74 68 65 69 72 0a 09 23 20 20 20 20 73 75 t their..# su
0ab0: 63 63 65 73 73 6f 72 73 20 61 72 65 20 69 6e 20 ccessors are in
0ac0: 4e 45 58 54 2e 20 41 73 20 73 75 63 68 20 74 68 NEXT. As such th
0ad0: 65 79 20 69 6e 64 75 63 65 64 20 74 68 65 20 6f ey induced the o
0ae0: 75 74 67 6f 69 6e 67 0a 09 23 20 20 20 20 64 65 utgoing..# de
0af0: 70 65 6e 64 65 6e 63 79 2c 20 62 75 74 20 6e 6f pendency, but no
0b00: 74 20 74 68 65 20 69 6e 63 6f 6d 69 6e 67 20 6f t the incoming o
0b10: 6e 65 2e 0a 0a 09 23 20 49 66 20 77 65 20 68 61 ne....# If we ha
0b20: 76 65 20 6e 6f 20 70 61 73 73 74 68 72 6f 75 67 ve no passthroug
0b30: 68 20 72 65 76 69 73 69 6f 6e 73 20 74 68 65 6e h revisions then
0b40: 20 73 70 6c 69 74 74 69 6e 67 20 74 68 65 0a 09 splitting the..
0b50: 23 20 63 68 61 6e 67 65 73 65 74 20 62 65 74 77 # changeset betw
0b60: 65 65 6e 20 63 61 74 65 67 6f 72 69 65 73 20 33 een categories 3
0b70: 20 61 6e 64 20 34 2c 20 77 69 74 68 20 63 61 74 and 4, with cat
0b80: 65 67 6f 72 79 20 31 20 67 6f 69 6e 67 0a 09 23 egory 1 going..#
0b90: 20 77 68 65 72 65 76 65 72 2c 20 77 69 6c 6c 20 wherever, will
0ba0: 62 72 65 61 6b 20 74 68 65 20 63 79 63 6c 65 2e break the cycle.
0bb0: 20 49 66 20 63 61 74 65 67 6f 72 79 20 32 20 72 If category 2 r
0bc0: 65 76 69 73 69 6f 6e 73 20 61 72 65 0a 09 23 20 evisions are..#
0bd0: 70 72 65 73 65 6e 74 20 77 65 20 63 61 6e 20 73 present we can s
0be0: 74 69 6c 6c 20 70 65 72 66 6f 72 6d 20 74 68 65 till perform the
0bf0: 20 73 70 6c 69 74 2c 20 74 68 69 73 20 77 69 6c split, this wil
0c00: 6c 20 68 6f 77 65 76 65 72 0a 09 23 20 6e 6f 74 l however..# not
0c10: 20 62 72 65 61 6b 20 74 68 65 20 63 79 63 6c 65 break the cycle
0c20: 2c 20 6f 6e 6c 79 20 77 65 61 6b 65 6e 20 69 74 , only weaken it
0c30: 2e 0a 0a 09 61 72 72 61 79 20 73 65 74 20 63 73 ....array set cs
0c40: 65 74 70 72 65 76 6d 61 70 20 5b 49 6e 76 65 72 etprevmap [Inver
0c50: 74 20 5b 24 6d 79 70 72 65 76 20 6e 65 78 74 6d t [$myprev nextm
0c60: 61 70 5d 5d 0a 09 61 72 72 61 79 20 73 65 74 20 ap]]..array set
0c70: 63 73 65 74 6e 65 78 74 6d 61 70 20 5b 24 6d 79 csetnextmap [$my
0c80: 63 73 65 74 20 6e 65 78 74 6d 61 70 5d 0a 0a 09 cset nextmap]...
0c90: 73 65 74 20 70 72 65 76 72 65 76 20 5b 24 6d 79 set prevrev [$my
0ca0: 70 72 65 76 20 72 65 76 69 73 69 6f 6e 73 5d 0a prev revisions].
0cb0: 09 73 65 74 20 6e 65 78 74 72 65 76 20 5b 24 6d .set nextrev [$m
0cc0: 79 6e 65 78 74 20 72 65 76 69 73 69 6f 6e 73 5d ynext revisions]
0cd0: 0a 0a 09 66 6f 72 65 61 63 68 20 72 20 5b 24 6d ...foreach r [$m
0ce0: 79 63 73 65 74 20 72 65 76 69 73 69 6f 6e 73 5d ycset revisions]
0cf0: 20 7b 0a 09 20 20 20 20 73 65 74 20 72 74 20 5b {.. set rt [
0d00: 52 54 20 24 72 5d 0a 09 20 20 20 20 69 6e 63 72 RT $r].. incr
0d10: 20 20 20 20 6d 79 63 6f 75 6e 74 28 24 72 74 29 mycount($rt)
0d20: 0a 09 20 20 20 20 6c 61 70 70 65 6e 64 20 6d 79 .. lappend my
0d30: 63 61 74 65 67 6f 72 79 28 24 72 74 29 20 24 72 category($rt) $r
0d40: 0a 09 7d 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 ..}..return.
0d50: 7d 0a 0a 20 20 20 20 23 20 52 65 73 75 6c 74 20 }.. # Result
0d60: 69 73 20 54 52 55 45 20 69 66 20 61 6e 64 20 6f is TRUE if and o
0d70: 6e 6c 79 20 62 72 65 61 6b 69 6e 67 20 6d 79 73 nly breaking mys
0d80: 65 74 20 77 69 6c 6c 20 64 6f 20 73 6f 6d 65 20 et will do some
0d90: 67 6f 6f 64 2e 0a 20 20 20 20 6d 65 74 68 6f 64 good.. method
0da0: 20 62 72 65 61 6b 61 62 6c 65 20 7b 7d 20 7b 20 breakable {} {
0db0: 65 78 70 72 20 20 7b 24 6d 79 63 6f 75 6e 74 28 expr {$mycount(
0dc0: 70 72 65 76 29 20 7c 7c 20 24 6d 79 63 6f 75 6e prev) || $mycoun
0dd0: 74 28 6e 65 78 74 29 7d 20 7d 0a 20 20 20 20 6d t(next)} }. m
0de0: 65 74 68 6f 64 20 70 61 73 73 63 6f 75 6e 74 20 ethod passcount
0df0: 7b 7d 20 7b 20 72 65 74 75 72 6e 20 24 6d 79 63 {} { return $myc
0e00: 6f 75 6e 74 28 70 61 73 73 29 20 7d 0a 0a 20 20 ount(pass) }..
0e10: 20 20 6d 65 74 68 6f 64 20 6c 69 6e 6b 73 74 6f method linksto
0e20: 6d 6f 76 65 20 7b 7d 20 7b 0a 09 23 20 52 65 74 move {} {..# Ret
0e30: 75 72 6e 20 74 68 65 20 6e 75 6d 62 65 72 20 6f urn the number o
0e40: 66 20 72 65 76 69 73 69 6f 6e 73 20 74 68 61 74 f revisions that
0e50: 20 77 6f 75 6c 64 20 62 65 20 6d 6f 76 65 64 20 would be moved
0e60: 73 68 6f 75 6c 64 20 77 65 0a 09 23 20 73 70 6c should we..# spl
0e70: 69 74 20 74 68 65 20 63 68 61 6e 67 65 73 65 74 it the changeset
0e80: 2e 0a 0a 09 73 65 74 20 6e 20 5b 6d 69 6e 32 20 ....set n [min2
0e90: 24 6d 79 63 6f 75 6e 74 28 70 72 65 76 29 20 24 $mycount(prev) $
0ea0: 6d 79 63 6f 75 6e 74 28 6e 65 78 74 29 5d 0a 09 mycount(next)]..
0eb0: 69 66 20 7b 24 6e 20 3e 20 30 20 7d 20 7b 20 72 if {$n > 0 } { r
0ec0: 65 74 75 72 6e 20 24 6e 20 7d 0a 09 72 65 74 75 eturn $n }..retu
0ed0: 72 6e 20 5b 6d 61 78 32 20 24 6d 79 63 6f 75 6e rn [max2 $mycoun
0ee0: 74 28 70 72 65 76 29 20 24 6d 79 63 6f 75 6e 74 t(prev) $mycount
0ef0: 28 6e 65 78 74 29 5d 0a 20 20 20 20 7d 0a 0a 20 (next)]. }..
0f00: 20 20 20 6d 65 74 68 6f 64 20 62 65 74 74 65 72 method better
0f10: 74 68 61 6e 20 7b 6f 74 68 65 72 7d 20 7b 0a 09 than {other} {..
0f20: 73 65 74 20 73 62 72 65 61 6b 20 5b 24 73 65 6c set sbreak [$sel
0f30: 66 20 20 62 72 65 61 6b 61 62 6c 65 5d 0a 09 73 f breakable]..s
0f40: 65 74 20 6f 62 72 65 61 6b 20 5b 24 6f 74 68 65 et obreak [$othe
0f50: 72 20 62 72 65 61 6b 61 62 6c 65 5d 0a 0a 09 69 r breakable]...i
0f60: 66 20 7b 24 73 62 72 65 61 6b 20 26 26 20 21 24 f {$sbreak && !$
0f70: 6f 62 72 65 61 6b 7d 20 7b 20 72 65 74 75 72 6e obreak} { return
0f80: 20 31 20 7d 20 3b 20 23 20 73 65 6c 66 20 69 73 1 } ; # self is
0f90: 20 62 65 74 74 65 72 2e 0a 09 69 66 20 7b 21 24 better...if {!$
0fa0: 73 62 72 65 61 6b 20 26 26 20 24 6f 62 72 65 61 sbreak && $obrea
0fb0: 6b 7d 20 7b 20 72 65 74 75 72 6e 20 30 20 7d 20 k} { return 0 }
0fc0: 3b 20 23 20 73 65 6c 66 20 69 73 20 77 6f 72 73 ; # self is wors
0fd0: 65 2e 0a 0a 09 23 20 45 71 75 61 6c 69 74 79 2e e....# Equality.
0fe0: 20 4c 6f 6f 6b 20 61 74 20 74 68 65 20 63 6f 75 Look at the cou
0ff0: 6e 74 65 72 73 2e 0a 09 23 20 2d 20 57 68 69 63 nters...# - Whic
1000: 68 65 76 65 72 20 68 61 73 20 74 68 65 20 6c 65 hever has the le
1010: 73 73 65 72 20 6e 75 6d 62 65 72 20 6f 66 20 70 sser number of p
1020: 61 73 73 74 68 72 6f 75 67 68 20 72 65 76 69 73 assthrough revis
1030: 69 6f 6e 73 0a 09 23 20 20 20 69 73 20 62 65 74 ions..# is bet
1040: 74 65 72 2c 20 61 73 20 6d 6f 72 65 20 63 61 6e ter, as more can
1050: 20 62 65 20 73 70 6c 69 74 20 6f 66 66 2c 20 77 be split off, w
1060: 65 61 6b 65 6e 69 6e 67 20 74 68 65 20 63 79 63 eakening the cyc
1070: 6c 65 0a 09 23 20 20 20 6d 6f 72 65 2e 0a 09 23 le..# more...#
1080: 20 2d 20 57 68 69 63 68 65 76 65 72 20 68 61 73 - Whichever has
1090: 20 6c 65 73 73 20 6c 69 6e 6b 73 20 74 6f 20 6d less links to m
10a0: 6f 76 65 20 69 73 20 62 65 74 74 65 72 2e 0a 0a ove is better...
10b0: 09 73 65 74 20 6f 70 61 73 73 20 5b 24 6f 74 68 .set opass [$oth
10c0: 65 72 20 70 61 73 73 63 6f 75 6e 74 5d 0a 09 69 er passcount]..i
10d0: 66 20 7b 24 6d 79 63 6f 75 6e 74 28 70 61 73 73 f {$mycount(pass
10e0: 29 20 3c 20 24 6f 70 61 73 73 7d 20 7b 20 72 65 ) < $opass} { re
10f0: 74 75 72 6e 20 31 20 7d 20 3b 20 23 20 73 65 6c turn 1 } ; # sel
1100: 66 20 69 73 20 62 65 74 74 65 72 2e 0a 09 69 66 f is better...if
1110: 20 7b 24 6d 79 63 6f 75 6e 74 28 70 61 73 73 29 {$mycount(pass)
1120: 20 3e 20 24 6f 70 61 73 73 7d 20 7b 20 72 65 74 > $opass} { ret
1130: 75 72 6e 20 30 20 7d 20 3b 20 23 20 73 65 6c 66 urn 0 } ; # self
1140: 20 69 73 20 77 6f 72 73 65 2e 0a 0a 09 73 65 74 is worse....set
1150: 20 73 6d 6f 76 65 20 5b 24 73 65 6c 66 20 20 6c smove [$self l
1160: 69 6e 6b 73 74 6f 6d 6f 76 65 5d 0a 09 73 65 74 inkstomove]..set
1170: 20 6f 6d 6f 76 65 20 5b 24 6f 74 68 65 72 20 6c omove [$other l
1180: 69 6e 6b 73 74 6f 6d 6f 76 65 5d 0a 0a 09 69 66 inkstomove]...if
1190: 20 7b 24 73 6d 6f 76 65 20 3c 20 24 6f 6d 6f 76 {$smove < $omov
11a0: 65 7d 20 7b 20 72 65 74 75 72 6e 20 31 20 7d 20 e} { return 1 }
11b0: 3b 20 23 20 73 65 6c 66 20 69 73 20 62 65 74 74 ; # self is bett
11c0: 65 72 2e 0a 0a 09 72 65 74 75 72 6e 20 30 20 3b er....return 0 ;
11d0: 20 23 20 53 65 6c 66 20 69 73 20 77 6f 72 73 65 # Self is worse
11e0: 20 6f 72 20 65 71 75 61 6c 2c 20 69 2e 65 2e 20 or equal, i.e.
11f0: 6e 6f 74 20 62 65 74 74 65 72 2e 0a 20 20 20 20 not better..
1200: 7d 0a 0a 20 20 20 20 6d 65 74 68 6f 64 20 62 72 }.. method br
1210: 65 61 6b 20 7b 7d 20 7b 0a 09 69 66 20 7b 21 5b eak {} {..if {![
1220: 24 73 65 6c 66 20 62 72 65 61 6b 61 62 6c 65 5d $self breakable]
1230: 7d 20 7b 0a 09 20 20 20 20 74 72 6f 75 62 6c 65 } {.. trouble
1240: 20 69 6e 74 65 72 6e 61 6c 20 22 43 68 61 6e 67 internal "Chang
1250: 65 73 65 74 20 3c 5b 24 6d 79 63 73 65 74 20 69 eset <[$mycset i
1260: 64 5d 3e 20 69 73 20 6e 6f 74 20 62 72 65 61 6b d]> is not break
1270: 61 62 6c 65 2e 22 0a 09 7d 0a 0a 09 23 20 4f 6e able."..}...# On
1280: 65 20 74 68 69 6e 67 20 74 6f 20 63 68 6f 6f 73 e thing to choos
1290: 65 20 77 68 65 6e 20 73 70 6c 69 74 74 69 6e 67 e when splitting
12a0: 20 43 53 45 54 20 69 73 20 77 68 65 72 65 20 74 CSET is where t
12b0: 68 65 0a 09 23 20 72 65 76 69 73 69 6f 6e 20 69 he..# revision i
12c0: 6e 20 63 61 74 65 67 6f 72 69 65 73 20 31 20 61 n categories 1 a
12d0: 6e 64 20 32 20 28 6e 6f 6e 65 20 61 6e 64 20 70 nd 2 (none and p
12e0: 61 73 73 74 68 72 6f 75 67 68 0a 09 23 20 72 65 assthrough..# re
12f0: 73 70 65 63 74 69 76 65 6c 79 29 20 61 72 65 20 spectively) are
1300: 6d 6f 76 65 64 20 74 6f 2e 20 54 68 69 73 20 69 moved to. This i
1310: 73 20 64 6f 6e 65 20 75 73 69 6e 67 20 74 68 65 s done using the
1320: 20 63 6f 75 6e 74 65 72 73 2e 0a 0a 09 69 66 20 counters....if
1330: 7b 21 24 6d 79 63 6f 75 6e 74 28 70 72 65 76 29 {!$mycount(prev)
1340: 7d 20 7b 0a 09 20 20 20 20 23 20 4e 6f 74 68 69 } {.. # Nothi
1350: 6e 67 20 69 6e 20 63 61 74 65 67 6f 72 79 20 33 ng in category 3
1360: 20 3d 3e 20 31 2c 32 20 67 6f 20 74 68 65 72 65 => 1,2 go there
1370: 2c 20 34 20 74 68 65 20 6f 74 68 65 72 2e 0a 09 , 4 the other...
1380: 20 20 20 20 73 65 74 20 6d 79 63 61 74 65 67 6f set mycatego
1390: 72 79 28 70 72 65 76 29 20 5b 63 6f 6e 63 61 74 ry(prev) [concat
13a0: 20 24 6d 79 63 61 74 65 67 6f 72 79 28 6e 6f 6e $mycategory(non
13b0: 65 29 20 24 6d 79 63 61 74 65 67 6f 72 79 28 70 e) $mycategory(p
13c0: 61 73 73 29 5d 0a 09 7d 20 65 6c 73 65 69 66 20 ass)]..} elseif
13d0: 7b 21 24 6d 79 63 6f 75 6e 74 28 6e 65 78 74 29 {!$mycount(next)
13e0: 7d 20 7b 0a 09 20 20 20 20 23 20 4e 6f 74 68 69 } {.. # Nothi
13f0: 6e 67 20 69 6e 20 63 61 74 65 67 6f 72 79 20 34 ng in category 4
1400: 20 3d 3e 20 31 2c 32 20 67 6f 20 74 68 65 72 65 => 1,2 go there
1410: 2c 20 33 20 74 68 65 20 6f 74 68 65 72 2e 0a 09 , 3 the other...
1420: 20 20 20 20 73 65 74 20 6d 79 63 61 74 65 67 6f set mycatego
1430: 72 79 28 6e 65 78 74 29 20 5b 63 6f 6e 63 61 74 ry(next) [concat
1440: 20 24 6d 79 63 61 74 65 67 6f 72 79 28 6e 6f 6e $mycategory(non
1450: 65 29 20 24 6d 79 63 61 74 65 67 6f 72 79 28 70 e) $mycategory(p
1460: 61 73 73 29 5d 0a 09 7d 20 65 6c 73 65 69 66 20 ass)]..} elseif
1470: 7b 24 6d 79 63 6f 75 6e 74 28 70 72 65 76 29 20 {$mycount(prev)
1480: 3c 20 24 6d 79 63 6f 75 6e 74 28 6e 65 78 74 29 < $mycount(next)
1490: 7d 20 7b 0a 09 20 20 20 20 23 20 4c 65 73 73 20 } {.. # Less
14a0: 70 72 65 64 65 63 65 73 73 6f 72 73 20 74 68 61 predecessors tha
14b0: 6e 20 73 75 63 63 65 73 73 6f 72 73 20 3d 3e 20 n successors =>
14c0: 31 2c 32 20 67 6f 20 74 6f 20 74 68 65 0a 09 20 1,2 go to the..
14d0: 20 20 20 23 20 73 75 63 65 73 73 6f 72 73 2e 0a # sucessors..
14e0: 09 20 20 20 20 73 65 74 20 6d 79 63 61 74 65 67 . set mycateg
14f0: 6f 72 79 28 6e 65 78 74 29 20 5b 63 6f 6e 63 61 ory(next) [conca
1500: 74 20 24 6d 79 63 61 74 65 67 6f 72 79 28 6e 65 t $mycategory(ne
1510: 78 74 29 20 24 6d 79 63 61 74 65 67 6f 72 79 28 xt) $mycategory(
1520: 6e 6f 6e 65 29 20 5c 0a 09 09 09 09 20 20 20 20 none) \.....
1530: 20 20 24 6d 79 63 61 74 65 67 6f 72 79 28 70 61 $mycategory(pa
1540: 73 73 29 5d 0a 09 7d 20 65 6c 73 65 20 7b 0a 09 ss)]..} else {..
1550: 20 20 20 20 23 20 4c 65 73 73 20 73 75 63 63 65 # Less succe
1560: 73 73 6f 72 73 20 74 68 61 6e 20 70 72 65 64 65 ssors than prede
1570: 63 65 73 73 6f 72 73 20 3d 3e 20 31 2c 32 20 67 cessors => 1,2 g
1580: 6f 20 74 6f 20 74 68 65 0a 09 20 20 20 20 23 20 o to the.. #
1590: 70 72 65 64 65 63 65 73 73 6f 72 73 2e 0a 09 20 predecessors...
15a0: 20 20 20 73 65 74 20 6d 79 63 61 74 65 67 6f 72 set mycategor
15b0: 79 28 6e 65 78 74 29 20 5b 63 6f 6e 63 61 74 20 y(next) [concat
15c0: 24 6d 79 63 61 74 65 67 6f 72 79 28 6e 65 78 74 $mycategory(next
15d0: 29 20 24 6d 79 63 61 74 65 67 6f 72 79 28 6e 6f ) $mycategory(no
15e0: 6e 65 29 20 5c 0a 09 09 09 09 20 20 20 20 20 20 ne) \.....
15f0: 24 6d 79 63 61 74 65 67 6f 72 79 28 70 61 73 73 $mycategory(pass
1600: 29 5d 0a 09 7d 0a 0a 09 23 20 57 65 20 6e 6f 77 )]..}...# We now
1610: 20 68 61 76 65 20 74 68 65 20 72 65 76 69 73 69 have the revisi
1620: 6f 6e 73 20 66 6f 72 20 74 68 65 20 74 77 6f 20 ons for the two
1630: 66 72 61 67 6d 65 6e 74 73 20 74 6f 20 62 65 20 fragments to be
1640: 69 6e 20 74 68 65 0a 09 23 20 28 70 72 65 76 7c in the..# (prev|
1650: 6e 65 78 74 29 20 65 6c 65 6d 65 6e 74 73 20 6f next) elements o
1660: 66 20 6d 79 63 61 74 65 67 6f 72 79 2e 0a 0a 09 f mycategory....
1670: 72 65 74 75 72 6e 20 5b 70 72 6f 6a 65 63 74 3a return [project:
1680: 3a 72 65 76 20 73 70 6c 69 74 20 24 6d 79 63 73 :rev split $mycs
1690: 65 74 20 24 6d 79 63 61 74 65 67 6f 72 79 28 70 et $mycategory(p
16a0: 72 65 76 29 20 24 6d 79 63 61 74 65 67 6f 72 79 rev) $mycategory
16b0: 28 6e 65 78 74 29 5d 0a 20 20 20 20 7d 0a 0a 20 (next)]. }..
16c0: 20 20 20 23 20 23 20 23 23 20 23 23 23 20 23 23 # # ## ### ##
16d0: 23 23 23 20 23 23 23 23 23 23 23 23 20 23 23 23 ### ######## ###
16e0: 23 23 23 23 23 23 23 23 23 23 0a 20 20 20 20 23 ##########. #
16f0: 23 20 53 74 61 74 65 0a 0a 20 20 20 20 76 61 72 # State.. var
1700: 69 61 62 6c 65 20 6d 79 70 72 65 76 20 7b 7d 20 iable myprev {}
1710: 3b 20 23 20 52 65 66 65 72 65 6e 63 65 20 74 6f ; # Reference to
1720: 20 70 72 65 64 65 63 65 73 73 6f 72 20 63 68 61 predecessor cha
1730: 6e 67 65 73 65 74 20 69 6e 20 74 68 65 20 6c 69 ngeset in the li
1740: 6e 6b 2e 0a 20 20 20 20 76 61 72 69 61 62 6c 65 nk.. variable
1750: 20 6d 79 63 73 65 74 20 7b 7d 20 3b 20 23 20 52 mycset {} ; # R
1760: 65 66 65 72 65 6e 63 65 20 74 6f 20 74 68 65 20 eference to the
1770: 6d 61 69 6e 20 63 68 61 6e 67 65 73 65 74 20 6f main changeset o
1780: 66 20 74 68 65 20 6c 69 6e 6b 2e 0a 20 20 20 20 f the link..
1790: 76 61 72 69 61 62 6c 65 20 6d 79 6e 65 78 74 20 variable mynext
17a0: 7b 7d 20 3b 20 23 20 52 65 66 65 72 65 6e 63 65 {} ; # Reference
17b0: 20 74 6f 20 74 68 65 20 73 75 63 63 65 73 73 6f to the successo
17c0: 72 20 63 68 61 6e 67 65 73 65 74 20 69 6e 20 74 r changeset in t
17d0: 68 65 20 6c 69 6e 6b 2e 0a 0a 20 20 20 20 23 20 he link... #
17e0: 43 6f 75 6e 74 65 72 73 20 66 6f 72 20 74 68 65 Counters for the
17f0: 20 72 65 76 69 73 69 6f 6e 20 63 61 74 65 67 6f revision catego
1800: 72 69 65 73 2e 0a 20 20 20 20 76 61 72 69 61 62 ries.. variab
1810: 6c 65 20 6d 79 63 6f 75 6e 74 20 2d 61 72 72 61 le mycount -arra
1820: 79 20 7b 0a 09 6e 6f 6e 65 20 30 0a 09 70 72 65 y {..none 0..pre
1830: 76 20 30 0a 09 6e 65 78 74 20 30 0a 09 70 61 73 v 0..next 0..pas
1840: 73 20 30 0a 20 20 20 20 7d 0a 20 20 20 20 23 20 s 0. }. #
1850: 4c 69 73 74 73 20 6f 66 20 72 65 76 69 73 69 6f Lists of revisio
1860: 6e 73 20 66 6f 72 20 74 68 65 20 76 61 72 69 6f ns for the vario
1870: 75 73 20 63 61 74 65 67 6f 72 69 65 73 0a 20 20 us categories.
1880: 20 20 76 61 72 69 61 62 6c 65 20 6d 79 63 61 74 variable mycat
1890: 65 67 6f 72 79 20 2d 61 72 72 61 79 20 7b 0a 09 egory -array {..
18a0: 6e 6f 6e 65 20 7b 7d 0a 09 70 72 65 76 20 7b 7d none {}..prev {}
18b0: 0a 09 6e 65 78 74 20 7b 7d 0a 09 70 61 73 73 20 ..next {}..pass
18c0: 7b 7d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 20 {}. }.. #
18d0: 23 20 23 23 20 23 23 23 20 23 23 23 23 23 20 23 # ## ### ##### #
18e0: 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23 ####### ########
18f0: 23 23 23 23 23 0a 20 20 20 20 23 23 20 49 6e 74 #####. ## Int
1900: 65 72 6e 61 6c 20 6d 65 74 68 6f 64 73 0a 0a 20 ernal methods..
1910: 20 20 20 70 72 6f 63 20 52 54 20 7b 72 7d 20 7b proc RT {r} {
1920: 0a 09 75 70 76 61 72 20 31 20 63 73 65 74 70 72 ..upvar 1 csetpr
1930: 65 76 6d 61 70 20 63 73 65 74 70 72 65 76 6d 61 evmap csetprevma
1940: 70 20 63 73 65 74 6e 65 78 74 6d 61 70 20 63 73 p csetnextmap cs
1950: 65 74 6e 65 78 74 6d 61 70 20 70 72 65 76 72 65 etnextmap prevre
1960: 76 20 70 72 65 76 72 65 76 20 6e 65 78 74 72 65 v prevrev nextre
1970: 76 20 6e 65 78 74 72 65 76 0a 0a 09 73 65 74 20 v nextrev...set
1980: 69 6e 63 09 5b 65 78 70 72 20 7b 5b 69 6e 66 6f inc.[expr {[info
1990: 20 65 78 69 73 74 73 20 63 73 65 74 70 72 65 76 exists csetprev
19a0: 6d 61 70 28 24 72 29 5d 0a 09 09 20 20 20 20 20 map($r)]...
19b0: 20 20 3f 20 5b 73 74 72 75 63 74 3a 3a 73 65 74 ? [struct::set
19c0: 20 73 69 7a 65 20 5b 73 74 72 75 63 74 3a 3a 73 size [struct::s
19d0: 65 74 20 69 6e 74 65 72 73 65 63 74 20 24 63 73 et intersect $cs
19e0: 65 74 70 72 65 76 6d 61 70 28 24 72 29 20 24 70 etprevmap($r) $p
19f0: 72 65 76 72 65 76 5d 5d 0a 09 09 20 20 20 20 20 revrev]]...
1a00: 20 20 3a 20 30 7d 5d 0a 09 73 65 74 20 6f 75 74 : 0}]..set out
1a10: 20 5b 65 78 70 72 20 7b 5b 69 6e 66 6f 20 65 78 [expr {[info ex
1a20: 69 73 74 73 20 63 73 65 74 6e 65 78 74 6d 61 70 ists csetnextmap
1a30: 28 24 72 29 5d 0a 09 09 20 20 20 20 20 20 20 3f ($r)]... ?
1a40: 20 5b 73 74 72 75 63 74 3a 3a 73 65 74 20 73 69 [struct::set si
1a50: 7a 65 20 5b 73 74 72 75 63 74 3a 3a 73 65 74 20 ze [struct::set
1a60: 69 6e 74 65 72 73 65 63 74 20 24 63 73 65 74 6e intersect $csetn
1a70: 65 78 74 6d 61 70 28 24 72 29 20 24 6e 65 78 74 extmap($r) $next
1a80: 72 65 76 5d 5d 0a 09 09 20 20 20 20 20 20 20 3a rev]]... :
1a90: 20 30 7d 5d 0a 0a 09 69 66 20 7b 24 69 6e 63 20 0}]...if {$inc
1aa0: 26 26 20 24 6f 75 74 7d 20 7b 20 72 65 74 75 72 && $out} { retur
1ab0: 6e 20 70 61 73 73 20 7d 0a 09 69 66 20 7b 24 69 n pass }..if {$i
1ac0: 6e 63 7d 20 20 20 20 20 20 20 20 20 7b 20 72 65 nc} { re
1ad0: 74 75 72 6e 20 70 72 65 76 20 7d 0a 09 69 66 20 turn prev }..if
1ae0: 7b 24 6f 75 74 7d 20 20 20 20 20 20 20 20 20 7b {$out} {
1af0: 20 72 65 74 75 72 6e 20 6e 65 78 74 20 7d 0a 09 return next }..
1b00: 72 65 74 75 72 6e 20 6e 6f 6e 65 0a 20 20 20 20 return none.
1b10: 7d 0a 0a 20 20 20 20 70 72 6f 63 20 49 6e 76 65 }.. proc Inve
1b20: 72 74 20 7b 64 69 63 74 7d 20 7b 0a 09 61 72 72 rt {dict} {..arr
1b30: 61 79 20 73 65 74 20 74 6d 70 20 7b 7d 0a 09 66 ay set tmp {}..f
1b40: 6f 72 65 61 63 68 20 7b 6b 20 76 61 6c 75 65 73 oreach {k values
1b50: 7d 20 24 64 69 63 74 20 7b 0a 09 20 20 20 20 66 } $dict {.. f
1b60: 6f 72 65 61 63 68 20 76 20 24 76 61 6c 75 65 73 oreach v $values
1b70: 20 7b 20 6c 61 70 70 65 6e 64 20 74 6d 70 28 24 { lappend tmp($
1b80: 76 29 20 24 6b 20 7d 0a 09 7d 0a 09 72 65 74 75 v) $k }..}..retu
1b90: 72 6e 20 5b 61 72 72 61 79 20 67 65 74 20 74 6d rn [array get tm
1ba0: 70 5d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 20 p]. }.. #
1bb0: 23 20 23 23 20 23 23 23 20 23 23 23 23 23 20 23 # ## ### ##### #
1bc0: 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23 ####### ########
1bd0: 23 23 23 23 23 0a 20 20 20 20 23 23 20 43 6f 6e #####. ## Con
1be0: 66 69 67 75 72 61 74 69 6f 6e 0a 0a 20 20 20 20 figuration..
1bf0: 70 72 61 67 6d 61 20 2d 68 61 73 74 79 70 65 69 pragma -hastypei
1c00: 6e 66 6f 20 20 20 20 6e 6f 20 20 3b 20 23 20 6e nfo no ; # n
1c10: 6f 20 74 79 70 65 20 69 6e 74 72 6f 73 70 65 63 o type introspec
1c20: 74 69 6f 6e 0a 20 20 20 20 70 72 61 67 6d 61 20 tion. pragma
1c30: 2d 68 61 73 69 6e 66 6f 20 20 20 20 20 20 20 20 -hasinfo
1c40: 6e 6f 20 20 3b 20 23 20 6e 6f 20 6f 62 6a 65 63 no ; # no objec
1c50: 74 20 69 6e 74 72 6f 73 70 65 63 74 69 6f 6e 0a t introspection.
1c60: 20 20 20 20 70 72 61 67 6d 61 20 2d 73 69 6d 70 pragma -simp
1c70: 6c 65 64 69 73 70 61 74 63 68 20 79 65 73 20 3b ledispatch yes ;
1c80: 20 23 20 73 69 6d 70 6c 65 20 66 61 73 74 20 64 # simple fast d
1c90: 69 73 70 61 74 63 68 0a 0a 20 20 20 20 23 20 23 ispatch.. # #
1ca0: 20 23 23 20 23 23 23 20 23 23 23 23 23 20 23 23 ## ### ##### ##
1cb0: 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23 ###### #########
1cc0: 23 23 23 23 0a 7d 0a 0a 6e 61 6d 65 73 70 61 63 ####.}..namespac
1cd0: 65 20 65 76 61 6c 20 3a 3a 76 63 3a 3a 66 6f 73 e eval ::vc::fos
1ce0: 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 sil::import::cvs
1cf0: 3a 3a 70 72 6f 6a 65 63 74 20 7b 0a 20 20 20 20 ::project {.
1d00: 6e 61 6d 65 73 70 61 63 65 20 65 78 70 6f 72 74 namespace export
1d10: 20 72 65 76 6c 69 6e 6b 0a 20 20 20 20 6e 61 6d revlink. nam
1d20: 65 73 70 61 63 65 20 65 76 61 6c 20 72 65 76 6c espace eval revl
1d30: 69 6e 6b 20 7b 0a 09 6e 61 6d 65 73 70 61 63 65 ink {..namespace
1d40: 20 69 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a 66 6f import ::vc::fo
1d50: 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 ssil::import::cv
1d60: 73 3a 3a 73 74 61 74 65 0a 09 6e 61 6d 65 73 70 s::state..namesp
1d70: 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63 3a ace import ::vc:
1d80: 3a 74 6f 6f 6c 73 3a 3a 6d 69 73 63 3a 3a 2a 0a :tools::misc::*.
1d90: 09 6e 61 6d 65 73 70 61 63 65 20 69 6d 70 6f 72 .namespace impor
1da0: 74 20 3a 3a 76 63 3a 3a 74 6f 6f 6c 73 3a 3a 74 t ::vc::tools::t
1db0: 72 6f 75 62 6c 65 0a 09 6e 61 6d 65 73 70 61 63 rouble..namespac
1dc0: 65 20 65 76 61 6c 20 70 72 6f 6a 65 63 74 20 7b e eval project {
1dd0: 0a 09 20 20 20 20 6e 61 6d 65 73 70 61 63 65 20 .. namespace
1de0: 69 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a 66 6f 73 import ::vc::fos
1df0: 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 sil::import::cvs
1e00: 3a 3a 70 72 6f 6a 65 63 74 3a 3a 72 65 76 0a 09 ::project::rev..
1e10: 7d 0a 09 6e 61 6d 65 73 70 61 63 65 20 69 6d 70 }..namespace imp
1e20: 6f 72 74 20 3a 3a 76 63 3a 3a 74 6f 6f 6c 73 3a ort ::vc::tools:
1e30: 3a 6c 6f 67 0a 09 6c 6f 67 20 72 65 67 69 73 74 :log..log regist
1e40: 65 72 20 63 73 65 74 73 0a 20 20 20 20 7d 0a 7d er csets. }.}
1e50: 0a 0a 23 20 23 20 23 23 20 23 23 23 20 23 23 23 ..# # ## ### ###
1e60: 23 23 20 23 23 23 23 23 23 23 23 20 23 23 23 23 ## ######## ####
1e70: 23 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23 ######### ######
1e80: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 0a ###############.
1e90: 23 23 20 52 65 61 64 79 0a 0a 70 61 63 6b 61 67 ## Ready..packag
1ea0: 65 20 70 72 6f 76 69 64 65 20 76 63 3a 3a 66 6f e provide vc::fo
1eb0: 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 ssil::import::cv
1ec0: 73 3a 3a 70 72 6f 6a 65 63 74 3a 3a 72 65 76 6c s::project::revl
1ed0: 69 6e 6b 20 31 2e 30 0a 72 65 74 75 72 6e 0a ink 1.0.return.