0000: 2f 2a 0a 2a 2a 20 43 6f 70 79 72 69 67 68 74 20 /*.** Copyright
0010: 28 63 29 20 32 30 30 37 20 44 2e 20 52 69 63 68 (c) 2007 D. Rich
0020: 61 72 64 20 48 69 70 70 0a 2a 2a 0a 2a 2a 20 54 ard Hipp.**.** T
0030: 68 69 73 20 70 72 6f 67 72 61 6d 20 69 73 20 66 his program is f
0040: 72 65 65 20 73 6f 66 74 77 61 72 65 3b 20 79 6f ree software; yo
0050: 75 20 63 61 6e 20 72 65 64 69 73 74 72 69 62 75 u can redistribu
0060: 74 65 20 69 74 20 61 6e 64 2f 6f 72 0a 2a 2a 20 te it and/or.**
0070: 6d 6f 64 69 66 79 20 69 74 20 75 6e 64 65 72 20 modify it under
0080: 74 68 65 20 74 65 72 6d 73 20 6f 66 20 74 68 65 the terms of the
0090: 20 53 69 6d 70 6c 69 66 69 65 64 20 42 53 44 20 Simplified BSD
00a0: 4c 69 63 65 6e 73 65 20 28 61 6c 73 6f 0a 2a 2a License (also.**
00b0: 20 6b 6e 6f 77 6e 20 61 73 20 74 68 65 20 22 32 known as the "2
00c0: 2d 43 6c 61 75 73 65 20 4c 69 63 65 6e 73 65 22 -Clause License"
00d0: 20 6f 72 20 22 46 72 65 65 42 53 44 20 4c 69 63 or "FreeBSD Lic
00e0: 65 6e 73 65 22 2e 29 0a 0a 2a 2a 20 54 68 69 73 ense".)..** This
00f0: 20 70 72 6f 67 72 61 6d 20 69 73 20 64 69 73 74 program is dist
0100: 72 69 62 75 74 65 64 20 69 6e 20 74 68 65 20 68 ributed in the h
0110: 6f 70 65 20 74 68 61 74 20 69 74 20 77 69 6c 6c ope that it will
0120: 20 62 65 20 75 73 65 66 75 6c 2c 0a 2a 2a 20 62 be useful,.** b
0130: 75 74 20 77 69 74 68 6f 75 74 20 61 6e 79 20 77 ut without any w
0140: 61 72 72 61 6e 74 79 3b 20 77 69 74 68 6f 75 74 arranty; without
0150: 20 65 76 65 6e 20 74 68 65 20 69 6d 70 6c 69 65 even the implie
0160: 64 20 77 61 72 72 61 6e 74 79 20 6f 66 0a 2a 2a d warranty of.**
0170: 20 6d 65 72 63 68 61 6e 74 61 62 69 6c 69 74 79 merchantability
0180: 20 6f 72 20 66 69 74 6e 65 73 73 20 66 6f 72 20 or fitness for
0190: 61 20 70 61 72 74 69 63 75 6c 61 72 20 70 75 72 a particular pur
01a0: 70 6f 73 65 2e 0a 2a 2a 0a 2a 2a 20 41 75 74 68 pose..**.** Auth
01b0: 6f 72 20 63 6f 6e 74 61 63 74 20 69 6e 66 6f 72 or contact infor
01c0: 6d 61 74 69 6f 6e 3a 0a 2a 2a 20 20 20 64 72 68 mation:.** drh
01d0: 40 68 77 61 63 69 2e 63 6f 6d 0a 2a 2a 20 20 20 @hwaci.com.**
01e0: 68 74 74 70 3a 2f 2f 77 77 77 2e 68 77 61 63 69 http://www.hwaci
01f0: 2e 63 6f 6d 2f 64 72 68 2f 0a 2a 2a 0a 2a 2a 2a .com/drh/.**.***
0200: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a ****************
0210: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a ****************
0220: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a ****************
0230: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a ****************
0240: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 0a 2a 2a 0a ************.**.
0250: 2a 2a 20 54 68 69 73 20 66 69 6c 65 20 63 6f 6e ** This file con
0260: 74 61 69 6e 73 20 63 6f 64 65 20 75 73 65 64 20 tains code used
0270: 74 6f 20 63 72 65 61 74 65 20 6e 65 77 20 62 72 to create new br
0280: 61 6e 63 68 65 73 20 77 69 74 68 69 6e 20 61 20 anches within a
0290: 72 65 70 6f 73 69 74 6f 72 79 2e 0a 2a 2f 0a 23 repository..*/.#
02a0: 69 6e 63 6c 75 64 65 20 22 63 6f 6e 66 69 67 2e include "config.
02b0: 68 22 0a 23 69 6e 63 6c 75 64 65 20 22 62 72 61 h".#include "bra
02c0: 6e 63 68 2e 68 22 0a 23 69 6e 63 6c 75 64 65 20 nch.h".#include
02d0: 3c 61 73 73 65 72 74 2e 68 3e 0a 0a 2f 2a 0a 2a <assert.h>../*.*
02e0: 2a 20 20 66 6f 73 73 69 6c 20 62 72 61 6e 63 68 * fossil branch
02f0: 20 6e 65 77 20 20 20 20 42 52 41 4e 43 48 2d 4e new BRANCH-N
0300: 41 4d 45 20 3f 4f 52 49 47 49 4e 2d 43 48 45 43 AME ?ORIGIN-CHEC
0310: 4b 2d 49 4e 3f 20 3f 2d 62 67 63 6f 6c 6f 72 20 K-IN? ?-bgcolor
0320: 43 4f 4c 4f 52 3f 0a 2a 2a 20 20 61 72 67 76 30 COLOR?.** argv0
0330: 20 20 61 72 67 76 31 20 20 61 72 67 76 32 20 20 argv1 argv2
0340: 61 72 67 76 33 20 20 20 20 20 20 20 61 72 67 76 argv3 argv
0350: 34 0a 2a 2f 0a 76 6f 69 64 20 62 72 61 6e 63 68 4.*/.void branch
0360: 5f 6e 65 77 28 76 6f 69 64 29 7b 0a 20 20 69 6e _new(void){. in
0370: 74 20 72 6f 6f 74 69 64 3b 20 20 20 20 20 20 20 t rootid;
0380: 20 20 20 20 20 2f 2a 20 52 49 44 20 6f 66 20 74 /* RID of t
0390: 68 65 20 72 6f 6f 74 20 63 68 65 63 6b 2d 69 6e he root check-in
03a0: 20 2d 20 77 68 61 74 20 77 65 20 62 72 61 6e 63 - what we branc
03b0: 68 20 6f 66 66 20 6f 66 20 2a 2f 0a 20 20 69 6e h off of */. in
03c0: 74 20 62 72 69 64 3b 20 20 20 20 20 20 20 20 20 t brid;
03d0: 20 20 20 20 20 2f 2a 20 52 49 44 20 6f 66 20 74 /* RID of t
03e0: 68 65 20 62 72 61 6e 63 68 20 63 68 65 63 6b 2d he branch check-
03f0: 69 6e 20 2a 2f 0a 20 20 69 6e 74 20 6e 6f 53 69 in */. int noSi
0400: 67 6e 3b 20 20 20 20 20 20 20 20 20 20 20 20 2f gn; /
0410: 2a 20 54 72 75 65 20 69 66 20 74 68 65 20 62 72 * True if the br
0420: 61 6e 63 68 20 69 73 20 75 6e 73 69 67 6e 65 64 anch is unsigned
0430: 20 2a 2f 0a 20 20 69 6e 74 20 69 3b 20 20 20 20 */. int i;
0440: 20 20 20 20 20 20 20 20 20 20 20 20 20 2f 2a 20 /*
0450: 4c 6f 6f 70 20 63 6f 75 6e 74 65 72 20 2a 2f 0a Loop counter */.
0460: 20 20 63 68 61 72 20 2a 7a 55 75 69 64 3b 20 20 char *zUuid;
0470: 20 20 20 20 20 20 20 20 20 2f 2a 20 41 72 74 69 /* Arti
0480: 66 61 63 74 20 49 44 20 6f 66 20 6f 72 69 67 69 fact ID of origi
0490: 6e 20 2a 2f 0a 20 20 53 74 6d 74 20 71 3b 20 20 n */. Stmt q;
04a0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2f 2a /*
04b0: 20 47 65 6e 65 72 69 63 20 71 75 65 72 79 20 2a Generic query *
04c0: 2f 0a 20 20 63 6f 6e 73 74 20 63 68 61 72 20 2a /. const char *
04d0: 7a 42 72 61 6e 63 68 3b 20 20 20 2f 2a 20 4e 61 zBranch; /* Na
04e0: 6d 65 20 6f 66 20 74 68 65 20 6e 65 77 20 62 72 me of the new br
04f0: 61 6e 63 68 20 2a 2f 0a 20 20 63 68 61 72 20 2a anch */. char *
0500: 7a 44 61 74 65 3b 20 20 20 20 20 20 20 20 20 20 zDate;
0510: 20 2f 2a 20 44 61 74 65 20 74 68 61 74 20 62 72 /* Date that br
0520: 61 6e 63 68 20 77 61 73 20 63 72 65 61 74 65 64 anch was created
0530: 20 2a 2f 0a 20 20 63 68 61 72 20 2a 7a 43 6f 6d */. char *zCom
0540: 6d 65 6e 74 3b 20 20 20 20 20 20 20 20 2f 2a 20 ment; /*
0550: 43 68 65 63 6b 2d 69 6e 20 63 6f 6d 6d 65 6e 74 Check-in comment
0560: 20 66 6f 72 20 74 68 65 20 6e 65 77 20 62 72 61 for the new bra
0570: 6e 63 68 20 2a 2f 0a 20 20 63 6f 6e 73 74 20 63 nch */. const c
0580: 68 61 72 20 2a 7a 43 6f 6c 6f 72 3b 20 20 20 20 har *zColor;
0590: 2f 2a 20 43 6f 6c 6f 72 20 6f 66 20 74 68 65 20 /* Color of the
05a0: 6e 65 77 20 62 72 61 6e 63 68 20 2a 2f 0a 20 20 new branch */.
05b0: 42 6c 6f 62 20 62 72 61 6e 63 68 3b 20 20 20 20 Blob branch;
05c0: 20 20 20 20 20 20 20 2f 2a 20 6d 61 6e 69 66 65 /* manife
05d0: 73 74 20 66 6f 72 20 74 68 65 20 6e 65 77 20 62 st for the new b
05e0: 72 61 6e 63 68 20 2a 2f 0a 20 20 4d 61 6e 69 66 ranch */. Manif
05f0: 65 73 74 20 2a 70 50 61 72 65 6e 74 3b 20 20 20 est *pParent;
0600: 20 20 2f 2a 20 50 61 72 73 65 64 20 70 61 72 65 /* Parsed pare
0610: 6e 74 20 6d 61 6e 69 66 65 73 74 20 2a 2f 0a 20 nt manifest */.
0620: 20 42 6c 6f 62 20 6d 63 6b 73 75 6d 3b 20 20 20 Blob mcksum;
0630: 20 20 20 20 20 20 20 20 2f 2a 20 53 65 6c 66 2d /* Self-
0640: 63 68 65 63 6b 73 75 6d 20 6f 6e 20 74 68 65 20 checksum on the
0650: 6d 61 6e 69 66 65 73 74 20 2a 2f 0a 20 20 63 6f manifest */. co
0660: 6e 73 74 20 63 68 61 72 20 2a 7a 44 61 74 65 4f nst char *zDateO
0670: 76 72 64 3b 20 2f 2a 20 4f 76 65 72 72 69 64 65 vrd; /* Override
0680: 20 64 61 74 65 20 73 74 72 69 6e 67 20 2a 2f 0a date string */.
0690: 20 20 63 6f 6e 73 74 20 63 68 61 72 20 2a 7a 55 const char *zU
06a0: 73 65 72 4f 76 72 64 3b 20 2f 2a 20 4f 76 65 72 serOvrd; /* Over
06b0: 72 69 64 65 20 75 73 65 72 20 6e 61 6d 65 20 2a ride user name *
06c0: 2f 0a 20 0a 20 20 6e 6f 53 69 67 6e 20 3d 20 66 /. . noSign = f
06d0: 69 6e 64 5f 6f 70 74 69 6f 6e 28 22 6e 6f 73 69 ind_option("nosi
06e0: 67 6e 22 2c 22 22 2c 30 29 21 3d 30 3b 0a 20 20 gn","",0)!=0;.
06f0: 7a 43 6f 6c 6f 72 20 3d 20 66 69 6e 64 5f 6f 70 zColor = find_op
0700: 74 69 6f 6e 28 22 62 67 63 6f 6c 6f 72 22 2c 22 tion("bgcolor","
0710: 63 22 2c 31 29 3b 0a 20 20 7a 44 61 74 65 4f 76 c",1);. zDateOv
0720: 72 64 20 3d 20 66 69 6e 64 5f 6f 70 74 69 6f 6e rd = find_option
0730: 28 22 64 61 74 65 2d 6f 76 65 72 72 69 64 65 22 ("date-override"
0740: 2c 30 2c 31 29 3b 0a 20 20 7a 55 73 65 72 4f 76 ,0,1);. zUserOv
0750: 72 64 20 3d 20 66 69 6e 64 5f 6f 70 74 69 6f 6e rd = find_option
0760: 28 22 75 73 65 72 2d 6f 76 65 72 72 69 64 65 22 ("user-override"
0770: 2c 30 2c 31 29 3b 0a 20 20 76 65 72 69 66 79 5f ,0,1);. verify_
0780: 61 6c 6c 5f 6f 70 74 69 6f 6e 73 28 29 3b 0a 20 all_options();.
0790: 20 69 66 28 20 67 2e 61 72 67 63 3c 35 20 29 7b if( g.argc<5 ){
07a0: 0a 20 20 20 20 75 73 61 67 65 28 22 6e 65 77 20 . usage("new
07b0: 42 52 41 4e 43 48 2d 4e 41 4d 45 20 43 48 45 43 BRANCH-NAME CHEC
07c0: 4b 2d 49 4e 20 3f 2d 62 67 63 6f 6c 6f 72 20 43 K-IN ?-bgcolor C
07d0: 4f 4c 4f 52 3f 22 29 3b 0a 20 20 7d 0a 20 20 64 OLOR?");. }. d
07e0: 62 5f 66 69 6e 64 5f 61 6e 64 5f 6f 70 65 6e 5f b_find_and_open_
07f0: 72 65 70 6f 73 69 74 6f 72 79 28 30 2c 20 30 29 repository(0, 0)
0800: 3b 20 20 0a 20 20 6e 6f 53 69 67 6e 20 3d 20 64 ; . noSign = d
0810: 62 5f 67 65 74 5f 69 6e 74 28 22 6f 6d 69 74 73 b_get_int("omits
0820: 69 67 6e 22 2c 20 30 29 7c 6e 6f 53 69 67 6e 3b ign", 0)|noSign;
0830: 0a 20 20 0a 20 20 2f 2a 20 66 6f 73 73 69 6c 20 . . /* fossil
0840: 62 72 61 6e 63 68 20 6e 65 77 20 6e 61 6d 65 20 branch new name
0850: 2a 2f 0a 20 20 7a 42 72 61 6e 63 68 20 3d 20 67 */. zBranch = g
0860: 2e 61 72 67 76 5b 33 5d 3b 0a 20 20 69 66 28 20 .argv[3];. if(
0870: 7a 42 72 61 6e 63 68 3d 3d 30 20 7c 7c 20 7a 42 zBranch==0 || zB
0880: 72 61 6e 63 68 5b 30 5d 3d 3d 30 20 29 7b 0a 20 ranch[0]==0 ){.
0890: 20 20 20 66 6f 73 73 69 6c 5f 70 61 6e 69 63 28 fossil_panic(
08a0: 22 62 72 61 6e 63 68 20 6e 61 6d 65 20 63 61 6e "branch name can
08b0: 6e 6f 74 20 62 65 20 65 6d 70 74 79 22 29 3b 0a not be empty");.
08c0: 20 20 7d 0a 20 20 69 66 28 20 64 62 5f 65 78 69 }. if( db_exi
08d0: 73 74 73 28 0a 20 20 20 20 20 20 20 20 22 53 45 sts(. "SE
08e0: 4c 45 43 54 20 31 20 46 52 4f 4d 20 74 61 67 78 LECT 1 FROM tagx
08f0: 72 65 66 22 0a 20 20 20 20 20 20 20 20 22 20 57 ref". " W
0900: 48 45 52 45 20 74 61 67 74 79 70 65 3e 30 22 0a HERE tagtype>0".
0910: 20 20 20 20 20 20 20 20 22 20 20 20 41 4e 44 20 " AND
0920: 74 61 67 69 64 3d 28 53 45 4c 45 43 54 20 74 61 tagid=(SELECT ta
0930: 67 69 64 20 46 52 4f 4d 20 74 61 67 20 57 48 45 gid FROM tag WHE
0940: 52 45 20 74 61 67 6e 61 6d 65 3d 27 73 79 6d 2d RE tagname='sym-
0950: 25 73 27 29 22 2c 0a 20 20 20 20 20 20 20 20 7a %s')",. z
0960: 42 72 61 6e 63 68 29 21 3d 30 20 29 7b 0a 20 20 Branch)!=0 ){.
0970: 20 20 66 6f 73 73 69 6c 5f 66 61 74 61 6c 28 22 fossil_fatal("
0980: 62 72 61 6e 63 68 20 5c 22 25 73 5c 22 20 61 6c branch \"%s\" al
0990: 72 65 61 64 79 20 65 78 69 73 74 73 22 2c 20 7a ready exists", z
09a0: 42 72 61 6e 63 68 29 3b 0a 20 20 7d 0a 0a 20 20 Branch);. }..
09b0: 75 73 65 72 5f 73 65 6c 65 63 74 28 29 3b 0a 20 user_select();.
09c0: 20 64 62 5f 62 65 67 69 6e 5f 74 72 61 6e 73 61 db_begin_transa
09d0: 63 74 69 6f 6e 28 29 3b 0a 20 20 72 6f 6f 74 69 ction();. rooti
09e0: 64 20 3d 20 6e 61 6d 65 5f 74 6f 5f 72 69 64 28 d = name_to_rid(
09f0: 67 2e 61 72 67 76 5b 34 5d 29 3b 0a 20 20 69 66 g.argv[4]);. if
0a00: 28 20 72 6f 6f 74 69 64 3d 3d 30 20 29 7b 0a 20 ( rootid==0 ){.
0a10: 20 20 20 66 6f 73 73 69 6c 5f 66 61 74 61 6c 28 fossil_fatal(
0a20: 22 75 6e 61 62 6c 65 20 74 6f 20 6c 6f 63 61 74 "unable to locat
0a30: 65 20 63 68 65 63 6b 2d 69 6e 20 6f 66 66 20 6f e check-in off o
0a40: 66 20 77 68 69 63 68 20 74 6f 20 62 72 61 6e 63 f which to branc
0a50: 68 22 29 3b 0a 20 20 7d 0a 0a 20 20 70 50 61 72 h");. }.. pPar
0a60: 65 6e 74 20 3d 20 6d 61 6e 69 66 65 73 74 5f 67 ent = manifest_g
0a70: 65 74 28 72 6f 6f 74 69 64 2c 20 43 46 54 59 50 et(rootid, CFTYP
0a80: 45 5f 4d 41 4e 49 46 45 53 54 29 3b 0a 20 20 69 E_MANIFEST);. i
0a90: 66 28 20 70 50 61 72 65 6e 74 3d 3d 30 20 29 7b f( pParent==0 ){
0aa0: 0a 20 20 20 20 66 6f 73 73 69 6c 5f 66 61 74 61 . fossil_fata
0ab0: 6c 28 22 25 73 20 69 73 20 6e 6f 74 20 61 20 76 l("%s is not a v
0ac0: 61 6c 69 64 20 63 68 65 63 6b 2d 69 6e 22 2c 20 alid check-in",
0ad0: 67 2e 61 72 67 76 5b 34 5d 29 3b 0a 20 20 7d 0a g.argv[4]);. }.
0ae0: 0a 20 20 2f 2a 20 43 72 65 61 74 65 20 61 20 6d . /* Create a m
0af0: 61 6e 69 66 65 73 74 20 66 6f 72 20 74 68 65 20 anifest for the
0b00: 6e 65 77 20 62 72 61 6e 63 68 20 2a 2f 0a 20 20 new branch */.
0b10: 62 6c 6f 62 5f 7a 65 72 6f 28 26 62 72 61 6e 63 blob_zero(&branc
0b20: 68 29 3b 0a 20 20 69 66 28 20 70 50 61 72 65 6e h);. if( pParen
0b30: 74 2d 3e 7a 42 61 73 65 6c 69 6e 65 20 29 7b 0a t->zBaseline ){.
0b40: 20 20 20 20 62 6c 6f 62 5f 61 70 70 65 6e 64 66 blob_appendf
0b50: 28 26 62 72 61 6e 63 68 2c 20 22 42 20 25 73 5c (&branch, "B %s\
0b60: 6e 22 2c 20 70 50 61 72 65 6e 74 2d 3e 7a 42 61 n", pParent->zBa
0b70: 73 65 6c 69 6e 65 29 3b 0a 20 20 7d 0a 20 20 7a seline);. }. z
0b80: 43 6f 6d 6d 65 6e 74 20 3d 20 6d 70 72 69 6e 74 Comment = mprint
0b90: 66 28 22 43 72 65 61 74 65 20 6e 65 77 20 62 72 f("Create new br
0ba0: 61 6e 63 68 20 6e 61 6d 65 64 20 5c 22 25 68 5c anch named \"%h\
0bb0: 22 22 2c 20 7a 42 72 61 6e 63 68 29 3b 0a 20 20 "", zBranch);.
0bc0: 62 6c 6f 62 5f 61 70 70 65 6e 64 66 28 26 62 72 blob_appendf(&br
0bd0: 61 6e 63 68 2c 20 22 43 20 25 46 5c 6e 22 2c 20 anch, "C %F\n",
0be0: 7a 43 6f 6d 6d 65 6e 74 29 3b 0a 20 20 7a 44 61 zComment);. zDa
0bf0: 74 65 20 3d 20 64 61 74 65 5f 69 6e 5f 73 74 61 te = date_in_sta
0c00: 6e 64 61 72 64 5f 66 6f 72 6d 61 74 28 7a 44 61 ndard_format(zDa
0c10: 74 65 4f 76 72 64 20 3f 20 7a 44 61 74 65 4f 76 teOvrd ? zDateOv
0c20: 72 64 20 3a 20 22 6e 6f 77 22 29 3b 0a 20 20 62 rd : "now");. b
0c30: 6c 6f 62 5f 61 70 70 65 6e 64 66 28 26 62 72 61 lob_appendf(&bra
0c40: 6e 63 68 2c 20 22 44 20 25 73 5c 6e 22 2c 20 7a nch, "D %s\n", z
0c50: 44 61 74 65 29 3b 0a 0a 20 20 2f 2a 20 43 6f 70 Date);.. /* Cop
0c60: 79 20 61 6c 6c 20 6f 66 20 74 68 65 20 63 6f 6e y all of the con
0c70: 74 65 6e 74 20 66 72 6f 6d 20 74 68 65 20 70 61 tent from the pa
0c80: 72 65 6e 74 20 69 6e 74 6f 20 74 68 65 20 62 72 rent into the br
0c90: 61 6e 63 68 20 2a 2f 0a 20 20 66 6f 72 28 69 3d anch */. for(i=
0ca0: 30 3b 20 69 3c 70 50 61 72 65 6e 74 2d 3e 6e 46 0; i<pParent->nF
0cb0: 69 6c 65 3b 20 2b 2b 69 29 7b 0a 20 20 20 20 62 ile; ++i){. b
0cc0: 6c 6f 62 5f 61 70 70 65 6e 64 66 28 26 62 72 61 lob_appendf(&bra
0cd0: 6e 63 68 2c 20 22 46 20 25 46 22 2c 20 70 50 61 nch, "F %F", pPa
0ce0: 72 65 6e 74 2d 3e 61 46 69 6c 65 5b 69 5d 2e 7a rent->aFile[i].z
0cf0: 4e 61 6d 65 29 3b 0a 20 20 20 20 69 66 28 20 70 Name);. if( p
0d00: 50 61 72 65 6e 74 2d 3e 61 46 69 6c 65 5b 69 5d Parent->aFile[i]
0d10: 2e 7a 55 75 69 64 20 29 7b 0a 20 20 20 20 20 20 .zUuid ){.
0d20: 62 6c 6f 62 5f 61 70 70 65 6e 64 66 28 26 62 72 blob_appendf(&br
0d30: 61 6e 63 68 2c 20 22 20 25 73 22 2c 20 70 50 61 anch, " %s", pPa
0d40: 72 65 6e 74 2d 3e 61 46 69 6c 65 5b 69 5d 2e 7a rent->aFile[i].z
0d50: 55 75 69 64 29 3b 0a 20 20 20 20 20 20 69 66 28 Uuid);. if(
0d60: 20 70 50 61 72 65 6e 74 2d 3e 61 46 69 6c 65 5b pParent->aFile[
0d70: 69 5d 2e 7a 50 65 72 6d 20 26 26 20 70 50 61 72 i].zPerm && pPar
0d80: 65 6e 74 2d 3e 61 46 69 6c 65 5b 69 5d 2e 7a 50 ent->aFile[i].zP
0d90: 65 72 6d 5b 30 5d 20 29 7b 0a 20 20 20 20 20 20 erm[0] ){.
0da0: 20 20 62 6c 6f 62 5f 61 70 70 65 6e 64 66 28 26 blob_appendf(&
0db0: 62 72 61 6e 63 68 2c 20 22 20 25 73 22 2c 20 70 branch, " %s", p
0dc0: 50 61 72 65 6e 74 2d 3e 61 46 69 6c 65 5b 69 5d Parent->aFile[i]
0dd0: 2e 7a 50 65 72 6d 29 3b 0a 20 20 20 20 20 20 7d .zPerm);. }
0de0: 0a 20 20 20 20 7d 0a 20 20 20 20 62 6c 6f 62 5f . }. blob_
0df0: 61 70 70 65 6e 64 28 26 62 72 61 6e 63 68 2c 20 append(&branch,
0e00: 22 5c 6e 22 2c 20 31 29 3b 0a 20 20 7d 0a 20 20 "\n", 1);. }.
0e10: 7a 55 75 69 64 20 3d 20 64 62 5f 74 65 78 74 28 zUuid = db_text(
0e20: 30 2c 20 22 53 45 4c 45 43 54 20 75 75 69 64 20 0, "SELECT uuid
0e30: 46 52 4f 4d 20 62 6c 6f 62 20 57 48 45 52 45 20 FROM blob WHERE
0e40: 72 69 64 3d 25 64 22 2c 20 72 6f 6f 74 69 64 29 rid=%d", rootid)
0e50: 3b 0a 20 20 62 6c 6f 62 5f 61 70 70 65 6e 64 66 ;. blob_appendf
0e60: 28 26 62 72 61 6e 63 68 2c 20 22 50 20 25 73 5c (&branch, "P %s\
0e70: 6e 22 2c 20 7a 55 75 69 64 29 3b 0a 20 20 62 6c n", zUuid);. bl
0e80: 6f 62 5f 61 70 70 65 6e 64 66 28 26 62 72 61 6e ob_appendf(&bran
0e90: 63 68 2c 20 22 52 20 25 73 5c 6e 22 2c 20 70 50 ch, "R %s\n", pP
0ea0: 61 72 65 6e 74 2d 3e 7a 52 65 70 6f 43 6b 73 75 arent->zRepoCksu
0eb0: 6d 29 3b 0a 20 20 6d 61 6e 69 66 65 73 74 5f 64 m);. manifest_d
0ec0: 65 73 74 72 6f 79 28 70 50 61 72 65 6e 74 29 3b estroy(pParent);
0ed0: 0a 0a 20 20 2f 2a 20 41 64 64 20 74 68 65 20 73 .. /* Add the s
0ee0: 79 6d 62 6f 6c 69 63 20 62 72 61 6e 63 68 20 6e ymbolic branch n
0ef0: 61 6d 65 20 61 6e 64 20 74 68 65 20 22 62 72 61 ame and the "bra
0f00: 6e 63 68 22 20 74 61 67 20 74 6f 20 69 64 65 6e nch" tag to iden
0f10: 74 69 66 79 0a 20 20 2a 2a 20 74 68 69 73 20 61 tify. ** this a
0f20: 73 20 61 20 6e 65 77 20 62 72 61 6e 63 68 20 2a s a new branch *
0f30: 2f 0a 20 20 69 66 28 20 7a 43 6f 6c 6f 72 21 3d /. if( zColor!=
0f40: 30 20 29 7b 0a 20 20 20 20 62 6c 6f 62 5f 61 70 0 ){. blob_ap
0f50: 70 65 6e 64 66 28 26 62 72 61 6e 63 68 2c 20 22 pendf(&branch, "
0f60: 54 20 2a 62 67 63 6f 6c 6f 72 20 2a 20 25 46 5c T *bgcolor * %F\
0f70: 6e 22 2c 20 7a 43 6f 6c 6f 72 29 3b 0a 20 20 7d n", zColor);. }
0f80: 0a 20 20 62 6c 6f 62 5f 61 70 70 65 6e 64 66 28 . blob_appendf(
0f90: 26 62 72 61 6e 63 68 2c 20 22 54 20 2a 62 72 61 &branch, "T *bra
0fa0: 6e 63 68 20 2a 20 25 46 5c 6e 22 2c 20 7a 42 72 nch * %F\n", zBr
0fb0: 61 6e 63 68 29 3b 0a 20 20 62 6c 6f 62 5f 61 70 anch);. blob_ap
0fc0: 70 65 6e 64 66 28 26 62 72 61 6e 63 68 2c 20 22 pendf(&branch, "
0fd0: 54 20 2a 73 79 6d 2d 25 46 20 2a 5c 6e 22 2c 20 T *sym-%F *\n",
0fe0: 7a 42 72 61 6e 63 68 29 3b 0a 0a 20 20 2f 2a 20 zBranch);.. /*
0ff0: 43 61 6e 63 65 6c 20 61 6c 6c 20 6f 74 68 65 72 Cancel all other
1000: 20 73 79 6d 62 6f 6c 69 63 20 74 61 67 73 20 2a symbolic tags *
1010: 2f 0a 20 20 64 62 5f 70 72 65 70 61 72 65 28 26 /. db_prepare(&
1020: 71 2c 0a 20 20 20 20 20 20 22 53 45 4c 45 43 54 q,. "SELECT
1030: 20 74 61 67 6e 61 6d 65 20 46 52 4f 4d 20 74 61 tagname FROM ta
1040: 67 78 72 65 66 2c 20 74 61 67 22 0a 20 20 20 20 gxref, tag".
1050: 20 20 22 20 57 48 45 52 45 20 74 61 67 78 72 65 " WHERE tagxre
1060: 66 2e 72 69 64 3d 25 64 20 41 4e 44 20 74 61 67 f.rid=%d AND tag
1070: 78 72 65 66 2e 74 61 67 69 64 3d 74 61 67 2e 74 xref.tagid=tag.t
1080: 61 67 69 64 22 0a 20 20 20 20 20 20 22 20 20 20 agid". "
1090: 41 4e 44 20 74 61 67 74 79 70 65 3e 30 20 41 4e AND tagtype>0 AN
10a0: 44 20 74 61 67 6e 61 6d 65 20 47 4c 4f 42 20 27 D tagname GLOB '
10b0: 73 79 6d 2d 2a 27 22 0a 20 20 20 20 20 20 22 20 sym-*'". "
10c0: 4f 52 44 45 52 20 42 59 20 74 61 67 6e 61 6d 65 ORDER BY tagname
10d0: 22 2c 0a 20 20 20 20 20 20 72 6f 6f 74 69 64 29 ",. rootid)
10e0: 3b 0a 20 20 77 68 69 6c 65 28 20 64 62 5f 73 74 ;. while( db_st
10f0: 65 70 28 26 71 29 3d 3d 53 51 4c 49 54 45 5f 52 ep(&q)==SQLITE_R
1100: 4f 57 20 29 7b 0a 20 20 20 20 63 6f 6e 73 74 20 OW ){. const
1110: 63 68 61 72 20 2a 7a 54 61 67 20 3d 20 64 62 5f char *zTag = db_
1120: 63 6f 6c 75 6d 6e 5f 74 65 78 74 28 26 71 2c 20 column_text(&q,
1130: 30 29 3b 0a 20 20 20 20 62 6c 6f 62 5f 61 70 70 0);. blob_app
1140: 65 6e 64 66 28 26 62 72 61 6e 63 68 2c 20 22 54 endf(&branch, "T
1150: 20 2d 25 46 20 2a 5c 6e 22 2c 20 7a 54 61 67 29 -%F *\n", zTag)
1160: 3b 0a 20 20 7d 0a 20 20 64 62 5f 66 69 6e 61 6c ;. }. db_final
1170: 69 7a 65 28 26 71 29 3b 0a 20 20 0a 20 20 62 6c ize(&q);. . bl
1180: 6f 62 5f 61 70 70 65 6e 64 66 28 26 62 72 61 6e ob_appendf(&bran
1190: 63 68 2c 20 22 55 20 25 46 5c 6e 22 2c 20 7a 55 ch, "U %F\n", zU
11a0: 73 65 72 4f 76 72 64 20 3f 20 7a 55 73 65 72 4f serOvrd ? zUserO
11b0: 76 72 64 20 3a 20 67 2e 7a 4c 6f 67 69 6e 29 3b vrd : g.zLogin);
11c0: 0a 20 20 6d 64 35 73 75 6d 5f 62 6c 6f 62 28 26 . md5sum_blob(&
11d0: 62 72 61 6e 63 68 2c 20 26 6d 63 6b 73 75 6d 29 branch, &mcksum)
11e0: 3b 0a 20 20 62 6c 6f 62 5f 61 70 70 65 6e 64 66 ;. blob_appendf
11f0: 28 26 62 72 61 6e 63 68 2c 20 22 5a 20 25 62 5c (&branch, "Z %b\
1200: 6e 22 2c 20 26 6d 63 6b 73 75 6d 29 3b 0a 20 20 n", &mcksum);.
1210: 69 66 28 20 21 6e 6f 53 69 67 6e 20 26 26 20 63 if( !noSign && c
1220: 6c 65 61 72 73 69 67 6e 28 26 62 72 61 6e 63 68 learsign(&branch
1230: 2c 20 26 62 72 61 6e 63 68 29 20 29 7b 0a 20 20 , &branch) ){.
1240: 20 20 42 6c 6f 62 20 61 6e 73 3b 0a 20 20 20 20 Blob ans;.
1250: 62 6c 6f 62 5f 7a 65 72 6f 28 26 61 6e 73 29 3b blob_zero(&ans);
1260: 0a 20 20 20 20 70 72 6f 6d 70 74 5f 75 73 65 72 . prompt_user
1270: 28 22 75 6e 61 62 6c 65 20 74 6f 20 73 69 67 6e ("unable to sign
1280: 20 6d 61 6e 69 66 65 73 74 2e 20 20 63 6f 6e 74 manifest. cont
1290: 69 6e 75 65 20 28 79 2f 4e 29 3f 20 22 2c 20 26 inue (y/N)? ", &
12a0: 61 6e 73 29 3b 0a 20 20 20 20 69 66 28 20 62 6c ans);. if( bl
12b0: 6f 62 5f 73 74 72 28 26 61 6e 73 29 5b 30 5d 21 ob_str(&ans)[0]!
12c0: 3d 27 79 27 20 29 7b 0a 20 20 20 20 20 20 64 62 ='y' ){. db
12d0: 5f 65 6e 64 5f 74 72 61 6e 73 61 63 74 69 6f 6e _end_transaction
12e0: 28 31 29 3b 0a 20 20 20 20 20 20 66 6f 73 73 69 (1);. fossi
12f0: 6c 5f 65 78 69 74 28 31 29 3b 0a 20 20 20 20 7d l_exit(1);. }
1300: 0a 20 20 7d 0a 0a 20 20 62 72 69 64 20 3d 20 63 . }.. brid = c
1310: 6f 6e 74 65 6e 74 5f 70 75 74 28 26 62 72 61 6e ontent_put(&bran
1320: 63 68 2c 20 30 2c 20 30 2c 20 30 29 3b 0a 20 20 ch, 0, 0, 0);.
1330: 69 66 28 20 62 72 69 64 3d 3d 30 20 29 7b 0a 20 if( brid==0 ){.
1340: 20 20 20 66 6f 73 73 69 6c 5f 70 61 6e 69 63 28 fossil_panic(
1350: 22 74 72 6f 75 62 6c 65 20 63 6f 6d 6d 69 74 74 "trouble committ
1360: 69 6e 67 20 6d 61 6e 69 66 65 73 74 3a 20 25 73 ing manifest: %s
1370: 22 2c 20 67 2e 7a 45 72 72 4d 73 67 29 3b 0a 20 ", g.zErrMsg);.
1380: 20 7d 0a 20 20 64 62 5f 6d 75 6c 74 69 5f 65 78 }. db_multi_ex
1390: 65 63 28 22 49 4e 53 45 52 54 20 4f 52 20 49 47 ec("INSERT OR IG
13a0: 4e 4f 52 45 20 49 4e 54 4f 20 75 6e 73 65 6e 74 NORE INTO unsent
13b0: 20 56 41 4c 55 45 53 28 25 64 29 22 2c 20 62 72 VALUES(%d)", br
13c0: 69 64 29 3b 0a 20 20 69 66 28 20 6d 61 6e 69 66 id);. if( manif
13d0: 65 73 74 5f 63 72 6f 73 73 6c 69 6e 6b 28 62 72 est_crosslink(br
13e0: 69 64 2c 20 26 62 72 61 6e 63 68 29 3d 3d 30 20 id, &branch)==0
13f0: 29 7b 0a 20 20 20 20 66 6f 73 73 69 6c 5f 70 61 ){. fossil_pa
1400: 6e 69 63 28 22 75 6e 61 62 6c 65 20 74 6f 20 69 nic("unable to i
1410: 6e 73 74 61 6c 6c 20 6e 65 77 20 6d 61 6e 69 66 nstall new manif
1420: 65 73 74 22 29 3b 0a 20 20 7d 0a 20 20 63 6f 6e est");. }. con
1430: 74 65 6e 74 5f 64 65 6c 74 69 66 79 28 72 6f 6f tent_deltify(roo
1440: 74 69 64 2c 20 62 72 69 64 2c 20 30 29 3b 0a 20 tid, brid, 0);.
1450: 20 7a 55 75 69 64 20 3d 20 64 62 5f 74 65 78 74 zUuid = db_text
1460: 28 30 2c 20 22 53 45 4c 45 43 54 20 75 75 69 64 (0, "SELECT uuid
1470: 20 46 52 4f 4d 20 62 6c 6f 62 20 57 48 45 52 45 FROM blob WHERE
1480: 20 72 69 64 3d 25 64 22 2c 20 62 72 69 64 29 3b rid=%d", brid);
1490: 0a 20 20 70 72 69 6e 74 66 28 22 4e 65 77 20 62 . printf("New b
14a0: 72 61 6e 63 68 3a 20 25 73 5c 6e 22 2c 20 7a 55 ranch: %s\n", zU
14b0: 75 69 64 29 3b 0a 20 20 69 66 28 20 67 2e 61 72 uid);. if( g.ar
14c0: 67 63 3d 3d 33 20 29 7b 0a 20 20 20 20 70 72 69 gc==3 ){. pri
14d0: 6e 74 66 28 0a 20 20 20 20 20 20 22 5c 6e 22 0a ntf(. "\n".
14e0: 20 20 20 20 20 20 22 4e 6f 74 65 3a 20 74 68 65 "Note: the
14f0: 20 6c 6f 63 61 6c 20 63 68 65 63 6b 2d 6f 75 74 local check-out
1500: 20 68 61 73 20 6e 6f 74 20 62 65 65 6e 20 75 70 has not been up
1510: 64 61 74 65 64 20 74 6f 20 74 68 65 20 6e 65 77 dated to the new
1520: 5c 6e 22 0a 20 20 20 20 20 20 22 20 20 20 20 20 \n". "
1530: 20 62 72 61 6e 63 68 2e 20 20 54 6f 20 62 65 67 branch. To beg
1540: 69 6e 20 77 6f 72 6b 69 6e 67 20 6f 6e 20 74 68 in working on th
1550: 65 20 6e 65 77 20 62 72 61 6e 63 68 2c 20 64 6f e new branch, do
1560: 20 74 68 69 73 3a 5c 6e 22 0a 20 20 20 20 20 20 this:\n".
1570: 22 5c 6e 22 0a 20 20 20 20 20 20 22 20 20 20 20 "\n". "
1580: 20 20 25 73 20 75 70 64 61 74 65 20 25 73 5c 6e %s update %s\n
1590: 22 2c 0a 20 20 20 20 20 20 66 6f 73 73 69 6c 5f ",. fossil_
15a0: 6e 61 6d 65 6f 66 65 78 65 28 29 2c 20 7a 42 72 nameofexe(), zBr
15b0: 61 6e 63 68 0a 20 20 20 20 29 3b 0a 20 20 7d 0a anch. );. }.
15c0: 0a 0a 20 20 2f 2a 20 43 6f 6d 6d 69 74 20 2a 2f .. /* Commit */
15d0: 0a 20 20 64 62 5f 65 6e 64 5f 74 72 61 6e 73 61 . db_end_transa
15e0: 63 74 69 6f 6e 28 30 29 3b 0a 20 20 0a 20 20 2f ction(0);. . /
15f0: 2a 20 44 6f 20 61 6e 20 61 75 74 6f 73 79 6e 63 * Do an autosync
1600: 20 70 75 73 68 2c 20 69 66 20 72 65 71 75 65 73 push, if reques
1610: 74 65 64 20 2a 2f 0a 20 20 61 75 74 6f 73 79 6e ted */. autosyn
1620: 63 28 41 55 54 4f 53 59 4e 43 5f 50 55 53 48 29 c(AUTOSYNC_PUSH)
1630: 3b 0a 7d 0a 0a 2f 2a 0a 2a 2a 20 43 4f 4d 4d 41 ;.}../*.** COMMA
1640: 4e 44 3a 20 62 72 61 6e 63 68 0a 2a 2a 0a 2a 2a ND: branch.**.**
1650: 20 55 73 61 67 65 3a 20 25 66 6f 73 73 69 6c 20 Usage: %fossil
1660: 62 72 61 6e 63 68 20 53 55 42 43 4f 4d 4d 41 4e branch SUBCOMMAN
1670: 44 20 2e 2e 2e 20 3f 2d 52 7c 2d 2d 72 65 70 6f D ... ?-R|--repo
1680: 73 69 74 6f 72 79 20 46 49 4c 45 3f 0a 2a 2a 0a sitory FILE?.**.
1690: 2a 2a 20 52 75 6e 20 76 61 72 69 6f 75 73 20 73 ** Run various s
16a0: 75 62 63 6f 6d 6d 61 6e 64 73 20 74 6f 20 6d 61 ubcommands to ma
16b0: 6e 61 67 65 20 62 72 61 6e 63 68 65 73 20 6f 66 nage branches of
16c0: 20 74 68 65 20 6f 70 65 6e 20 72 65 70 6f 73 69 the open reposi
16d0: 74 6f 72 79 20 6f 72 0a 2a 2a 20 6f 66 20 74 68 tory or.** of th
16e0: 65 20 72 65 70 6f 73 69 74 6f 72 79 20 69 64 65 e repository ide
16f0: 6e 74 69 66 69 65 64 20 62 79 20 74 68 65 20 2d ntified by the -
1700: 52 20 6f 72 20 2d 2d 72 65 70 6f 73 69 74 6f 72 R or --repositor
1710: 79 20 6f 70 74 69 6f 6e 2e 0a 2a 2a 0a 2a 2a 20 y option..**.**
1720: 20 20 20 25 66 6f 73 73 69 6c 20 62 72 61 6e 63 %fossil branc
1730: 68 20 6e 65 77 20 42 52 41 4e 43 48 2d 4e 41 4d h new BRANCH-NAM
1740: 45 20 42 41 53 49 53 20 3f 2d 62 67 63 6f 6c 6f E BASIS ?-bgcolo
1750: 72 20 43 4f 4c 4f 52 3f 20 0a 2a 2a 0a 2a 2a 20 r COLOR? .**.**
1760: 20 20 20 20 20 20 20 43 72 65 61 74 65 20 61 20 Create a
1770: 6e 65 77 20 62 72 61 6e 63 68 20 42 52 41 4e 43 new branch BRANC
1780: 48 2d 4e 41 4d 45 20 6f 66 66 20 6f 66 20 63 68 H-NAME off of ch
1790: 65 63 6b 2d 69 6e 20 42 41 53 49 53 2e 0a 2a 2a eck-in BASIS..**
17a0: 20 20 20 20 20 20 20 20 59 6f 75 20 63 61 6e 20 You can
17b0: 6f 70 74 69 6f 6e 61 6c 6c 79 20 67 69 76 65 20 optionally give
17c0: 74 68 65 20 62 72 61 6e 63 68 20 61 20 64 65 66 the branch a def
17d0: 61 75 6c 74 20 63 6f 6c 6f 72 2e 0a 2a 2a 0a 2a ault color..**.*
17e0: 2a 20 20 20 20 25 66 6f 73 73 69 6c 20 62 72 61 * %fossil bra
17f0: 6e 63 68 20 6c 69 73 74 0a 2a 2a 0a 2a 2a 20 20 nch list.**.**
1800: 20 20 20 20 20 20 4c 69 73 74 20 61 6c 6c 20 62 List all b
1810: 72 61 6e 63 68 65 73 0a 2a 2a 0a 2a 2f 0a 76 6f ranches.**.*/.vo
1820: 69 64 20 62 72 61 6e 63 68 5f 63 6d 64 28 76 6f id branch_cmd(vo
1830: 69 64 29 7b 0a 20 20 69 6e 74 20 6e 3b 0a 20 20 id){. int n;.
1840: 63 6f 6e 73 74 20 63 68 61 72 20 2a 7a 43 6d 64 const char *zCmd
1850: 20 3d 20 22 6c 69 73 74 22 3b 0a 20 20 64 62 5f = "list";. db_
1860: 66 69 6e 64 5f 61 6e 64 5f 6f 70 65 6e 5f 72 65 find_and_open_re
1870: 70 6f 73 69 74 6f 72 79 28 30 2c 20 30 29 3b 0a pository(0, 0);.
1880: 20 20 69 66 28 20 67 2e 61 72 67 63 3c 32 20 29 if( g.argc<2 )
1890: 7b 0a 20 20 20 20 75 73 61 67 65 28 22 6e 65 77 {. usage("new
18a0: 7c 6c 69 73 74 20 2e 2e 2e 22 29 3b 0a 20 20 7d |list ...");. }
18b0: 0a 20 20 69 66 28 20 67 2e 61 72 67 63 3e 3d 33 . if( g.argc>=3
18c0: 20 29 20 7a 43 6d 64 20 3d 20 67 2e 61 72 67 76 ) zCmd = g.argv
18d0: 5b 32 5d 3b 0a 20 20 6e 20 3d 20 73 74 72 6c 65 [2];. n = strle
18e0: 6e 28 7a 43 6d 64 29 3b 0a 20 20 69 66 28 20 73 n(zCmd);. if( s
18f0: 74 72 6e 63 6d 70 28 7a 43 6d 64 2c 22 6e 65 77 trncmp(zCmd,"new
1900: 22 2c 6e 29 3d 3d 30 20 29 7b 0a 20 20 20 20 62 ",n)==0 ){. b
1910: 72 61 6e 63 68 5f 6e 65 77 28 29 3b 0a 20 20 7d ranch_new();. }
1920: 65 6c 73 65 20 69 66 28 20 73 74 72 6e 63 6d 70 else if( strncmp
1930: 28 7a 43 6d 64 2c 22 6c 69 73 74 22 2c 6e 29 3d (zCmd,"list",n)=
1940: 3d 30 20 29 7b 0a 20 20 20 20 53 74 6d 74 20 71 =0 ){. Stmt q
1950: 3b 0a 20 20 20 20 69 6e 74 20 76 69 64 3b 0a 20 ;. int vid;.
1960: 20 20 20 63 68 61 72 20 2a 7a 43 75 72 72 65 6e char *zCurren
1970: 74 20 3d 20 30 3b 0a 0a 20 20 20 20 69 66 28 20 t = 0;.. if(
1980: 67 2e 6c 6f 63 61 6c 4f 70 65 6e 20 29 7b 0a 20 g.localOpen ){.
1990: 20 20 20 20 20 76 69 64 20 3d 20 64 62 5f 6c 67 vid = db_lg
19a0: 65 74 5f 69 6e 74 28 22 63 68 65 63 6b 6f 75 74 et_int("checkout
19b0: 22 2c 20 30 29 3b 0a 20 20 20 20 20 20 7a 43 75 ", 0);. zCu
19c0: 72 72 65 6e 74 20 3d 20 64 62 5f 74 65 78 74 28 rrent = db_text(
19d0: 30 2c 20 22 53 45 4c 45 43 54 20 76 61 6c 75 65 0, "SELECT value
19e0: 20 46 52 4f 4d 20 74 61 67 78 72 65 66 22 0a 20 FROM tagxref".
19f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1a00: 20 20 20 20 20 20 20 20 20 20 20 22 20 57 48 45 " WHE
1a10: 52 45 20 72 69 64 3d 25 64 20 41 4e 44 20 74 61 RE rid=%d AND ta
1a20: 67 69 64 3d 25 64 22 2c 20 76 69 64 2c 20 54 41 gid=%d", vid, TA
1a30: 47 5f 42 52 41 4e 43 48 29 3b 0a 20 20 20 20 7d G_BRANCH);. }
1a40: 0a 20 20 20 20 63 6f 6d 70 75 74 65 5f 6c 65 61 . compute_lea
1a50: 76 65 73 28 30 2c 20 31 29 3b 0a 20 20 20 20 64 ves(0, 1);. d
1a60: 62 5f 70 72 65 70 61 72 65 28 26 71 2c 0a 20 20 b_prepare(&q,.
1a70: 20 20 20 20 22 53 45 4c 45 43 54 20 44 49 53 54 "SELECT DIST
1a80: 49 4e 43 54 20 76 61 6c 75 65 20 46 52 4f 4d 20 INCT value FROM
1a90: 74 61 67 78 72 65 66 22 0a 20 20 20 20 20 20 22 tagxref". "
1aa0: 20 57 48 45 52 45 20 74 61 67 69 64 3d 25 64 20 WHERE tagid=%d
1ab0: 41 4e 44 20 76 61 6c 75 65 20 4e 4f 54 20 4e 55 AND value NOT NU
1ac0: 4c 4c 20 41 4e 44 20 72 69 64 20 49 4e 20 6c 65 LL AND rid IN le
1ad0: 61 76 65 73 22 0a 20 20 20 20 20 20 22 20 4f 52 aves". " OR
1ae0: 44 45 52 20 42 59 20 76 61 6c 75 65 20 2f 2a 73 DER BY value /*s
1af0: 6f 72 74 2a 2f 22 2c 0a 20 20 20 20 20 20 54 41 ort*/",. TA
1b00: 47 5f 42 52 41 4e 43 48 0a 20 20 20 20 29 3b 0a G_BRANCH. );.
1b10: 20 20 20 20 77 68 69 6c 65 28 20 64 62 5f 73 74 while( db_st
1b20: 65 70 28 26 71 29 3d 3d 53 51 4c 49 54 45 5f 52 ep(&q)==SQLITE_R
1b30: 4f 57 20 29 7b 0a 20 20 20 20 20 20 63 6f 6e 73 OW ){. cons
1b40: 74 20 63 68 61 72 20 2a 7a 42 72 20 3d 20 64 62 t char *zBr = db
1b50: 5f 63 6f 6c 75 6d 6e 5f 74 65 78 74 28 26 71 2c _column_text(&q,
1b60: 20 30 29 3b 0a 20 20 20 20 20 20 69 6e 74 20 69 0);. int i
1b70: 73 43 75 72 20 3d 20 7a 43 75 72 72 65 6e 74 21 sCur = zCurrent!
1b80: 3d 30 20 26 26 20 66 6f 73 73 69 6c 5f 73 74 72 =0 && fossil_str
1b90: 63 6d 70 28 7a 43 75 72 72 65 6e 74 2c 7a 42 72 cmp(zCurrent,zBr
1ba0: 29 3d 3d 30 3b 0a 20 20 20 20 20 20 70 72 69 6e )==0;. prin
1bb0: 74 66 28 22 25 73 25 73 5c 6e 22 2c 20 28 69 73 tf("%s%s\n", (is
1bc0: 43 75 72 20 3f 20 22 2a 20 22 20 3a 20 22 20 20 Cur ? "* " : "
1bd0: 22 29 2c 20 7a 42 72 29 3b 0a 20 20 20 20 7d 0a "), zBr);. }.
1be0: 20 20 20 20 64 62 5f 66 69 6e 61 6c 69 7a 65 28 db_finalize(
1bf0: 26 71 29 3b 0a 20 20 7d 65 6c 73 65 7b 0a 20 20 &q);. }else{.
1c00: 20 20 66 6f 73 73 69 6c 5f 70 61 6e 69 63 28 22 fossil_panic("
1c10: 62 72 61 6e 63 68 20 73 75 62 63 6f 6d 6d 61 6e branch subcomman
1c20: 64 20 73 68 6f 75 6c 64 20 62 65 20 6f 6e 65 20 d should be one
1c30: 6f 66 3a 20 22 0a 20 20 20 20 20 20 20 20 20 20 of: ".
1c40: 20 20 20 20 20 20 20 22 6e 65 77 20 6c 69 73 74 "new list
1c50: 22 29 3b 0a 20 20 7d 0a 7d 0a 0a 2f 2a 0a 2a 2a ");. }.}../*.**
1c60: 20 57 45 42 50 41 47 45 3a 20 62 72 6c 69 73 74 WEBPAGE: brlist
1c70: 0a 2a 2a 0a 2a 2a 20 53 68 6f 77 20 61 20 74 69 .**.** Show a ti
1c80: 6d 65 6c 69 6e 65 20 6f 66 20 61 6c 6c 20 62 72 meline of all br
1c90: 61 6e 63 68 65 73 0a 2a 2f 0a 76 6f 69 64 20 62 anches.*/.void b
1ca0: 72 6c 69 73 74 5f 70 61 67 65 28 76 6f 69 64 29 rlist_page(void)
1cb0: 7b 0a 20 20 53 74 6d 74 20 71 3b 0a 20 20 69 6e {. Stmt q;. in
1cc0: 74 20 63 6e 74 3b 0a 20 20 69 6e 74 20 73 68 6f t cnt;. int sho
1cd0: 77 43 6c 6f 73 65 64 20 3d 20 50 28 22 63 6c 6f wClosed = P("clo
1ce0: 73 65 64 22 29 21 3d 30 3b 0a 0a 20 20 6c 6f 67 sed")!=0;.. log
1cf0: 69 6e 5f 63 68 65 63 6b 5f 63 72 65 64 65 6e 74 in_check_credent
1d00: 69 61 6c 73 28 29 3b 0a 20 20 69 66 28 20 21 67 ials();. if( !g
1d10: 2e 6f 6b 52 65 61 64 20 29 7b 20 6c 6f 67 69 6e .okRead ){ login
1d20: 5f 6e 65 65 64 65 64 28 29 3b 20 72 65 74 75 72 _needed(); retur
1d30: 6e 3b 20 7d 0a 0a 20 20 73 74 79 6c 65 5f 68 65 n; }.. style_he
1d40: 61 64 65 72 28 73 68 6f 77 43 6c 6f 73 65 64 20 ader(showClosed
1d50: 3f 20 22 43 6c 6f 73 65 64 20 42 72 61 6e 63 68 ? "Closed Branch
1d60: 65 73 22 20 3a 20 22 4f 70 65 6e 20 42 72 61 6e es" : "Open Bran
1d70: 63 68 65 73 22 29 3b 0a 20 20 73 74 79 6c 65 5f ches");. style_
1d80: 73 75 62 6d 65 6e 75 5f 65 6c 65 6d 65 6e 74 28 submenu_element(
1d90: 22 54 69 6d 65 6c 69 6e 65 22 2c 20 22 54 69 6d "Timeline", "Tim
1da0: 65 6c 69 6e 65 22 2c 20 22 62 72 74 69 6d 65 6c eline", "brtimel
1db0: 69 6e 65 22 29 3b 0a 20 20 69 66 28 20 73 68 6f ine");. if( sho
1dc0: 77 43 6c 6f 73 65 64 20 29 7b 0a 20 20 20 20 73 wClosed ){. s
1dd0: 74 79 6c 65 5f 73 75 62 6d 65 6e 75 5f 65 6c 65 tyle_submenu_ele
1de0: 6d 65 6e 74 28 22 4f 70 65 6e 22 2c 22 4f 70 65 ment("Open","Ope
1df0: 6e 22 2c 22 62 72 6c 69 73 74 22 29 3b 0a 20 20 n","brlist");.
1e00: 7d 65 6c 73 65 7b 0a 20 20 20 20 73 74 79 6c 65 }else{. style
1e10: 5f 73 75 62 6d 65 6e 75 5f 65 6c 65 6d 65 6e 74 _submenu_element
1e20: 28 22 43 6c 6f 73 65 64 22 2c 22 43 6c 6f 73 65 ("Closed","Close
1e30: 64 22 2c 22 62 72 6c 69 73 74 3f 63 6c 6f 73 65 d","brlist?close
1e40: 64 22 29 3b 0a 20 20 7d 0a 20 20 6c 6f 67 69 6e d");. }. login
1e50: 5f 61 6e 6f 6e 79 6d 6f 75 73 5f 61 76 61 69 6c _anonymous_avail
1e60: 61 62 6c 65 28 29 3b 0a 20 20 63 6f 6d 70 75 74 able();. comput
1e70: 65 5f 6c 65 61 76 65 73 28 30 2c 20 31 29 3b 0a e_leaves(0, 1);.
1e80: 20 20 73 74 79 6c 65 5f 73 69 64 65 62 6f 78 5f style_sidebox_
1e90: 62 65 67 69 6e 28 22 4e 6f 6d 65 6e 63 6c 61 74 begin("Nomenclat
1ea0: 75 72 65 3a 22 2c 20 22 33 33 25 22 29 3b 0a 20 ure:", "33%");.
1eb0: 20 40 20 3c 6f 6c 3e 0a 20 20 40 20 3c 6c 69 3e @ <ol>. @ <li>
1ec0: 20 41 6e 20 3c 64 69 76 20 63 6c 61 73 73 3d 22 An <div class="
1ed0: 73 69 64 65 62 6f 78 44 65 73 63 72 69 62 65 64 sideboxDescribed
1ee0: 22 3e 3c 61 20 68 72 65 66 3d 22 62 72 6c 69 73 "><a href="brlis
1ef0: 74 22 3e 0a 20 20 40 20 6f 70 65 6e 20 62 72 61 t">. @ open bra
1f00: 6e 63 68 3c 2f 61 3e 3c 2f 64 69 76 3e 20 69 73 nch</a></div> is
1f10: 20 61 20 62 72 61 6e 63 68 20 74 68 61 74 20 68 a branch that h
1f20: 61 73 20 6f 6e 65 20 6f 72 0a 20 20 40 20 6d 6f as one or. @ mo
1f30: 72 65 20 3c 61 20 68 72 65 66 3d 22 6c 65 61 76 re <a href="leav
1f40: 65 73 22 3e 6f 70 65 6e 20 6c 65 61 76 65 73 2e es">open leaves.
1f50: 3c 2f 61 3e 0a 20 20 40 20 54 68 65 20 70 72 65 </a>. @ The pre
1f60: 73 65 6e 63 65 20 6f 66 20 6f 70 65 6e 20 6c 65 sence of open le
1f70: 61 76 65 73 20 70 72 65 73 75 6d 61 62 6c 79 20 aves presumably
1f80: 6d 65 61 6e 73 0a 20 20 40 20 74 68 61 74 20 74 means. @ that t
1f90: 68 65 20 62 72 61 6e 63 68 20 69 73 20 73 74 69 he branch is sti
1fa0: 6c 6c 20 62 65 69 6e 67 20 65 78 74 65 6e 64 65 ll being extende
1fb0: 64 20 77 69 74 68 20 6e 65 77 20 63 68 65 63 6b d with new check
1fc0: 2d 69 6e 73 2e 3c 2f 6c 69 3e 0a 20 20 40 20 3c -ins.</li>. @ <
1fd0: 6c 69 3e 20 41 20 3c 64 69 76 20 63 6c 61 73 73 li> A <div class
1fe0: 3d 22 73 69 64 65 62 6f 78 44 65 73 63 72 69 62 ="sideboxDescrib
1ff0: 65 64 22 3e 3c 61 20 68 72 65 66 3d 22 62 72 6c ed"><a href="brl
2000: 69 73 74 3f 63 6c 6f 73 65 64 22 3e 0a 20 20 40 ist?closed">. @
2010: 20 63 6c 6f 73 65 64 20 62 72 61 6e 63 68 3c 2f closed branch</
2020: 61 3e 3c 2f 64 69 76 3e 20 69 73 20 61 20 62 72 a></div> is a br
2030: 61 6e 63 68 20 77 69 74 68 20 6f 6e 6c 79 0a 20 anch with only.
2040: 20 40 20 3c 64 69 76 20 63 6c 61 73 73 3d 22 73 @ <div class="s
2050: 69 64 65 62 6f 78 44 65 73 63 72 69 62 65 64 22 ideboxDescribed"
2060: 3e 3c 61 20 68 72 65 66 3d 22 6c 65 61 76 65 73 ><a href="leaves
2070: 3f 63 6c 6f 73 65 64 22 3e 0a 20 20 40 20 63 6c ?closed">. @ cl
2080: 6f 73 65 64 20 6c 65 61 76 65 73 3c 2f 61 3e 3c osed leaves</a><
2090: 2f 64 69 76 3e 2e 0a 20 20 40 20 43 6c 6f 73 65 /div>.. @ Close
20a0: 64 20 62 72 61 6e 63 68 65 73 20 61 72 65 20 66 d branches are f
20b0: 69 78 65 64 20 61 6e 64 20 64 6f 20 6e 6f 74 20 ixed and do not
20c0: 63 68 61 6e 67 65 20 28 75 6e 6c 65 73 73 20 74 change (unless t
20d0: 68 65 79 20 61 72 65 20 66 69 72 73 74 0a 20 20 hey are first.
20e0: 40 20 72 65 6f 70 65 6e 65 64 29 3c 2f 6c 69 3e @ reopened)</li>
20f0: 0a 20 20 40 20 3c 2f 6f 6c 3e 0a 20 20 73 74 79 . @ </ol>. sty
2100: 6c 65 5f 73 69 64 65 62 6f 78 5f 65 6e 64 28 29 le_sidebox_end()
2110: 3b 0a 0a 20 20 63 6e 74 20 3d 20 30 3b 0a 20 20 ;.. cnt = 0;.
2120: 69 66 28 20 21 73 68 6f 77 43 6c 6f 73 65 64 20 if( !showClosed
2130: 29 7b 0a 20 20 20 20 64 62 5f 70 72 65 70 61 72 ){. db_prepar
2140: 65 28 26 71 2c 0a 20 20 20 20 20 20 22 53 45 4c e(&q,. "SEL
2150: 45 43 54 20 44 49 53 54 49 4e 43 54 20 76 61 6c ECT DISTINCT val
2160: 75 65 20 46 52 4f 4d 20 74 61 67 78 72 65 66 22 ue FROM tagxref"
2170: 0a 20 20 20 20 20 20 22 20 57 48 45 52 45 20 74 . " WHERE t
2180: 61 67 69 64 3d 25 64 20 41 4e 44 20 76 61 6c 75 agid=%d AND valu
2190: 65 20 4e 4f 54 20 4e 55 4c 4c 22 0a 20 20 20 20 e NOT NULL".
21a0: 20 20 22 20 20 20 41 4e 44 20 72 69 64 20 49 4e " AND rid IN
21b0: 20 6c 65 61 76 65 73 22 0a 20 20 20 20 20 20 22 leaves". "
21c0: 20 4f 52 44 45 52 20 42 59 20 76 61 6c 75 65 20 ORDER BY value
21d0: 2f 2a 73 6f 72 74 2a 2f 22 2c 0a 20 20 20 20 20 /*sort*/",.
21e0: 20 54 41 47 5f 42 52 41 4e 43 48 0a 20 20 20 20 TAG_BRANCH.
21f0: 29 3b 0a 20 20 7d 65 6c 73 65 7b 0a 20 20 20 20 );. }else{.
2200: 64 62 5f 70 72 65 70 61 72 65 28 26 71 2c 0a 20 db_prepare(&q,.
2210: 20 20 20 20 20 22 53 45 4c 45 43 54 20 76 61 6c "SELECT val
2220: 75 65 20 46 52 4f 4d 20 74 61 67 78 72 65 66 22 ue FROM tagxref"
2230: 0a 20 20 20 20 20 20 22 20 57 48 45 52 45 20 74 . " WHERE t
2240: 61 67 69 64 3d 25 64 20 41 4e 44 20 76 61 6c 75 agid=%d AND valu
2250: 65 20 4e 4f 54 20 4e 55 4c 4c 22 0a 20 20 20 20 e NOT NULL".
2260: 20 20 22 20 45 58 43 45 50 54 20 22 0a 20 20 20 " EXCEPT ".
2270: 20 20 20 22 53 45 4c 45 43 54 20 76 61 6c 75 65 "SELECT value
2280: 20 46 52 4f 4d 20 74 61 67 78 72 65 66 22 0a 20 FROM tagxref".
2290: 20 20 20 20 20 22 20 57 48 45 52 45 20 74 61 67 " WHERE tag
22a0: 69 64 3d 25 64 20 41 4e 44 20 76 61 6c 75 65 20 id=%d AND value
22b0: 4e 4f 54 20 4e 55 4c 4c 22 0a 20 20 20 20 20 20 NOT NULL".
22c0: 22 20 20 20 41 4e 44 20 72 69 64 20 49 4e 20 6c " AND rid IN l
22d0: 65 61 76 65 73 22 0a 20 20 20 20 20 20 22 20 4f eaves". " O
22e0: 52 44 45 52 20 42 59 20 76 61 6c 75 65 20 2f 2a RDER BY value /*
22f0: 73 6f 72 74 2a 2f 22 2c 0a 20 20 20 20 20 20 54 sort*/",. T
2300: 41 47 5f 42 52 41 4e 43 48 2c 20 54 41 47 5f 42 AG_BRANCH, TAG_B
2310: 52 41 4e 43 48 0a 20 20 20 20 29 3b 0a 20 20 7d RANCH. );. }
2320: 0a 20 20 77 68 69 6c 65 28 20 64 62 5f 73 74 65 . while( db_ste
2330: 70 28 26 71 29 3d 3d 53 51 4c 49 54 45 5f 52 4f p(&q)==SQLITE_RO
2340: 57 20 29 7b 0a 20 20 20 20 63 6f 6e 73 74 20 63 W ){. const c
2350: 68 61 72 20 2a 7a 42 72 20 3d 20 64 62 5f 63 6f har *zBr = db_co
2360: 6c 75 6d 6e 5f 74 65 78 74 28 26 71 2c 20 30 29 lumn_text(&q, 0)
2370: 3b 0a 20 20 20 20 69 66 28 20 63 6e 74 3d 3d 30 ;. if( cnt==0
2380: 20 29 7b 0a 20 20 20 20 20 20 69 66 28 20 73 68 ){. if( sh
2390: 6f 77 43 6c 6f 73 65 64 20 29 7b 0a 20 20 20 20 owClosed ){.
23a0: 20 20 20 20 40 20 3c 68 32 3e 43 6c 6f 73 65 64 @ <h2>Closed
23b0: 20 42 72 61 6e 63 68 65 73 3a 3c 2f 68 32 3e 0a Branches:</h2>.
23c0: 20 20 20 20 20 20 7d 65 6c 73 65 7b 0a 20 20 20 }else{.
23d0: 20 20 20 20 20 40 20 3c 68 32 3e 4f 70 65 6e 20 @ <h2>Open
23e0: 42 72 61 6e 63 68 65 73 3a 3c 2f 68 32 3e 0a 20 Branches:</h2>.
23f0: 20 20 20 20 20 7d 0a 20 20 20 20 20 20 40 20 3c }. @ <
2400: 75 6c 3e 0a 20 20 20 20 20 20 63 6e 74 2b 2b 3b ul>. cnt++;
2410: 0a 20 20 20 20 7d 0a 20 20 20 20 69 66 28 20 67 . }. if( g
2420: 2e 6f 6b 48 69 73 74 6f 72 79 20 29 7b 0a 20 20 .okHistory ){.
2430: 20 20 20 20 40 20 3c 6c 69 3e 3c 61 20 68 72 65 @ <li><a hre
2440: 66 3d 22 25 73 28 67 2e 7a 54 6f 70 29 2f 74 69 f="%s(g.zTop)/ti
2450: 6d 65 6c 69 6e 65 3f 72 3d 25 54 28 7a 42 72 29 meline?r=%T(zBr)
2460: 22 3e 25 68 28 7a 42 72 29 3c 2f 61 3e 3c 2f 6c ">%h(zBr)</a></l
2470: 69 3e 0a 20 20 20 20 7d 65 6c 73 65 7b 0a 20 20 i>. }else{.
2480: 20 20 20 20 40 20 3c 6c 69 3e 3c 62 3e 25 68 28 @ <li><b>%h(
2490: 7a 42 72 29 3c 2f 62 3e 3c 2f 6c 69 3e 0a 20 20 zBr)</b></li>.
24a0: 20 20 7d 0a 20 20 7d 0a 20 20 69 66 28 20 63 6e }. }. if( cn
24b0: 74 20 29 7b 0a 20 20 20 20 40 20 3c 2f 75 6c 3e t ){. @ </ul>
24c0: 0a 20 20 7d 0a 20 20 64 62 5f 66 69 6e 61 6c 69 . }. db_finali
24d0: 7a 65 28 26 71 29 3b 0a 20 20 40 20 3c 73 63 72 ze(&q);. @ <scr
24e0: 69 70 74 20 20 74 79 70 65 3d 22 74 65 78 74 2f ipt type="text/
24f0: 4a 61 76 61 53 63 72 69 70 74 22 3e 0a 20 20 40 JavaScript">. @
2500: 20 66 75 6e 63 74 69 6f 6e 20 78 69 6e 28 69 64 function xin(id
2510: 29 7b 0a 20 20 40 20 7d 0a 20 20 40 20 66 75 6e ){. @ }. @ fun
2520: 63 74 69 6f 6e 20 78 6f 75 74 28 69 64 29 7b 0a ction xout(id){.
2530: 20 20 40 20 7d 0a 20 20 40 20 3c 2f 73 63 72 69 @ }. @ </scri
2540: 70 74 3e 0a 20 20 73 74 79 6c 65 5f 66 6f 6f 74 pt>. style_foot
2550: 65 72 28 29 3b 0a 7d 0a 0a 2f 2a 0a 2a 2a 20 54 er();.}../*.** T
2560: 68 69 73 20 72 6f 75 74 69 6e 65 20 69 73 20 63 his routine is c
2570: 61 6c 6c 65 64 20 77 68 69 6c 65 20 66 6f 72 20 alled while for
2580: 65 61 63 68 20 63 68 65 63 6b 2d 69 6e 20 74 68 each check-in th
2590: 61 74 20 69 73 20 72 65 6e 64 65 72 65 64 20 62 at is rendered b
25a0: 79 0a 2a 2a 20 74 68 65 20 74 69 6d 65 6c 69 6e y.** the timelin
25b0: 65 20 6f 66 20 61 20 22 62 72 6c 69 73 74 22 20 e of a "brlist"
25c0: 70 61 67 65 2e 20 20 41 64 64 20 73 6f 6d 65 20 page. Add some
25d0: 61 64 64 69 74 69 6f 6e 61 6c 20 68 79 70 65 72 additional hyper
25e0: 6c 69 6e 6b 73 0a 2a 2a 20 74 6f 20 74 68 65 20 links.** to the
25f0: 65 6e 64 20 6f 66 20 74 68 65 20 6c 69 6e 65 2e end of the line.
2600: 0a 2a 2f 0a 73 74 61 74 69 63 20 76 6f 69 64 20 .*/.static void
2610: 62 72 74 69 6d 65 6c 69 6e 65 5f 65 78 74 72 61 brtimeline_extra
2620: 28 69 6e 74 20 72 69 64 29 7b 0a 20 20 53 74 6d (int rid){. Stm
2630: 74 20 71 3b 0a 20 20 69 66 28 20 21 67 2e 6f 6b t q;. if( !g.ok
2640: 48 69 73 74 6f 72 79 20 29 20 72 65 74 75 72 6e History ) return
2650: 3b 0a 20 20 64 62 5f 70 72 65 70 61 72 65 28 26 ;. db_prepare(&
2660: 71 2c 20 0a 20 20 20 20 22 53 45 4c 45 43 54 20 q, . "SELECT
2670: 73 75 62 73 74 72 28 74 61 67 6e 61 6d 65 2c 35 substr(tagname,5
2680: 29 20 46 52 4f 4d 20 74 61 67 78 72 65 66 2c 20 ) FROM tagxref,
2690: 74 61 67 22 0a 20 20 20 20 22 20 57 48 45 52 45 tag". " WHERE
26a0: 20 74 61 67 78 72 65 66 2e 72 69 64 3d 25 64 22 tagxref.rid=%d"
26b0: 0a 20 20 20 20 22 20 20 20 41 4e 44 20 74 61 67 . " AND tag
26c0: 78 72 65 66 2e 74 61 67 69 64 3d 74 61 67 2e 74 xref.tagid=tag.t
26d0: 61 67 69 64 22 0a 20 20 20 20 22 20 20 20 41 4e agid". " AN
26e0: 44 20 74 61 67 78 72 65 66 2e 74 61 67 74 79 70 D tagxref.tagtyp
26f0: 65 3e 30 22 0a 20 20 20 20 22 20 20 20 41 4e 44 e>0". " AND
2700: 20 74 61 67 2e 74 61 67 6e 61 6d 65 20 47 4c 4f tag.tagname GLO
2710: 42 20 27 73 79 6d 2d 2a 27 22 2c 0a 20 20 20 20 B 'sym-*'",.
2720: 72 69 64 0a 20 20 29 3b 0a 20 20 77 68 69 6c 65 rid. );. while
2730: 28 20 64 62 5f 73 74 65 70 28 26 71 29 3d 3d 53 ( db_step(&q)==S
2740: 51 4c 49 54 45 5f 52 4f 57 20 29 7b 0a 20 20 20 QLITE_ROW ){.
2750: 20 63 6f 6e 73 74 20 63 68 61 72 20 2a 7a 54 61 const char *zTa
2760: 67 4e 61 6d 65 20 3d 20 64 62 5f 63 6f 6c 75 6d gName = db_colum
2770: 6e 5f 74 65 78 74 28 26 71 2c 20 30 29 3b 0a 20 n_text(&q, 0);.
2780: 20 20 20 40 20 3c 61 20 68 72 65 66 3d 22 25 73 @ <a href="%s
2790: 28 67 2e 7a 54 6f 70 29 2f 74 69 6d 65 6c 69 6e (g.zTop)/timelin
27a0: 65 3f 72 3d 25 54 28 7a 54 61 67 4e 61 6d 65 29 e?r=%T(zTagName)
27b0: 22 3e 5b 74 69 6d 65 6c 69 6e 65 5d 3c 2f 61 3e ">[timeline]</a>
27c0: 0a 20 20 7d 0a 20 20 64 62 5f 66 69 6e 61 6c 69 . }. db_finali
27d0: 7a 65 28 26 71 29 3b 0a 7d 0a 0a 2f 2a 0a 2a 2a ze(&q);.}../*.**
27e0: 20 57 45 42 50 41 47 45 3a 20 62 72 74 69 6d 65 WEBPAGE: brtime
27f0: 6c 69 6e 65 0a 2a 2a 0a 2a 2a 20 53 68 6f 77 20 line.**.** Show
2800: 61 20 74 69 6d 65 6c 69 6e 65 20 6f 66 20 61 6c a timeline of al
2810: 6c 20 62 72 61 6e 63 68 65 73 0a 2a 2f 0a 76 6f l branches.*/.vo
2820: 69 64 20 62 72 74 69 6d 65 6c 69 6e 65 5f 70 61 id brtimeline_pa
2830: 67 65 28 76 6f 69 64 29 7b 0a 20 20 53 74 6d 74 ge(void){. Stmt
2840: 20 71 3b 0a 0a 20 20 6c 6f 67 69 6e 5f 63 68 65 q;.. login_che
2850: 63 6b 5f 63 72 65 64 65 6e 74 69 61 6c 73 28 29 ck_credentials()
2860: 3b 0a 20 20 69 66 28 20 21 67 2e 6f 6b 52 65 61 ;. if( !g.okRea
2870: 64 20 29 7b 20 6c 6f 67 69 6e 5f 6e 65 65 64 65 d ){ login_neede
2880: 64 28 29 3b 20 72 65 74 75 72 6e 3b 20 7d 0a 0a d(); return; }..
2890: 20 20 73 74 79 6c 65 5f 68 65 61 64 65 72 28 22 style_header("
28a0: 42 72 61 6e 63 68 65 73 22 29 3b 0a 20 20 73 74 Branches");. st
28b0: 79 6c 65 5f 73 75 62 6d 65 6e 75 5f 65 6c 65 6d yle_submenu_elem
28c0: 65 6e 74 28 22 4c 69 73 74 22 2c 20 22 4c 69 73 ent("List", "Lis
28d0: 74 22 2c 20 22 62 72 6c 69 73 74 22 29 3b 0a 20 t", "brlist");.
28e0: 20 6c 6f 67 69 6e 5f 61 6e 6f 6e 79 6d 6f 75 73 login_anonymous
28f0: 5f 61 76 61 69 6c 61 62 6c 65 28 29 3b 0a 20 20 _available();.
2900: 40 20 3c 68 32 3e 54 68 65 20 69 6e 69 74 69 61 @ <h2>The initia
2910: 6c 20 63 68 65 63 6b 2d 69 6e 20 66 6f 72 20 65 l check-in for e
2920: 61 63 68 20 62 72 61 6e 63 68 3a 3c 2f 68 32 3e ach branch:</h2>
2930: 0a 20 20 64 62 5f 70 72 65 70 61 72 65 28 26 71 . db_prepare(&q
2940: 2c 0a 20 20 20 20 22 25 73 20 41 4e 44 20 62 6c ,. "%s AND bl
2950: 6f 62 2e 72 69 64 20 49 4e 20 28 53 45 4c 45 43 ob.rid IN (SELEC
2960: 54 20 72 69 64 20 46 52 4f 4d 20 74 61 67 78 72 T rid FROM tagxr
2970: 65 66 22 0a 20 20 20 20 22 20 20 20 20 20 20 20 ef". "
2980: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 57 48 WH
2990: 45 52 45 20 74 61 67 74 79 70 65 3e 30 20 41 4e ERE tagtype>0 AN
29a0: 44 20 74 61 67 69 64 3d 25 64 20 41 4e 44 20 73 D tagid=%d AND s
29b0: 72 63 69 64 21 3d 30 29 22 0a 20 20 20 20 22 20 rcid!=0)". "
29c0: 4f 52 44 45 52 20 42 59 20 65 76 65 6e 74 2e 6d ORDER BY event.m
29d0: 74 69 6d 65 20 44 45 53 43 22 2c 0a 20 20 20 20 time DESC",.
29e0: 74 69 6d 65 6c 69 6e 65 5f 71 75 65 72 79 5f 66 timeline_query_f
29f0: 6f 72 5f 77 77 77 28 29 2c 20 54 41 47 5f 42 52 or_www(), TAG_BR
2a00: 41 4e 43 48 0a 20 20 29 3b 0a 20 20 77 77 77 5f ANCH. );. www_
2a10: 70 72 69 6e 74 5f 74 69 6d 65 6c 69 6e 65 28 26 print_timeline(&
2a20: 71 2c 20 30 2c 20 30 2c 20 30 2c 20 62 72 74 69 q, 0, 0, 0, brti
2a30: 6d 65 6c 69 6e 65 5f 65 78 74 72 61 29 3b 0a 20 meline_extra);.
2a40: 20 64 62 5f 66 69 6e 61 6c 69 7a 65 28 26 71 29 db_finalize(&q)
2a50: 3b 0a 20 20 40 20 3c 73 63 72 69 70 74 20 20 74 ;. @ <script t
2a60: 79 70 65 3d 22 74 65 78 74 2f 4a 61 76 61 53 63 ype="text/JavaSc
2a70: 72 69 70 74 22 3e 0a 20 20 40 20 66 75 6e 63 74 ript">. @ funct
2a80: 69 6f 6e 20 78 69 6e 28 69 64 29 7b 0a 20 20 40 ion xin(id){. @
2a90: 20 7d 0a 20 20 40 20 66 75 6e 63 74 69 6f 6e 20 }. @ function
2aa0: 78 6f 75 74 28 69 64 29 7b 0a 20 20 40 20 7d 0a xout(id){. @ }.
2ab0: 20 20 40 20 3c 2f 73 63 72 69 70 74 3e 0a 20 20 @ </script>.
2ac0: 73 74 79 6c 65 5f 66 6f 6f 74 65 72 28 29 3b 0a style_footer();.
2ad0: 7d 0a }.