Hex Artifact Content
Not logged in

Artifact ec276e48522176b4b78c5c05bf69358802b4ce63:

File src/tag.c part of check-in [d1c9938025] - Change behavior of Fossil's tag handling.
  1. All subcommands of command tag prepends a prefix sym- infront of every tag name passed to them. Tags beginning with sym- are special in Fossil as they might serve as replacement of a UUID they are attached to.

    Further, tag list will only list all tags beginning with sym- but with that prefix removed during display as default.

    All subcommands can get passed an option --raw, that prevent the prepending of the prefix sym- in front of the tag name. tag list will report all tags without removing any prefix if called with option --raw.
  1. If a command takes a tag name that may be confused with a UUID, the command did interpret that parameter as a UUID instead as a tag name. Such tags might now be prefixed with a tag: to enforce the command to take them as tag name instead of a UUID. For example:
            fossil tag add abcde $uuid
            :
            fossil update tag:abcde
          
    without the prefix tag: fossil would try to update to a UUID beginning with abcde. If no such UUID was found, fossil will complain and exit.
by cle on 2008-07-27 18:35:06.

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 47 4e 55 20 47 65 6e 65 72 61 6c 20 50 75 62   GNU General Pub
00a0: 6c 69 63 0a 2a 2a 20 4c 69 63 65 6e 73 65 20 76  lic.** License v
00b0: 65 72 73 69 6f 6e 20 32 20 61 73 20 70 75 62 6c  ersion 2 as publ
00c0: 69 73 68 65 64 20 62 79 20 74 68 65 20 46 72 65  ished by the Fre
00d0: 65 20 53 6f 66 74 77 61 72 65 20 46 6f 75 6e 64  e Software Found
00e0: 61 74 69 6f 6e 2e 0a 2a 2a 0a 2a 2a 20 54 68 69  ation..**.** Thi
00f0: 73 20 70 72 6f 67 72 61 6d 20 69 73 20 64 69 73  s program is dis
0100: 74 72 69 62 75 74 65 64 20 69 6e 20 74 68 65 20  tributed in the 
0110: 68 6f 70 65 20 74 68 61 74 20 69 74 20 77 69 6c  hope that it wil
0120: 6c 20 62 65 20 75 73 65 66 75 6c 2c 0a 2a 2a 20  l be useful,.** 
0130: 62 75 74 20 57 49 54 48 4f 55 54 20 41 4e 59 20  but WITHOUT ANY 
0140: 57 41 52 52 41 4e 54 59 3b 20 77 69 74 68 6f 75  WARRANTY; withou
0150: 74 20 65 76 65 6e 20 74 68 65 20 69 6d 70 6c 69  t even the impli
0160: 65 64 20 77 61 72 72 61 6e 74 79 20 6f 66 0a 2a  ed warranty of.*
0170: 2a 20 4d 45 52 43 48 41 4e 54 41 42 49 4c 49 54  * MERCHANTABILIT
0180: 59 20 6f 72 20 46 49 54 4e 45 53 53 20 46 4f 52  Y or FITNESS FOR
0190: 20 41 20 50 41 52 54 49 43 55 4c 41 52 20 50 55   A PARTICULAR PU
01a0: 52 50 4f 53 45 2e 20 20 53 65 65 20 74 68 65 20  RPOSE.  See the 
01b0: 47 4e 55 0a 2a 2a 20 47 65 6e 65 72 61 6c 20 50  GNU.** General P
01c0: 75 62 6c 69 63 20 4c 69 63 65 6e 73 65 20 66 6f  ublic License fo
01d0: 72 20 6d 6f 72 65 20 64 65 74 61 69 6c 73 2e 0a  r more details..
01e0: 2a 2a 20 0a 2a 2a 20 59 6f 75 20 73 68 6f 75 6c  ** .** You shoul
01f0: 64 20 68 61 76 65 20 72 65 63 65 69 76 65 64 20  d have received 
0200: 61 20 63 6f 70 79 20 6f 66 20 74 68 65 20 47 4e  a copy of the GN
0210: 55 20 47 65 6e 65 72 61 6c 20 50 75 62 6c 69 63  U General Public
0220: 0a 2a 2a 20 4c 69 63 65 6e 73 65 20 61 6c 6f 6e  .** License alon
0230: 67 20 77 69 74 68 20 74 68 69 73 20 6c 69 62 72  g with this libr
0240: 61 72 79 3b 20 69 66 20 6e 6f 74 2c 20 77 72 69  ary; if not, wri
0250: 74 65 20 74 6f 20 74 68 65 0a 2a 2a 20 46 72 65  te to the.** Fre
0260: 65 20 53 6f 66 74 77 61 72 65 20 46 6f 75 6e 64  e Software Found
0270: 61 74 69 6f 6e 2c 20 49 6e 63 2e 2c 20 35 39 20  ation, Inc., 59 
0280: 54 65 6d 70 6c 65 20 50 6c 61 63 65 20 2d 20 53  Temple Place - S
0290: 75 69 74 65 20 33 33 30 2c 0a 2a 2a 20 42 6f 73  uite 330,.** Bos
02a0: 74 6f 6e 2c 20 4d 41 20 20 30 32 31 31 31 2d 31  ton, MA  02111-1
02b0: 33 30 37 2c 20 55 53 41 2e 0a 2a 2a 0a 2a 2a 20  307, USA..**.** 
02c0: 41 75 74 68 6f 72 20 63 6f 6e 74 61 63 74 20 69  Author contact i
02d0: 6e 66 6f 72 6d 61 74 69 6f 6e 3a 0a 2a 2a 20 20  nformation:.**  
02e0: 20 64 72 68 40 68 77 61 63 69 2e 63 6f 6d 0a 2a   drh@hwaci.com.*
02f0: 2a 20 20 20 68 74 74 70 3a 2f 2f 77 77 77 2e 68  *   http://www.h
0300: 77 61 63 69 2e 63 6f 6d 2f 64 72 68 2f 0a 2a 2a  waci.com/drh/.**
0310: 0a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a  .***************
0320: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a  ****************
0330: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a  ****************
0340: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a  ****************
0350: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a  ****************
0360: 0a 2a 2a 0a 2a 2a 20 54 68 69 73 20 66 69 6c 65  .**.** This file
0370: 20 63 6f 6e 74 61 69 6e 73 20 63 6f 64 65 20 75   contains code u
0380: 73 65 64 20 74 6f 20 6d 61 6e 61 67 65 20 74 61  sed to manage ta
0390: 67 73 0a 2a 2f 0a 23 69 6e 63 6c 75 64 65 20 22  gs.*/.#include "
03a0: 63 6f 6e 66 69 67 2e 68 22 0a 23 69 6e 63 6c 75  config.h".#inclu
03b0: 64 65 20 22 74 61 67 2e 68 22 0a 23 69 6e 63 6c  de "tag.h".#incl
03c0: 75 64 65 20 3c 61 73 73 65 72 74 2e 68 3e 0a 0a  ude <assert.h>..
03d0: 2f 2a 0a 2a 2a 20 50 72 6f 70 61 67 61 74 65 20  /*.** Propagate 
03e0: 74 68 65 20 74 61 67 20 67 69 76 65 6e 20 62 79  the tag given by
03f0: 20 74 61 67 69 64 20 74 6f 20 74 68 65 20 63 68   tagid to the ch
0400: 69 6c 64 72 65 6e 20 6f 66 20 70 69 64 2e 0a 2a  ildren of pid..*
0410: 2a 0a 2a 2a 20 54 68 69 73 20 72 6f 75 74 69 6e  *.** This routin
0420: 65 20 61 73 73 75 6d 65 73 20 74 68 61 74 20 74  e assumes that t
0430: 61 67 69 64 20 69 73 20 61 20 74 61 67 20 74 68  agid is a tag th
0440: 61 74 20 73 68 6f 75 6c 64 20 62 65 0a 2a 2a 20  at should be.** 
0450: 70 72 6f 70 61 67 61 74 65 64 20 61 6e 64 20 74  propagated and t
0460: 68 61 74 20 74 68 65 20 74 61 67 20 69 73 20 61  hat the tag is a
0470: 6c 72 65 61 64 79 20 70 72 65 73 65 6e 74 20 69  lready present i
0480: 6e 20 70 69 64 2e 0a 2a 2a 0a 2a 2a 20 49 66 20  n pid..**.** If 
0490: 74 61 67 74 79 70 65 20 69 73 20 32 20 74 68 65  tagtype is 2 the
04a0: 6e 20 74 68 65 20 74 61 67 20 69 73 20 62 65 69  n the tag is bei
04b0: 6e 67 20 70 72 6f 70 61 67 61 74 65 64 20 66 72  ng propagated fr
04c0: 6f 6d 20 61 6e 0a 2a 2a 20 61 6e 63 65 73 74 6f  om an.** ancesto
04d0: 72 20 6e 6f 64 65 2e 20 20 49 66 20 74 61 67 74  r node.  If tagt
04e0: 79 70 65 20 69 73 20 30 20 69 74 20 6d 65 61 6e  ype is 0 it mean
04f0: 73 20 61 20 62 72 61 6e 63 68 20 74 61 67 20 69  s a branch tag i
0500: 73 0a 2a 2a 20 62 65 69 6e 67 20 63 61 6e 63 65  s.** being cance
0510: 6c 6c 65 64 2e 0a 2a 2f 0a 76 6f 69 64 20 74 61  lled..*/.void ta
0520: 67 5f 70 72 6f 70 61 67 61 74 65 28 0a 20 20 69  g_propagate(.  i
0530: 6e 74 20 70 69 64 2c 20 20 20 20 20 20 20 20 20  nt pid,         
0540: 20 20 20 20 2f 2a 20 50 72 6f 70 61 67 61 74 65      /* Propagate
0550: 20 74 68 65 20 74 61 67 20 74 6f 20 63 68 69 6c   the tag to chil
0560: 64 72 65 6e 20 6f 66 20 74 68 69 73 20 6e 6f 64  dren of this nod
0570: 65 20 2a 2f 0a 20 20 69 6e 74 20 74 61 67 69 64  e */.  int tagid
0580: 2c 20 20 20 20 20 20 20 20 20 20 20 2f 2a 20 54  ,           /* T
0590: 61 67 20 74 6f 20 70 72 6f 70 61 67 61 74 65 20  ag to propagate 
05a0: 2a 2f 0a 20 20 69 6e 74 20 74 61 67 54 79 70 65  */.  int tagType
05b0: 2c 20 20 20 20 20 20 20 20 20 2f 2a 20 32 20 66  ,         /* 2 f
05c0: 6f 72 20 61 20 70 72 6f 70 61 67 61 74 69 6e 67  or a propagating
05d0: 20 74 61 67 2e 20 20 30 20 66 6f 72 20 61 6e 20   tag.  0 for an 
05e0: 61 6e 74 69 74 61 67 20 2a 2f 0a 20 20 63 6f 6e  antitag */.  con
05f0: 73 74 20 63 68 61 72 20 2a 7a 56 61 6c 75 65 2c  st char *zValue,
0600: 20 20 2f 2a 20 56 61 6c 75 65 20 6f 66 20 74 68    /* Value of th
0610: 65 20 74 61 67 2e 20 20 4d 69 67 68 74 20 62 65  e tag.  Might be
0620: 20 4e 55 4c 4c 20 2a 2f 0a 20 20 64 6f 75 62 6c   NULL */.  doubl
0630: 65 20 6d 74 69 6d 65 20 20 20 20 20 20 20 20 20  e mtime         
0640: 2f 2a 20 54 69 6d 65 73 74 61 6d 70 20 6f 6e 20  /* Timestamp on 
0650: 74 68 65 20 74 61 67 20 2a 2f 0a 29 7b 0a 20 20  the tag */.){.  
0660: 50 51 75 65 75 65 20 71 75 65 75 65 3b 0a 20 20  PQueue queue;.  
0670: 53 74 6d 74 20 73 2c 20 69 6e 73 2c 20 65 76 65  Stmt s, ins, eve
0680: 6e 74 75 70 64 61 74 65 3b 0a 0a 20 20 61 73 73  ntupdate;..  ass
0690: 65 72 74 28 20 74 61 67 54 79 70 65 3d 3d 30 20  ert( tagType==0 
06a0: 7c 7c 20 74 61 67 54 79 70 65 3d 3d 32 20 29 3b  || tagType==2 );
06b0: 0a 20 20 70 71 75 65 75 65 5f 69 6e 69 74 28 26  .  pqueue_init(&
06c0: 71 75 65 75 65 29 3b 0a 20 20 70 71 75 65 75 65  queue);.  pqueue
06d0: 5f 69 6e 73 65 72 74 28 26 71 75 65 75 65 2c 20  _insert(&queue, 
06e0: 70 69 64 2c 20 30 2e 30 29 3b 0a 20 20 64 62 5f  pid, 0.0);.  db_
06f0: 70 72 65 70 61 72 65 28 26 73 2c 20 0a 20 20 20  prepare(&s, .   
0700: 20 20 22 53 45 4c 45 43 54 20 63 69 64 2c 20 70    "SELECT cid, p
0710: 6c 69 6e 6b 2e 6d 74 69 6d 65 2c 22 0a 20 20 20  link.mtime,".   
0720: 20 20 22 20 20 20 20 20 20 20 63 6f 61 6c 65 73    "       coales
0730: 63 65 28 73 72 63 69 64 3d 30 20 41 4e 44 20 74  ce(srcid=0 AND t
0740: 61 67 78 72 65 66 2e 6d 74 69 6d 65 3c 3a 6d 74  agxref.mtime<:mt
0750: 69 6d 65 2c 20 25 64 29 20 41 53 20 64 6f 69 74  ime, %d) AS doit
0760: 22 0a 20 20 20 20 20 22 20 20 46 52 4f 4d 20 70  ".     "  FROM p
0770: 6c 69 6e 6b 20 4c 45 46 54 20 4a 4f 49 4e 20 74  link LEFT JOIN t
0780: 61 67 78 72 65 66 20 4f 4e 20 63 69 64 3d 72 69  agxref ON cid=ri
0790: 64 20 41 4e 44 20 74 61 67 69 64 3d 25 64 22 0a  d AND tagid=%d".
07a0: 20 20 20 20 20 22 20 57 48 45 52 45 20 70 69 64       " WHERE pid
07b0: 3d 3a 70 69 64 20 41 4e 44 20 69 73 70 72 69 6d  =:pid AND isprim
07c0: 22 2c 0a 20 20 20 20 20 74 61 67 54 79 70 65 21  ",.     tagType!
07d0: 3d 30 2c 20 74 61 67 69 64 0a 20 20 29 3b 0a 20  =0, tagid.  );. 
07e0: 20 64 62 5f 62 69 6e 64 5f 64 6f 75 62 6c 65 28   db_bind_double(
07f0: 26 73 2c 20 22 3a 6d 74 69 6d 65 22 2c 20 6d 74  &s, ":mtime", mt
0800: 69 6d 65 29 3b 0a 20 20 69 66 28 20 74 61 67 54  ime);.  if( tagT
0810: 79 70 65 3d 3d 32 20 29 7b 0a 20 20 20 20 64 62  ype==2 ){.    db
0820: 5f 70 72 65 70 61 72 65 28 26 69 6e 73 2c 0a 20  _prepare(&ins,. 
0830: 20 20 20 20 20 20 22 52 45 50 4c 41 43 45 20 49        "REPLACE I
0840: 4e 54 4f 20 74 61 67 78 72 65 66 28 74 61 67 69  NTO tagxref(tagi
0850: 64 2c 20 74 61 67 74 79 70 65 2c 20 73 72 63 69  d, tagtype, srci
0860: 64 2c 20 76 61 6c 75 65 2c 20 6d 74 69 6d 65 2c  d, value, mtime,
0870: 20 72 69 64 29 22 0a 20 20 20 20 20 20 20 22 56   rid)".       "V
0880: 41 4c 55 45 53 28 25 64 2c 32 2c 30 2c 25 51 2c  ALUES(%d,2,0,%Q,
0890: 3a 6d 74 69 6d 65 2c 3a 72 69 64 29 22 2c 0a 20  :mtime,:rid)",. 
08a0: 20 20 20 20 20 20 74 61 67 69 64 2c 20 7a 56 61        tagid, zVa
08b0: 6c 75 65 0a 20 20 20 20 29 3b 0a 20 20 20 20 64  lue.    );.    d
08c0: 62 5f 62 69 6e 64 5f 64 6f 75 62 6c 65 28 26 69  b_bind_double(&i
08d0: 6e 73 2c 20 22 3a 6d 74 69 6d 65 22 2c 20 6d 74  ns, ":mtime", mt
08e0: 69 6d 65 29 3b 0a 20 20 7d 65 6c 73 65 7b 0a 20  ime);.  }else{. 
08f0: 20 20 20 7a 56 61 6c 75 65 20 3d 20 30 3b 0a 20     zValue = 0;. 
0900: 20 20 20 64 62 5f 70 72 65 70 61 72 65 28 26 69     db_prepare(&i
0910: 6e 73 2c 0a 20 20 20 20 20 20 20 22 44 45 4c 45  ns,.       "DELE
0920: 54 45 20 46 52 4f 4d 20 74 61 67 78 72 65 66 20  TE FROM tagxref 
0930: 57 48 45 52 45 20 74 61 67 69 64 3d 25 64 20 41  WHERE tagid=%d A
0940: 4e 44 20 72 69 64 3d 3a 72 69 64 22 2c 20 74 61  ND rid=:rid", ta
0950: 67 69 64 0a 20 20 20 20 29 3b 0a 20 20 7d 0a 20  gid.    );.  }. 
0960: 20 69 66 28 20 74 61 67 69 64 3d 3d 54 41 47 5f   if( tagid==TAG_
0970: 42 47 43 4f 4c 4f 52 20 29 7b 0a 20 20 20 20 64  BGCOLOR ){.    d
0980: 62 5f 70 72 65 70 61 72 65 28 26 65 76 65 6e 74  b_prepare(&event
0990: 75 70 64 61 74 65 2c 0a 20 20 20 20 20 20 22 55  update,.      "U
09a0: 50 44 41 54 45 20 65 76 65 6e 74 20 53 45 54 20  PDATE event SET 
09b0: 62 72 62 67 63 6f 6c 6f 72 3d 25 51 20 57 48 45  brbgcolor=%Q WHE
09c0: 52 45 20 6f 62 6a 69 64 3d 3a 72 69 64 22 2c 20  RE objid=:rid", 
09d0: 7a 56 61 6c 75 65 0a 20 20 20 20 29 3b 0a 20 20  zValue.    );.  
09e0: 7d 0a 20 20 77 68 69 6c 65 28 20 28 70 69 64 20  }.  while( (pid 
09f0: 3d 20 70 71 75 65 75 65 5f 65 78 74 72 61 63 74  = pqueue_extract
0a00: 28 26 71 75 65 75 65 29 29 21 3d 30 20 29 7b 0a  (&queue))!=0 ){.
0a10: 20 20 20 20 64 62 5f 62 69 6e 64 5f 69 6e 74 28      db_bind_int(
0a20: 26 73 2c 20 22 3a 70 69 64 22 2c 20 70 69 64 29  &s, ":pid", pid)
0a30: 3b 0a 20 20 20 20 77 68 69 6c 65 28 20 64 62 5f  ;.    while( db_
0a40: 73 74 65 70 28 26 73 29 3d 3d 53 51 4c 49 54 45  step(&s)==SQLITE
0a50: 5f 52 4f 57 20 29 7b 0a 20 20 20 20 20 20 69 6e  _ROW ){.      in
0a60: 74 20 64 6f 69 74 20 3d 20 64 62 5f 63 6f 6c 75  t doit = db_colu
0a70: 6d 6e 5f 69 6e 74 28 26 73 2c 20 32 29 3b 0a 20  mn_int(&s, 2);. 
0a80: 20 20 20 20 20 69 66 28 20 64 6f 69 74 20 29 7b       if( doit ){
0a90: 0a 20 20 20 20 20 20 20 20 69 6e 74 20 63 69 64  .        int cid
0aa0: 20 3d 20 64 62 5f 63 6f 6c 75 6d 6e 5f 69 6e 74   = db_column_int
0ab0: 28 26 73 2c 20 30 29 3b 0a 20 20 20 20 20 20 20  (&s, 0);.       
0ac0: 20 64 6f 75 62 6c 65 20 6d 74 69 6d 65 20 3d 20   double mtime = 
0ad0: 64 62 5f 63 6f 6c 75 6d 6e 5f 64 6f 75 62 6c 65  db_column_double
0ae0: 28 26 73 2c 20 31 29 3b 0a 20 20 20 20 20 20 20  (&s, 1);.       
0af0: 20 70 71 75 65 75 65 5f 69 6e 73 65 72 74 28 26   pqueue_insert(&
0b00: 71 75 65 75 65 2c 20 63 69 64 2c 20 6d 74 69 6d  queue, cid, mtim
0b10: 65 29 3b 0a 20 20 20 20 20 20 20 20 64 62 5f 62  e);.        db_b
0b20: 69 6e 64 5f 69 6e 74 28 26 69 6e 73 2c 20 22 3a  ind_int(&ins, ":
0b30: 72 69 64 22 2c 20 63 69 64 29 3b 0a 20 20 20 20  rid", cid);.    
0b40: 20 20 20 20 64 62 5f 73 74 65 70 28 26 69 6e 73      db_step(&ins
0b50: 29 3b 0a 20 20 20 20 20 20 20 20 64 62 5f 72 65  );.        db_re
0b60: 73 65 74 28 26 69 6e 73 29 3b 0a 20 20 20 20 20  set(&ins);.     
0b70: 20 20 20 69 66 28 20 74 61 67 69 64 3d 3d 54 41     if( tagid==TA
0b80: 47 5f 42 47 43 4f 4c 4f 52 20 29 7b 0a 20 20 20  G_BGCOLOR ){.   
0b90: 20 20 20 20 20 20 20 64 62 5f 62 69 6e 64 5f 69         db_bind_i
0ba0: 6e 74 28 26 65 76 65 6e 74 75 70 64 61 74 65 2c  nt(&eventupdate,
0bb0: 20 22 3a 72 69 64 22 2c 20 63 69 64 29 3b 0a 20   ":rid", cid);. 
0bc0: 20 20 20 20 20 20 20 20 20 64 62 5f 73 74 65 70           db_step
0bd0: 28 26 65 76 65 6e 74 75 70 64 61 74 65 29 3b 0a  (&eventupdate);.
0be0: 20 20 20 20 20 20 20 20 20 20 64 62 5f 72 65 73            db_res
0bf0: 65 74 28 26 65 76 65 6e 74 75 70 64 61 74 65 29  et(&eventupdate)
0c00: 3b 0a 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20  ;.        }.    
0c10: 20 20 7d 0a 20 20 20 20 7d 0a 20 20 20 20 64 62    }.    }.    db
0c20: 5f 72 65 73 65 74 28 26 73 29 3b 0a 20 20 7d 0a  _reset(&s);.  }.
0c30: 20 20 70 71 75 65 75 65 5f 63 6c 65 61 72 28 26    pqueue_clear(&
0c40: 71 75 65 75 65 29 3b 0a 20 20 64 62 5f 66 69 6e  queue);.  db_fin
0c50: 61 6c 69 7a 65 28 26 69 6e 73 29 3b 0a 20 20 64  alize(&ins);.  d
0c60: 62 5f 66 69 6e 61 6c 69 7a 65 28 26 73 29 3b 0a  b_finalize(&s);.
0c70: 20 20 69 66 28 20 74 61 67 69 64 3d 3d 54 41 47    if( tagid==TAG
0c80: 5f 42 47 43 4f 4c 4f 52 20 29 7b 0a 20 20 20 20  _BGCOLOR ){.    
0c90: 64 62 5f 66 69 6e 61 6c 69 7a 65 28 26 65 76 65  db_finalize(&eve
0ca0: 6e 74 75 70 64 61 74 65 29 3b 0a 20 20 7d 0a 7d  ntupdate);.  }.}
0cb0: 0a 0a 2f 2a 0a 2a 2a 20 50 72 6f 70 61 67 61 74  ../*.** Propagat
0cc0: 65 20 61 6c 6c 20 70 72 6f 70 61 67 61 74 61 62  e all propagatab
0cd0: 6c 65 20 74 61 67 73 20 69 6e 20 70 69 64 20 74  le tags in pid t
0ce0: 6f 20 69 74 73 20 63 68 69 6c 64 72 65 6e 2e 0a  o its children..
0cf0: 2a 2f 0a 76 6f 69 64 20 74 61 67 5f 70 72 6f 70  */.void tag_prop
0d00: 61 67 61 74 65 5f 61 6c 6c 28 69 6e 74 20 70 69  agate_all(int pi
0d10: 64 29 7b 0a 20 20 53 74 6d 74 20 71 3b 0a 20 20  d){.  Stmt q;.  
0d20: 64 62 5f 70 72 65 70 61 72 65 28 26 71 2c 0a 20  db_prepare(&q,. 
0d30: 20 20 20 20 22 53 45 4c 45 43 54 20 74 61 67 69      "SELECT tagi
0d40: 64 2c 20 74 61 67 74 79 70 65 2c 20 6d 74 69 6d  d, tagtype, mtim
0d50: 65 2c 20 76 61 6c 75 65 20 46 52 4f 4d 20 74 61  e, value FROM ta
0d60: 67 78 72 65 66 22 0a 20 20 20 20 20 22 20 57 48  gxref".     " WH
0d70: 45 52 45 20 72 69 64 3d 25 64 22 0a 20 20 20 20  ERE rid=%d".    
0d80: 20 22 20 20 20 41 4e 44 20 28 74 61 67 74 79 70   "   AND (tagtyp
0d90: 65 3d 30 20 4f 52 20 74 61 67 74 79 70 65 3d 32  e=0 OR tagtype=2
0da0: 29 22 2c 0a 20 20 20 20 20 70 69 64 0a 20 20 29  )",.     pid.  )
0db0: 3b 0a 20 20 77 68 69 6c 65 28 20 64 62 5f 73 74  ;.  while( db_st
0dc0: 65 70 28 26 71 29 3d 3d 53 51 4c 49 54 45 5f 52  ep(&q)==SQLITE_R
0dd0: 4f 57 20 29 7b 0a 20 20 20 20 69 6e 74 20 74 61  OW ){.    int ta
0de0: 67 69 64 20 3d 20 64 62 5f 63 6f 6c 75 6d 6e 5f  gid = db_column_
0df0: 69 6e 74 28 26 71 2c 20 30 29 3b 0a 20 20 20 20  int(&q, 0);.    
0e00: 69 6e 74 20 74 61 67 74 79 70 65 20 3d 20 64 62  int tagtype = db
0e10: 5f 63 6f 6c 75 6d 6e 5f 69 6e 74 28 26 71 2c 20  _column_int(&q, 
0e20: 31 29 3b 0a 20 20 20 20 64 6f 75 62 6c 65 20 6d  1);.    double m
0e30: 74 69 6d 65 20 3d 20 64 62 5f 63 6f 6c 75 6d 6e  time = db_column
0e40: 5f 64 6f 75 62 6c 65 28 26 71 2c 20 32 29 3b 0a  _double(&q, 2);.
0e50: 20 20 20 20 63 6f 6e 73 74 20 63 68 61 72 20 2a      const char *
0e60: 7a 56 61 6c 75 65 20 3d 20 64 62 5f 63 6f 6c 75  zValue = db_colu
0e70: 6d 6e 5f 74 65 78 74 28 26 71 2c 20 33 29 3b 0a  mn_text(&q, 3);.
0e80: 20 20 20 20 74 61 67 5f 70 72 6f 70 61 67 61 74      tag_propagat
0e90: 65 28 70 69 64 2c 20 74 61 67 69 64 2c 20 74 61  e(pid, tagid, ta
0ea0: 67 74 79 70 65 2c 20 7a 56 61 6c 75 65 2c 20 6d  gtype, zValue, m
0eb0: 74 69 6d 65 29 3b 0a 20 20 7d 0a 20 20 64 62 5f  time);.  }.  db_
0ec0: 66 69 6e 61 6c 69 7a 65 28 26 71 29 3b 0a 7d 0a  finalize(&q);.}.
0ed0: 0a 2f 2a 0a 2a 2a 20 47 65 74 20 61 20 74 61 67  ./*.** Get a tag
0ee0: 69 64 20 66 6f 72 20 74 68 65 20 67 69 76 65 6e  id for the given
0ef0: 20 54 41 47 2e 20 20 43 72 65 61 74 65 20 61 20   TAG.  Create a 
0f00: 6e 65 77 20 74 61 67 20 69 66 20 6e 65 63 65 73  new tag if neces
0f10: 73 61 72 79 0a 2a 2a 20 69 66 20 63 72 65 61 74  sary.** if creat
0f20: 65 46 6c 61 67 20 69 73 20 31 2e 0a 2a 2f 0a 69  eFlag is 1..*/.i
0f30: 6e 74 20 74 61 67 5f 66 69 6e 64 69 64 28 63 6f  nt tag_findid(co
0f40: 6e 73 74 20 63 68 61 72 20 2a 7a 54 61 67 2c 20  nst char *zTag, 
0f50: 69 6e 74 20 63 72 65 61 74 65 46 6c 61 67 29 7b  int createFlag){
0f60: 0a 20 20 69 6e 74 20 69 64 3b 0a 20 20 69 64 20  .  int id;.  id 
0f70: 3d 20 64 62 5f 69 6e 74 28 30 2c 20 22 53 45 4c  = db_int(0, "SEL
0f80: 45 43 54 20 74 61 67 69 64 20 46 52 4f 4d 20 74  ECT tagid FROM t
0f90: 61 67 20 57 48 45 52 45 20 74 61 67 6e 61 6d 65  ag WHERE tagname
0fa0: 3d 25 51 22 2c 20 7a 54 61 67 29 3b 0a 20 20 69  =%Q", zTag);.  i
0fb0: 66 28 20 69 64 3d 3d 30 20 26 26 20 63 72 65 61  f( id==0 && crea
0fc0: 74 65 46 6c 61 67 20 29 7b 0a 20 20 20 20 64 62  teFlag ){.    db
0fd0: 5f 6d 75 6c 74 69 5f 65 78 65 63 28 22 49 4e 53  _multi_exec("INS
0fe0: 45 52 54 20 49 4e 54 4f 20 74 61 67 28 74 61 67  ERT INTO tag(tag
0ff0: 6e 61 6d 65 29 20 56 41 4c 55 45 53 28 25 51 29  name) VALUES(%Q)
1000: 22 2c 20 7a 54 61 67 29 3b 0a 20 20 20 20 69 64  ", zTag);.    id
1010: 20 3d 20 64 62 5f 6c 61 73 74 5f 69 6e 73 65 72   = db_last_inser
1020: 74 5f 72 6f 77 69 64 28 29 3b 0a 20 20 7d 0a 20  t_rowid();.  }. 
1030: 20 72 65 74 75 72 6e 20 69 64 3b 0a 7d 0a 0a 2f   return id;.}../
1040: 2a 0a 2a 2a 20 49 6e 73 65 72 74 20 61 20 74 61  *.** Insert a ta
1050: 67 20 69 6e 74 6f 20 74 68 65 20 64 61 74 61 62  g into the datab
1060: 61 73 65 2e 0a 2a 2f 0a 76 6f 69 64 20 74 61 67  ase..*/.void tag
1070: 5f 69 6e 73 65 72 74 28 0a 20 20 63 6f 6e 73 74  _insert(.  const
1080: 20 63 68 61 72 20 2a 7a 54 61 67 2c 20 20 20 20   char *zTag,    
1090: 20 20 20 20 2f 2a 20 4e 61 6d 65 20 6f 66 20 74      /* Name of t
10a0: 68 65 20 74 61 67 20 28 77 2f 6f 20 74 68 65 20  he tag (w/o the 
10b0: 22 2b 22 20 6f 72 20 22 2d 22 20 70 72 65 66 69  "+" or "-" prefi
10c0: 78 20 2a 2f 0a 20 20 69 6e 74 20 74 61 67 74 79  x */.  int tagty
10d0: 70 65 2c 20 20 20 20 20 20 20 20 20 20 20 20 20  pe,             
10e0: 2f 2a 20 30 3a 63 61 6e 63 65 6c 20 20 31 3a 73  /* 0:cancel  1:s
10f0: 69 6e 67 6c 65 74 6f 6e 20 20 32 3a 70 72 6f 70  ingleton  2:prop
1100: 61 67 61 74 65 64 20 2a 2f 0a 20 20 63 6f 6e 73  agated */.  cons
1110: 74 20 63 68 61 72 20 2a 7a 56 61 6c 75 65 2c 20  t char *zValue, 
1120: 20 20 20 20 20 2f 2a 20 56 61 6c 75 65 20 69 66       /* Value if
1130: 20 74 68 65 20 74 61 67 20 69 73 20 72 65 61 6c   the tag is real
1140: 6c 79 20 61 20 70 72 6f 70 65 72 74 79 20 2a 2f  ly a property */
1150: 0a 20 20 69 6e 74 20 73 72 63 49 64 2c 20 20 20  .  int srcId,   
1160: 20 20 20 20 20 20 20 20 20 20 20 20 2f 2a 20 41              /* A
1170: 72 74 69 66 61 63 74 20 74 68 61 74 20 63 6f 6e  rtifact that con
1180: 74 61 69 6e 73 20 74 68 69 73 20 74 61 67 20 2a  tains this tag *
1190: 2f 0a 20 20 64 6f 75 62 6c 65 20 6d 74 69 6d 65  /.  double mtime
11a0: 2c 20 20 20 20 20 20 20 20 20 20 20 20 2f 2a 20  ,            /* 
11b0: 54 69 6d 65 73 74 61 6d 70 2e 20 20 55 73 65 20  Timestamp.  Use 
11c0: 64 65 66 61 75 6c 74 20 69 66 20 3c 3d 30 2e 30  default if <=0.0
11d0: 20 2a 2f 0a 20 20 69 6e 74 20 72 69 64 20 20 20   */.  int rid   
11e0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2f                 /
11f0: 2a 20 41 72 74 69 66 61 63 74 20 74 6f 20 77 68  * Artifact to wh
1200: 69 63 68 20 74 68 65 20 74 61 67 20 69 73 20 74  ich the tag is t
1210: 6f 20 61 74 74 61 63 68 65 64 20 2a 2f 0a 29 7b  o attached */.){
1220: 0a 20 20 53 74 6d 74 20 73 3b 0a 20 20 63 6f 6e  .  Stmt s;.  con
1230: 73 74 20 63 68 61 72 20 2a 7a 43 6f 6c 3b 0a 20  st char *zCol;. 
1240: 20 69 6e 74 20 74 61 67 69 64 20 3d 20 74 61 67   int tagid = tag
1250: 5f 66 69 6e 64 69 64 28 7a 54 61 67 2c 20 31 29  _findid(zTag, 1)
1260: 3b 0a 20 20 69 6e 74 20 72 63 3b 0a 0a 20 20 69  ;.  int rc;..  i
1270: 66 28 20 6d 74 69 6d 65 3c 3d 30 2e 30 20 29 7b  f( mtime<=0.0 ){
1280: 0a 20 20 20 20 6d 74 69 6d 65 20 3d 20 64 62 5f  .    mtime = db_
1290: 64 6f 75 62 6c 65 28 30 2e 30 2c 20 22 53 45 4c  double(0.0, "SEL
12a0: 45 43 54 20 6a 75 6c 69 61 6e 64 61 79 28 27 6e  ECT julianday('n
12b0: 6f 77 27 29 22 29 3b 0a 20 20 7d 0a 20 20 64 62  ow')");.  }.  db
12c0: 5f 70 72 65 70 61 72 65 28 26 73 2c 0a 20 20 20  _prepare(&s,.   
12d0: 20 22 53 45 4c 45 43 54 20 31 20 46 52 4f 4d 20   "SELECT 1 FROM 
12e0: 74 61 67 78 72 65 66 22 0a 20 20 20 20 22 20 57  tagxref".    " W
12f0: 48 45 52 45 20 74 61 67 69 64 3d 25 64 22 0a 20  HERE tagid=%d". 
1300: 20 20 20 22 20 20 20 41 4e 44 20 72 69 64 3d 25     "   AND rid=%
1310: 64 22 0a 20 20 20 20 22 20 20 20 41 4e 44 20 6d  d".    "   AND m
1320: 74 69 6d 65 3e 3d 3a 6d 74 69 6d 65 22 2c 0a 20  time>=:mtime",. 
1330: 20 20 20 74 61 67 69 64 2c 20 72 69 64 0a 20 20     tagid, rid.  
1340: 29 3b 0a 20 20 64 62 5f 62 69 6e 64 5f 64 6f 75  );.  db_bind_dou
1350: 62 6c 65 28 26 73 2c 20 22 3a 6d 74 69 6d 65 22  ble(&s, ":mtime"
1360: 2c 20 6d 74 69 6d 65 29 3b 0a 20 20 72 63 20 3d  , mtime);.  rc =
1370: 20 64 62 5f 73 74 65 70 28 26 73 29 3b 0a 20 20   db_step(&s);.  
1380: 64 62 5f 66 69 6e 61 6c 69 7a 65 28 26 73 29 3b  db_finalize(&s);
1390: 0a 20 20 69 66 28 20 72 63 3d 3d 53 51 4c 49 54  .  if( rc==SQLIT
13a0: 45 5f 52 4f 57 20 29 7b 0a 20 20 20 20 2f 2a 20  E_ROW ){.    /* 
13b0: 41 6e 6f 74 68 65 72 20 65 6e 74 72 79 20 74 68  Another entry th
13c0: 69 73 20 69 73 20 6d 6f 72 65 20 72 65 63 65 6e  is is more recen
13d0: 74 20 61 6c 72 65 61 64 79 20 65 78 69 73 74 73  t already exists
13e0: 2e 20 20 44 6f 20 6e 6f 74 68 69 6e 67 20 2a 2f  .  Do nothing */
13f0: 0a 20 20 20 20 72 65 74 75 72 6e 3b 0a 20 20 7d  .    return;.  }
1400: 0a 20 20 64 62 5f 70 72 65 70 61 72 65 28 26 73  .  db_prepare(&s
1410: 2c 20 0a 20 20 20 20 22 52 45 50 4c 41 43 45 20  , .    "REPLACE 
1420: 49 4e 54 4f 20 74 61 67 78 72 65 66 28 74 61 67  INTO tagxref(tag
1430: 69 64 2c 74 61 67 74 79 70 65 2c 73 72 63 49 64  id,tagtype,srcId
1440: 2c 76 61 6c 75 65 2c 6d 74 69 6d 65 2c 72 69 64  ,value,mtime,rid
1450: 29 22 0a 20 20 20 20 22 20 56 41 4c 55 45 53 28  )".    " VALUES(
1460: 25 64 2c 25 64 2c 25 64 2c 25 51 2c 3a 6d 74 69  %d,%d,%d,%Q,:mti
1470: 6d 65 2c 25 64 29 22 2c 0a 20 20 20 20 74 61 67  me,%d)",.    tag
1480: 69 64 2c 20 74 61 67 74 79 70 65 2c 20 73 72 63  id, tagtype, src
1490: 49 64 2c 20 7a 56 61 6c 75 65 2c 20 72 69 64 0a  Id, zValue, rid.
14a0: 20 20 29 3b 0a 20 20 64 62 5f 62 69 6e 64 5f 64    );.  db_bind_d
14b0: 6f 75 62 6c 65 28 26 73 2c 20 22 3a 6d 74 69 6d  ouble(&s, ":mtim
14c0: 65 22 2c 20 6d 74 69 6d 65 29 3b 0a 20 20 64 62  e", mtime);.  db
14d0: 5f 73 74 65 70 28 26 73 29 3b 0a 20 20 64 62 5f  _step(&s);.  db_
14e0: 66 69 6e 61 6c 69 7a 65 28 26 73 29 3b 0a 20 20  finalize(&s);.  
14f0: 69 66 28 20 74 61 67 74 79 70 65 3d 3d 30 20 29  if( tagtype==0 )
1500: 7b 0a 20 20 20 20 7a 56 61 6c 75 65 20 3d 20 30  {.    zValue = 0
1510: 3b 0a 20 20 7d 0a 20 20 7a 43 6f 6c 20 3d 20 30  ;.  }.  zCol = 0
1520: 3b 0a 20 20 73 77 69 74 63 68 28 20 74 61 67 69  ;.  switch( tagi
1530: 64 20 29 7b 0a 20 20 20 20 63 61 73 65 20 54 41  d ){.    case TA
1540: 47 5f 42 47 43 4f 4c 4f 52 3a 20 7b 0a 20 20 20  G_BGCOLOR: {.   
1550: 20 20 20 69 66 28 20 74 61 67 74 79 70 65 3d 3d     if( tagtype==
1560: 31 20 29 7b 0a 20 20 20 20 20 20 20 20 7a 43 6f  1 ){.        zCo
1570: 6c 20 3d 20 22 62 67 63 6f 6c 6f 72 22 3b 0a 20  l = "bgcolor";. 
1580: 20 20 20 20 20 7d 65 6c 73 65 7b 0a 20 20 20 20       }else{.    
1590: 20 20 20 20 7a 43 6f 6c 20 3d 20 22 62 72 62 67      zCol = "brbg
15a0: 63 6f 6c 6f 72 22 3b 0a 20 20 20 20 20 20 7d 0a  color";.      }.
15b0: 20 20 20 20 20 20 62 72 65 61 6b 3b 0a 20 20 20        break;.   
15c0: 20 7d 0a 20 20 20 20 63 61 73 65 20 54 41 47 5f   }.    case TAG_
15d0: 43 4f 4d 4d 45 4e 54 3a 20 7b 0a 20 20 20 20 20  COMMENT: {.     
15e0: 20 7a 43 6f 6c 20 3d 20 22 65 63 6f 6d 6d 65 6e   zCol = "ecommen
15f0: 74 22 3b 0a 20 20 20 20 20 20 62 72 65 61 6b 3b  t";.      break;
1600: 0a 20 20 20 20 7d 0a 20 20 20 20 63 61 73 65 20  .    }.    case 
1610: 54 41 47 5f 55 53 45 52 3a 20 7b 0a 20 20 20 20  TAG_USER: {.    
1620: 20 20 7a 43 6f 6c 20 3d 20 22 65 75 73 65 72 22    zCol = "euser"
1630: 3b 0a 20 20 20 20 20 20 62 72 65 61 6b 3b 0a 20  ;.      break;. 
1640: 20 20 20 7d 0a 20 20 7d 0a 20 20 69 66 28 20 7a     }.  }.  if( z
1650: 43 6f 6c 20 29 7b 0a 20 20 20 20 64 62 5f 6d 75  Col ){.    db_mu
1660: 6c 74 69 5f 65 78 65 63 28 22 55 50 44 41 54 45  lti_exec("UPDATE
1670: 20 65 76 65 6e 74 20 53 45 54 20 25 73 3d 25 51   event SET %s=%Q
1680: 20 57 48 45 52 45 20 6f 62 6a 69 64 3d 25 64 22   WHERE objid=%d"
1690: 2c 20 7a 43 6f 6c 2c 20 7a 56 61 6c 75 65 2c 20  , zCol, zValue, 
16a0: 72 69 64 29 3b 0a 20 20 7d 0a 20 20 69 66 28 20  rid);.  }.  if( 
16b0: 74 61 67 74 79 70 65 3d 3d 30 20 7c 7c 20 74 61  tagtype==0 || ta
16c0: 67 74 79 70 65 3d 3d 32 20 29 7b 0a 20 20 20 20  gtype==2 ){.    
16d0: 74 61 67 5f 70 72 6f 70 61 67 61 74 65 28 72 69  tag_propagate(ri
16e0: 64 2c 20 74 61 67 69 64 2c 20 74 61 67 74 79 70  d, tagid, tagtyp
16f0: 65 2c 20 7a 56 61 6c 75 65 2c 20 6d 74 69 6d 65  e, zValue, mtime
1700: 29 3b 0a 20 20 7d 0a 7d 0a 0a 0a 2f 2a 0a 2a 2a  );.  }.}.../*.**
1710: 20 43 4f 4d 4d 41 4e 44 3a 20 74 65 73 74 2d 74   COMMAND: test-t
1720: 61 67 0a 2a 2a 20 25 66 6f 73 73 69 6c 20 74 65  ag.** %fossil te
1730: 73 74 2d 74 61 67 20 28 2b 7c 2a 7c 2d 29 54 41  st-tag (+|*|-)TA
1740: 47 4e 41 4d 45 20 55 55 49 44 20 3f 56 41 4c 55  GNAME UUID ?VALU
1750: 45 3f 0a 2a 2a 0a 2a 2a 20 41 64 64 20 61 20 74  E?.**.** Add a t
1760: 61 67 20 6f 72 20 61 6e 74 69 2d 74 61 67 20 74  ag or anti-tag t
1770: 6f 20 74 68 65 20 72 65 62 75 69 6c 64 61 62 6c  o the rebuildabl
1780: 65 20 74 61 62 6c 65 73 20 6f 66 20 74 68 65 20  e tables of the 
1790: 6c 6f 63 61 6c 20 72 65 70 6f 73 69 74 6f 72 79  local repository
17a0: 2e 0a 2a 2a 20 4e 6f 20 74 61 67 20 61 72 74 69  ..** No tag arti
17b0: 66 61 63 74 20 69 73 20 63 72 65 61 74 65 64 20  fact is created 
17c0: 73 6f 20 74 68 65 20 6e 65 77 20 74 61 67 20 69  so the new tag i
17d0: 73 20 65 72 61 73 65 64 20 74 68 65 20 6e 65 78  s erased the nex
17e0: 74 0a 2a 2a 20 74 69 6d 65 20 74 68 65 20 72 65  t.** time the re
17f0: 70 6f 73 69 74 6f 72 79 20 69 73 20 72 65 62 75  pository is rebu
1800: 69 6c 74 2e 20 20 54 68 69 73 20 72 6f 75 74 69  ilt.  This routi
1810: 6e 65 20 69 73 20 66 6f 72 20 74 65 73 74 69 6e  ne is for testin
1820: 67 0a 2a 2a 20 75 73 65 20 6f 6e 6c 79 2e 0a 2a  g.** use only..*
1830: 2f 0a 76 6f 69 64 20 74 65 73 74 74 61 67 5f 63  /.void testtag_c
1840: 6d 64 28 76 6f 69 64 29 7b 0a 20 20 63 6f 6e 73  md(void){.  cons
1850: 74 20 63 68 61 72 20 2a 7a 54 61 67 3b 0a 20 20  t char *zTag;.  
1860: 63 6f 6e 73 74 20 63 68 61 72 20 2a 7a 56 61 6c  const char *zVal
1870: 75 65 3b 0a 20 20 69 6e 74 20 72 69 64 3b 0a 20  ue;.  int rid;. 
1880: 20 69 6e 74 20 74 61 67 74 79 70 65 3b 0a 20 20   int tagtype;.  
1890: 64 62 5f 6d 75 73 74 5f 62 65 5f 77 69 74 68 69  db_must_be_withi
18a0: 6e 5f 74 72 65 65 28 29 3b 0a 20 20 69 66 28 20  n_tree();.  if( 
18b0: 67 2e 61 72 67 63 21 3d 34 20 26 26 20 67 2e 61  g.argc!=4 && g.a
18c0: 72 67 63 21 3d 35 20 29 7b 0a 20 20 20 20 75 73  rgc!=5 ){.    us
18d0: 61 67 65 28 22 54 41 47 4e 41 4d 45 20 55 55 49  age("TAGNAME UUI
18e0: 44 20 3f 56 41 4c 55 45 3f 22 29 3b 0a 20 20 7d  D ?VALUE?");.  }
18f0: 0a 20 20 7a 54 61 67 20 3d 20 67 2e 61 72 67 76  .  zTag = g.argv
1900: 5b 32 5d 3b 0a 20 20 73 77 69 74 63 68 28 20 7a  [2];.  switch( z
1910: 54 61 67 5b 30 5d 20 29 7b 0a 20 20 20 20 63 61  Tag[0] ){.    ca
1920: 73 65 20 27 2b 27 3a 20 20 74 61 67 74 79 70 65  se '+':  tagtype
1930: 20 3d 20 31 3b 20 20 62 72 65 61 6b 3b 0a 20 20   = 1;  break;.  
1940: 20 20 63 61 73 65 20 27 2a 27 3a 20 20 74 61 67    case '*':  tag
1950: 74 79 70 65 20 3d 20 32 3b 20 20 62 72 65 61 6b  type = 2;  break
1960: 3b 0a 20 20 20 20 63 61 73 65 20 27 2d 27 3a 20  ;.    case '-': 
1970: 20 74 61 67 74 79 70 65 20 3d 20 30 3b 20 20 62   tagtype = 0;  b
1980: 72 65 61 6b 3b 0a 20 20 20 20 64 65 66 61 75 6c  reak;.    defaul
1990: 74 3a 20 20 20 0a 20 20 20 20 20 20 66 6f 73 73  t:   .      foss
19a0: 69 6c 5f 66 61 74 61 6c 28 22 74 61 67 20 73 68  il_fatal("tag sh
19b0: 6f 75 6c 64 20 62 65 67 69 6e 20 77 69 74 68 20  ould begin with 
19c0: 27 2b 27 2c 20 27 2a 27 2c 20 6f 72 20 27 2d 27  '+', '*', or '-'
19d0: 22 29 3b 0a 20 20 20 20 20 20 72 65 74 75 72 6e  ");.      return
19e0: 3b 0a 20 20 7d 0a 20 20 72 69 64 20 3d 20 6e 61  ;.  }.  rid = na
19f0: 6d 65 5f 74 6f 5f 72 69 64 28 67 2e 61 72 67 76  me_to_rid(g.argv
1a00: 5b 33 5d 29 3b 0a 20 20 69 66 28 20 72 69 64 3d  [3]);.  if( rid=
1a10: 3d 30 20 29 7b 0a 20 20 20 20 66 6f 73 73 69 6c  =0 ){.    fossil
1a20: 5f 66 61 74 61 6c 28 22 6e 6f 20 73 75 63 68 20  _fatal("no such 
1a30: 6f 62 6a 65 63 74 3a 20 25 73 22 2c 20 67 2e 61  object: %s", g.a
1a40: 72 67 76 5b 33 5d 29 3b 0a 20 20 7d 0a 20 20 7a  rgv[3]);.  }.  z
1a50: 56 61 6c 75 65 20 3d 20 67 2e 61 72 67 63 3d 3d  Value = g.argc==
1a60: 35 20 3f 20 67 2e 61 72 67 76 5b 34 5d 20 3a 20  5 ? g.argv[4] : 
1a70: 30 3b 0a 20 20 64 62 5f 62 65 67 69 6e 5f 74 72  0;.  db_begin_tr
1a80: 61 6e 73 61 63 74 69 6f 6e 28 29 3b 0a 20 20 74  ansaction();.  t
1a90: 61 67 5f 69 6e 73 65 72 74 28 7a 54 61 67 2c 20  ag_insert(zTag, 
1aa0: 74 61 67 74 79 70 65 2c 20 7a 56 61 6c 75 65 2c  tagtype, zValue,
1ab0: 20 2d 31 2c 20 30 2e 30 2c 20 72 69 64 29 3b 0a   -1, 0.0, rid);.
1ac0: 20 20 64 62 5f 65 6e 64 5f 74 72 61 6e 73 61 63    db_end_transac
1ad0: 74 69 6f 6e 28 30 29 3b 20 0a 7d 0a 0a 2f 2a 0a  tion(0); .}../*.
1ae0: 2a 2a 20 41 64 64 20 61 20 63 6f 6e 74 72 6f 6c  ** Add a control
1af0: 20 72 65 63 6f 72 64 20 74 6f 20 74 68 65 20 72   record to the r
1b00: 65 70 6f 73 69 74 6f 72 79 20 74 68 61 74 20 65  epository that e
1b10: 69 74 68 65 72 20 63 72 65 61 74 65 73 0a 2a 2a  ither creates.**
1b20: 20 6f 72 20 63 61 6e 63 65 6c 73 20 61 20 74 61   or cancels a ta
1b30: 67 2e 0a 2a 2f 0a 73 74 61 74 69 63 20 76 6f 69  g..*/.static voi
1b40: 64 20 74 61 67 5f 61 64 64 5f 61 72 74 69 66 61  d tag_add_artifa
1b50: 63 74 28 0a 20 20 63 6f 6e 73 74 20 63 68 61 72  ct(.  const char
1b60: 20 2a 7a 54 61 67 6e 61 6d 65 2c 20 20 20 20 20   *zTagname,     
1b70: 20 20 2f 2a 20 54 68 65 20 74 61 67 20 74 6f 20    /* The tag to 
1b80: 61 64 64 20 6f 72 20 63 61 6e 63 65 6c 20 2a 2f  add or cancel */
1b90: 0a 20 20 63 6f 6e 73 74 20 63 68 61 72 20 2a 7a  .  const char *z
1ba0: 4f 62 6a 4e 61 6d 65 2c 20 20 20 20 20 20 20 2f  ObjName,       /
1bb0: 2a 20 4e 61 6d 65 20 6f 66 20 6f 62 6a 65 63 74  * Name of object
1bc0: 20 61 74 74 61 63 68 65 64 20 74 6f 20 2a 2f 0a   attached to */.
1bd0: 20 20 63 6f 6e 73 74 20 63 68 61 72 20 2a 7a 56    const char *zV
1be0: 61 6c 75 65 2c 20 20 20 20 20 20 20 20 20 2f 2a  alue,         /*
1bf0: 20 56 61 6c 75 65 20 66 6f 72 20 74 68 65 20 74   Value for the t
1c00: 61 67 2e 20 20 4d 69 67 68 74 20 62 65 20 4e 55  ag.  Might be NU
1c10: 4c 4c 20 2a 2f 0a 20 20 69 6e 74 20 74 61 67 74  LL */.  int tagt
1c20: 79 70 65 20 20 20 20 20 20 20 20 20 20 20 20 20  ype             
1c30: 20 20 20 20 2f 2a 20 30 3a 63 61 6e 63 65 6c 20      /* 0:cancel 
1c40: 31 3a 73 69 6e 67 6c 65 74 6f 6e 20 32 3a 70 72  1:singleton 2:pr
1c50: 6f 70 61 67 61 74 65 64 20 2a 2f 0a 29 7b 0a 20  opagated */.){. 
1c60: 20 69 6e 74 20 72 69 64 3b 0a 20 20 69 6e 74 20   int rid;.  int 
1c70: 6e 72 69 64 3b 0a 20 20 63 68 61 72 20 2a 7a 44  nrid;.  char *zD
1c80: 61 74 65 3b 0a 20 20 42 6c 6f 62 20 75 75 69 64  ate;.  Blob uuid
1c90: 3b 0a 20 20 42 6c 6f 62 20 63 74 72 6c 3b 0a 20  ;.  Blob ctrl;. 
1ca0: 20 42 6c 6f 62 20 63 6b 73 75 6d 3b 0a 20 20 73   Blob cksum;.  s
1cb0: 74 61 74 69 63 20 63 6f 6e 73 74 20 63 68 61 72  tatic const char
1cc0: 20 7a 54 61 67 74 79 70 65 5b 5d 20 3d 20 7b 20   zTagtype[] = { 
1cd0: 27 2d 27 2c 20 27 2b 27 2c 20 27 2a 27 20 7d 3b  '-', '+', '*' };
1ce0: 0a 0a 20 20 61 73 73 65 72 74 28 20 74 61 67 74  ..  assert( tagt
1cf0: 79 70 65 3e 3d 30 20 26 26 20 74 61 67 74 79 70  ype>=0 && tagtyp
1d00: 65 3c 3d 32 20 29 3b 0a 20 20 75 73 65 72 5f 73  e<=2 );.  user_s
1d10: 65 6c 65 63 74 28 29 3b 0a 20 20 62 6c 6f 62 5f  elect();.  blob_
1d20: 7a 65 72 6f 28 26 75 75 69 64 29 3b 0a 20 20 62  zero(&uuid);.  b
1d30: 6c 6f 62 5f 61 70 70 65 6e 64 28 26 75 75 69 64  lob_append(&uuid
1d40: 2c 20 7a 4f 62 6a 4e 61 6d 65 2c 20 2d 31 29 3b  , zObjName, -1);
1d50: 0a 20 20 69 66 28 20 6e 61 6d 65 5f 74 6f 5f 75  .  if( name_to_u
1d60: 75 69 64 28 26 75 75 69 64 2c 20 39 29 20 29 7b  uid(&uuid, 9) ){
1d70: 0a 20 20 20 20 72 65 74 75 72 6e 3b 0a 20 20 7d  .    return;.  }
1d80: 0a 20 20 72 69 64 20 3d 20 6e 61 6d 65 5f 74 6f  .  rid = name_to
1d90: 5f 72 69 64 28 62 6c 6f 62 5f 73 74 72 28 26 75  _rid(blob_str(&u
1da0: 75 69 64 29 29 3b 0a 20 20 62 6c 6f 62 5f 7a 65  uid));.  blob_ze
1db0: 72 6f 28 26 63 74 72 6c 29 3b 0a 0a 20 20 69 66  ro(&ctrl);..  if
1dc0: 28 20 76 61 6c 69 64 61 74 65 31 36 28 7a 54 61  ( validate16(zTa
1dd0: 67 6e 61 6d 65 2c 20 73 74 72 6c 65 6e 28 7a 54  gname, strlen(zT
1de0: 61 67 6e 61 6d 65 29 29 20 29 7b 0a 20 20 20 20  agname)) ){.    
1df0: 66 6f 73 73 69 6c 5f 66 61 74 61 6c 28 22 69 6e  fossil_fatal("in
1e00: 76 61 6c 69 64 20 74 61 67 20 6e 61 6d 65 20 5c  valid tag name \
1e10: 22 25 73 5c 22 20 2d 20 6d 69 67 68 74 20 62 65  "%s\" - might be
1e20: 20 63 6f 6e 66 75 73 65 64 20 77 69 74 68 20 61   confused with a
1e30: 20 55 55 49 44 22 2c 0a 20 20 20 20 20 20 20 20   UUID",.        
1e40: 20 20 20 20 20 20 20 20 20 7a 54 61 67 6e 61 6d           zTagnam
1e50: 65 29 3b 0a 20 20 7d 0a 20 20 7a 44 61 74 65 20  e);.  }.  zDate 
1e60: 3d 20 64 62 5f 74 65 78 74 28 30 2c 20 22 53 45  = db_text(0, "SE
1e70: 4c 45 43 54 20 64 61 74 65 74 69 6d 65 28 27 6e  LECT datetime('n
1e80: 6f 77 27 29 22 29 3b 0a 20 20 7a 44 61 74 65 5b  ow')");.  zDate[
1e90: 31 30 5d 20 3d 20 27 54 27 3b 0a 20 20 62 6c 6f  10] = 'T';.  blo
1ea0: 62 5f 61 70 70 65 6e 64 66 28 26 63 74 72 6c 2c  b_appendf(&ctrl,
1eb0: 20 22 44 20 25 73 5c 6e 22 2c 20 7a 44 61 74 65   "D %s\n", zDate
1ec0: 29 3b 0a 20 20 62 6c 6f 62 5f 61 70 70 65 6e 64  );.  blob_append
1ed0: 66 28 26 63 74 72 6c 2c 20 22 54 20 25 63 25 46  f(&ctrl, "T %c%F
1ee0: 20 25 62 22 2c 20 7a 54 61 67 74 79 70 65 5b 74   %b", zTagtype[t
1ef0: 61 67 74 79 70 65 5d 2c 20 7a 54 61 67 6e 61 6d  agtype], zTagnam
1f00: 65 2c 20 26 75 75 69 64 29 3b 0a 20 20 69 66 28  e, &uuid);.  if(
1f10: 20 74 61 67 74 79 70 65 20 26 26 20 7a 56 61 6c   tagtype && zVal
1f20: 75 65 20 26 26 20 7a 56 61 6c 75 65 5b 30 5d 20  ue && zValue[0] 
1f30: 29 7b 0a 20 20 20 20 62 6c 6f 62 5f 61 70 70 65  ){.    blob_appe
1f40: 6e 64 66 28 26 63 74 72 6c 2c 20 22 20 25 46 5c  ndf(&ctrl, " %F\
1f50: 6e 22 2c 20 7a 56 61 6c 75 65 29 3b 0a 20 20 7d  n", zValue);.  }
1f60: 65 6c 73 65 7b 0a 20 20 20 20 62 6c 6f 62 5f 61  else{.    blob_a
1f70: 70 70 65 6e 64 66 28 26 63 74 72 6c 2c 20 22 5c  ppendf(&ctrl, "\
1f80: 6e 22 29 3b 0a 20 20 7d 0a 20 20 62 6c 6f 62 5f  n");.  }.  blob_
1f90: 61 70 70 65 6e 64 66 28 26 63 74 72 6c 2c 20 22  appendf(&ctrl, "
1fa0: 55 20 25 46 5c 6e 22 2c 20 67 2e 7a 4c 6f 67 69  U %F\n", g.zLogi
1fb0: 6e 29 3b 0a 20 20 6d 64 35 73 75 6d 5f 62 6c 6f  n);.  md5sum_blo
1fc0: 62 28 26 63 74 72 6c 2c 20 26 63 6b 73 75 6d 29  b(&ctrl, &cksum)
1fd0: 3b 0a 20 20 62 6c 6f 62 5f 61 70 70 65 6e 64 66  ;.  blob_appendf
1fe0: 28 26 63 74 72 6c 2c 20 22 5a 20 25 62 5c 6e 22  (&ctrl, "Z %b\n"
1ff0: 2c 20 26 63 6b 73 75 6d 29 3b 0a 20 20 64 62 5f  , &cksum);.  db_
2000: 62 65 67 69 6e 5f 74 72 61 6e 73 61 63 74 69 6f  begin_transactio
2010: 6e 28 29 3b 0a 20 20 6e 72 69 64 20 3d 20 63 6f  n();.  nrid = co
2020: 6e 74 65 6e 74 5f 70 75 74 28 26 63 74 72 6c 2c  ntent_put(&ctrl,
2030: 20 30 2c 20 30 29 3b 0a 20 20 6d 61 6e 69 66 65   0, 0);.  manife
2040: 73 74 5f 63 72 6f 73 73 6c 69 6e 6b 28 6e 72 69  st_crosslink(nri
2050: 64 2c 20 26 63 74 72 6c 29 3b 0a 20 20 64 62 5f  d, &ctrl);.  db_
2060: 65 6e 64 5f 74 72 61 6e 73 61 63 74 69 6f 6e 28  end_transaction(
2070: 30 29 3b 0a 20 20 0a 20 20 2f 2a 20 44 6f 20 61  0);.  .  /* Do a
2080: 6e 20 61 75 74 6f 73 79 6e 63 20 70 75 73 68 20  n autosync push 
2090: 69 66 20 72 65 71 75 65 73 74 65 64 20 2a 2f 0a  if requested */.
20a0: 20 20 61 75 74 6f 73 79 6e 63 28 41 55 54 4f 53    autosync(AUTOS
20b0: 59 4e 43 5f 50 55 53 48 29 3b 0a 7d 0a 0a 2f 2a  YNC_PUSH);.}../*
20c0: 0a 2a 2a 20 43 4f 4d 4d 41 4e 44 3a 20 74 61 67  .** COMMAND: tag
20d0: 0a 2a 2a 20 55 73 61 67 65 3a 20 25 66 6f 73 73  .** Usage: %foss
20e0: 69 6c 20 74 61 67 20 53 55 42 43 4f 4d 4d 41 4e  il tag SUBCOMMAN
20f0: 44 20 2e 2e 2e 0a 2a 2a 0a 2a 2a 20 52 75 6e 20  D ....**.** Run 
2100: 76 61 72 69 6f 75 73 20 73 75 62 63 6f 6d 6d 61  various subcomma
2110: 6e 64 73 20 74 6f 20 63 6f 6e 74 72 6f 6c 20 74  nds to control t
2120: 61 67 73 20 61 6e 64 20 70 72 6f 70 65 72 74 69  ags and properti
2130: 65 73 0a 2a 2a 0a 2a 2a 20 20 20 20 20 25 66 6f  es.**.**     %fo
2140: 73 73 69 6c 20 74 61 67 20 61 64 64 20 3f 2d 2d  ssil tag add ?--
2150: 72 61 77 3f 20 54 41 47 4e 41 4d 45 20 55 55 49  raw? TAGNAME UUI
2160: 44 20 3f 56 41 4c 55 45 3f 0a 2a 2a 0a 2a 2a 20  D ?VALUE?.**.** 
2170: 20 20 20 20 20 20 20 20 41 64 64 20 61 20 6e 65          Add a ne
2180: 77 20 74 61 67 20 6f 72 20 70 72 6f 70 65 72 74  w tag or propert
2190: 79 20 74 6f 20 55 55 49 44 2e 20 54 68 65 20 74  y to UUID. The t
21a0: 61 67 20 77 69 6c 6c 0a 2a 2a 20 20 20 20 20 20  ag will.**      
21b0: 20 20 20 62 65 20 75 73 61 62 6c 65 20 69 6e 73     be usable ins
21c0: 74 65 61 64 20 6f 66 20 61 20 55 55 49 44 20 69  tead of a UUID i
21d0: 6e 20 63 6f 6d 6d 61 6e 64 73 20 6c 69 6b 65 0a  n commands like.
21e0: 2a 2a 20 20 20 20 20 20 20 20 20 75 70 64 61 74  **         updat
21f0: 65 20 61 6e 64 20 74 68 65 20 6c 69 6b 65 2e 0a  e and the like..
2200: 2a 2a 0a 2a 2a 20 20 20 20 20 25 66 6f 73 73 69  **.**     %fossi
2210: 6c 20 74 61 67 20 62 72 61 6e 63 68 20 3f 2d 2d  l tag branch ?--
2220: 72 61 77 3f 20 54 41 47 4e 41 4d 45 20 55 55 49  raw? TAGNAME UUI
2230: 44 20 3f 56 41 4c 55 45 3f 0a 2a 2a 0a 2a 2a 20  D ?VALUE?.**.** 
2240: 20 20 20 20 20 20 20 20 41 64 64 20 61 20 6e 65          Add a ne
2250: 77 20 74 61 67 20 6f 72 20 70 72 6f 70 65 72 74  w tag or propert
2260: 79 20 74 6f 20 55 55 49 44 20 61 6e 64 20 6d 61  y to UUID and ma
2270: 6b 65 20 74 68 61 74 0a 2a 2a 20 20 20 20 20 20  ke that.**      
2280: 20 20 20 74 61 67 20 70 72 6f 70 61 67 61 74 65     tag propagate
2290: 20 74 6f 20 61 6c 6c 20 64 69 72 65 63 74 20 63   to all direct c
22a0: 68 69 6c 64 72 65 6e 2e 0a 2a 2a 0a 2a 2a 20 20  hildren..**.**  
22b0: 20 20 20 25 66 6f 73 73 69 6c 20 74 61 67 20 64     %fossil tag d
22c0: 65 6c 65 74 65 20 3f 2d 2d 72 61 77 3f 20 54 41  elete ?--raw? TA
22d0: 47 4e 41 4d 45 20 55 55 49 44 0a 2a 2a 0a 2a 2a  GNAME UUID.**.**
22e0: 20 20 20 20 20 20 20 20 20 44 65 6c 65 74 65 20           Delete 
22f0: 74 68 65 20 74 61 67 20 54 41 47 4e 41 4d 45 20  the tag TAGNAME 
2300: 66 72 6f 6d 20 55 55 49 44 0a 2a 2a 0a 2a 2a 20  from UUID.**.** 
2310: 20 20 20 20 25 66 6f 73 73 69 6c 20 74 61 67 20      %fossil tag 
2320: 66 69 6e 64 20 3f 2d 2d 72 61 77 3f 20 54 41 47  find ?--raw? TAG
2330: 4e 41 4d 45 0a 2a 2a 0a 2a 2a 20 20 20 20 20 20  NAME.**.**      
2340: 20 20 20 4c 69 73 74 20 61 6c 6c 20 62 61 73 65     List all base
2350: 6c 69 6e 65 73 20 74 68 61 74 20 75 73 65 20 54  lines that use T
2360: 41 47 4e 41 4d 45 0a 2a 2a 0a 2a 2a 20 20 20 20  AGNAME.**.**    
2370: 20 25 66 6f 73 73 69 6c 20 74 61 67 20 6c 69 73   %fossil tag lis
2380: 74 20 3f 2d 2d 72 61 77 3f 20 3f 55 55 49 44 3f  t ?--raw? ?UUID?
2390: 0a 2a 2a 0a 2a 2a 20 20 20 20 20 20 20 20 20 4c  .**.**         L
23a0: 69 73 74 20 61 6c 6c 20 74 61 67 73 2c 20 6f 72  ist all tags, or
23b0: 20 69 66 20 55 55 49 44 20 69 73 20 73 75 70 70   if UUID is supp
23c0: 6c 69 65 64 2c 20 6c 69 73 74 0a 2a 2a 20 20 20  lied, list.**   
23d0: 20 20 20 20 20 20 61 6c 6c 20 74 61 67 73 20 61        all tags a
23e0: 6e 64 20 74 68 65 69 72 20 76 61 6c 75 65 73 20  nd their values 
23f0: 66 6f 72 20 55 55 49 44 2e 0a 2a 2a 0a 2a 2a 20  for UUID..**.** 
2400: 54 68 65 20 6f 70 74 69 6f 6e 20 3f 2d 2d 72 61  The option ?--ra
2410: 77 3f 20 69 73 20 74 6f 20 65 78 70 6f 73 65 20  w? is to expose 
2420: 74 68 65 20 69 6e 74 65 72 6e 61 6c 20 69 6e 74  the internal int
2430: 65 72 66 61 63 65 20 0a 2a 2a 20 66 6f 72 20 74  erface .** for t
2440: 61 67 20 68 61 6e 64 6c 69 6e 67 2e 20 54 68 69  ag handling. Thi
2450: 73 20 6f 70 74 69 6f 6e 20 69 73 20 6e 6f 74 20  s option is not 
2460: 6e 65 63 65 73 73 61 72 79 20 66 6f 72 20 74 68  necessary for th
2470: 65 0a 2a 2a 20 6e 6f 72 6d 61 6c 20 75 73 65 2e  e.** normal use.
2480: 0a 2a 2a 0a 2a 2a 20 49 66 20 79 6f 75 20 75 73  .**.** If you us
2490: 65 20 61 20 74 61 67 6e 61 6d 65 20 74 68 61 74  e a tagname that
24a0: 20 6d 69 67 68 74 20 62 65 20 63 6f 6e 66 75 73   might be confus
24b0: 65 64 20 77 69 74 68 20 61 20 55 55 49 44 2c 0a  ed with a UUID,.
24c0: 2a 2a 20 79 6f 75 20 68 61 76 65 20 74 6f 20 65  ** you have to e
24d0: 78 70 6c 69 63 69 74 6c 79 20 64 69 73 61 6d 62  xplicitly disamb
24e0: 69 67 75 61 74 65 20 69 74 20 62 79 20 70 72 65  iguate it by pre
24f0: 66 69 78 69 6e 67 20 69 74 0a 2a 2a 20 77 69 74  fixing it.** wit
2500: 68 20 22 74 61 67 3a 22 2e 20 46 6f 72 20 69 6e  h "tag:". For in
2510: 73 74 61 6e 63 65 3a 0a 2a 2a 0a 2a 2a 20 20 20  stance:.**.**   
2520: 66 6f 73 73 69 6c 20 75 70 64 61 74 65 20 63 66  fossil update cf
2530: 63 66 63 66 65 65 0a 2a 2a 0a 2a 2a 20 69 73 20  cfcfee.**.** is 
2540: 6e 6f 74 20 74 68 65 20 73 61 6d 65 20 61 73 3a  not the same as:
2550: 0a 2a 2a 0a 2a 2a 20 20 20 66 6f 73 73 69 6c 20  .**.**   fossil 
2560: 75 70 64 61 74 65 20 74 61 67 3a 63 66 63 66 63  update tag:cfcfc
2570: 66 65 65 0a 2a 2a 0a 2a 2a 20 54 68 65 20 66 69  fee.**.** The fi
2580: 72 73 74 20 77 69 6c 6c 20 62 65 20 74 61 6b 65  rst will be take
2590: 6e 20 61 73 20 55 55 49 44 20 61 6e 64 20 66 6f  n as UUID and fo
25a0: 73 73 69 6c 20 77 69 6c 6c 20 63 6f 6d 70 6c 61  ssil will compla
25b0: 69 6e 0a 2a 2a 20 69 66 20 6e 6f 20 73 75 63 68  in.** if no such
25c0: 20 72 65 76 69 73 69 6f 6e 20 77 61 73 20 66 6f   revision was fo
25d0: 75 6e 64 2c 20 61 6e 64 20 74 68 65 20 73 65 63  und, and the sec
25e0: 6f 6e 64 20 6f 6e 65 20 65 78 70 65 63 74 0a 2a  ond one expect.*
25f0: 2a 20 22 63 66 63 66 63 66 65 65 22 20 74 6f 20  * "cfcfcfee" to 
2600: 62 65 20 61 20 74 61 67 2f 62 72 61 6e 63 68 20  be a tag/branch 
2610: 6e 61 6d 65 21 0a 2a 2a 0a 2a 2f 0a 76 6f 69 64  name!.**.*/.void
2620: 20 74 61 67 5f 63 6d 64 28 76 6f 69 64 29 7b 0a   tag_cmd(void){.
2630: 20 20 69 6e 74 20 6e 3b 0a 20 20 69 6e 74 20 72    int n;.  int r
2640: 61 77 20 3d 20 66 69 6e 64 5f 6f 70 74 69 6f 6e  aw = find_option
2650: 28 22 72 61 77 22 2c 22 22 2c 30 29 21 3d 30 3b  ("raw","",0)!=0;
2660: 0a 20 20 63 6f 6e 73 74 20 63 68 61 72 20 2a 70  .  const char *p
2670: 72 65 66 69 78 20 3d 20 72 61 77 20 3f 20 22 22  refix = raw ? ""
2680: 20 3a 20 22 73 79 6d 2d 22 3b 0a 20 20 69 6e 74   : "sym-";.  int
2690: 20 70 72 65 66 6c 65 6e 20 3d 20 73 74 72 6c 65   preflen = strle
26a0: 6e 28 70 72 65 66 69 78 29 3b 0a 20 20 42 6c 6f  n(prefix);.  Blo
26b0: 62 20 74 61 67 6e 61 6d 65 3b 0a 0a 20 20 64 62  b tagname;..  db
26c0: 5f 66 69 6e 64 5f 61 6e 64 5f 6f 70 65 6e 5f 72  _find_and_open_r
26d0: 65 70 6f 73 69 74 6f 72 79 28 31 29 3b 0a 20 20  epository(1);.  
26e0: 69 66 28 20 67 2e 61 72 67 63 3c 33 20 29 7b 0a  if( g.argc<3 ){.
26f0: 20 20 20 20 67 6f 74 6f 20 74 61 67 5f 63 6d 64      goto tag_cmd
2700: 5f 75 73 61 67 65 3b 0a 20 20 7d 0a 20 20 6e 20  _usage;.  }.  n 
2710: 3d 20 73 74 72 6c 65 6e 28 67 2e 61 72 67 76 5b  = strlen(g.argv[
2720: 32 5d 29 3b 0a 20 20 69 66 28 20 6e 3d 3d 30 20  2]);.  if( n==0 
2730: 29 7b 0a 20 20 20 20 67 6f 74 6f 20 74 61 67 5f  ){.    goto tag_
2740: 63 6d 64 5f 75 73 61 67 65 3b 0a 20 20 7d 0a 0a  cmd_usage;.  }..
2750: 20 20 62 6c 6f 62 5f 73 65 74 28 26 74 61 67 6e    blob_set(&tagn
2760: 61 6d 65 2c 20 70 72 65 66 69 78 29 3b 0a 0a 20  ame, prefix);.. 
2770: 20 69 66 28 20 73 74 72 6e 63 6d 70 28 67 2e 61   if( strncmp(g.a
2780: 72 67 76 5b 32 5d 2c 22 61 64 64 22 2c 6e 29 3d  rgv[2],"add",n)=
2790: 3d 30 20 29 7b 0a 20 20 20 20 63 68 61 72 20 2a  =0 ){.    char *
27a0: 7a 56 61 6c 75 65 3b 0a 20 20 20 20 69 66 28 20  zValue;.    if( 
27b0: 67 2e 61 72 67 63 21 3d 35 20 26 26 20 67 2e 61  g.argc!=5 && g.a
27c0: 72 67 63 21 3d 36 20 29 7b 0a 20 20 20 20 20 20  rgc!=6 ){.      
27d0: 75 73 61 67 65 28 22 61 64 64 20 54 41 47 4e 41  usage("add TAGNA
27e0: 4d 45 20 55 55 49 44 20 3f 56 41 4c 55 45 3f 22  ME UUID ?VALUE?"
27f0: 29 3b 0a 20 20 20 20 7d 0a 20 20 20 20 62 6c 6f  );.    }.    blo
2800: 62 5f 61 70 70 65 6e 64 28 26 74 61 67 6e 61 6d  b_append(&tagnam
2810: 65 2c 20 67 2e 61 72 67 76 5b 33 5d 2c 20 73 74  e, g.argv[3], st
2820: 72 6c 65 6e 28 67 2e 61 72 67 76 5b 33 5d 29 29  rlen(g.argv[3]))
2830: 3b 0a 20 20 20 20 7a 56 61 6c 75 65 20 3d 20 67  ;.    zValue = g
2840: 2e 61 72 67 63 3d 3d 36 20 3f 20 67 2e 61 72 67  .argc==6 ? g.arg
2850: 76 5b 35 5d 20 3a 20 30 3b 0a 20 20 20 20 74 61  v[5] : 0;.    ta
2860: 67 5f 61 64 64 5f 61 72 74 69 66 61 63 74 28 62  g_add_artifact(b
2870: 6c 6f 62 5f 73 74 72 28 26 74 61 67 6e 61 6d 65  lob_str(&tagname
2880: 29 2c 20 67 2e 61 72 67 76 5b 34 5d 2c 20 7a 56  ), g.argv[4], zV
2890: 61 6c 75 65 2c 20 31 29 3b 0a 20 20 7d 65 6c 73  alue, 1);.  }els
28a0: 65 0a 0a 20 20 69 66 28 20 73 74 72 6e 63 6d 70  e..  if( strncmp
28b0: 28 67 2e 61 72 67 76 5b 32 5d 2c 22 62 72 61 6e  (g.argv[2],"bran
28c0: 63 68 22 2c 6e 29 3d 3d 30 20 29 7b 0a 20 20 20  ch",n)==0 ){.   
28d0: 20 63 68 61 72 20 2a 7a 56 61 6c 75 65 3b 0a 20   char *zValue;. 
28e0: 20 20 20 69 66 28 20 67 2e 61 72 67 63 21 3d 35     if( g.argc!=5
28f0: 20 26 26 20 67 2e 61 72 67 63 21 3d 36 20 29 7b   && g.argc!=6 ){
2900: 0a 20 20 20 20 20 20 75 73 61 67 65 28 22 62 72  .      usage("br
2910: 61 6e 63 68 20 54 41 47 4e 41 4d 45 20 55 55 49  anch TAGNAME UUI
2920: 44 20 3f 56 41 4c 55 45 3f 22 29 3b 0a 20 20 20  D ?VALUE?");.   
2930: 20 7d 0a 20 20 20 20 62 6c 6f 62 5f 61 70 70 65   }.    blob_appe
2940: 6e 64 28 26 74 61 67 6e 61 6d 65 2c 20 67 2e 61  nd(&tagname, g.a
2950: 72 67 76 5b 33 5d 2c 20 73 74 72 6c 65 6e 28 67  rgv[3], strlen(g
2960: 2e 61 72 67 76 5b 33 5d 29 29 3b 0a 20 20 20 20  .argv[3]));.    
2970: 7a 56 61 6c 75 65 20 3d 20 67 2e 61 72 67 63 3d  zValue = g.argc=
2980: 3d 36 20 3f 20 67 2e 61 72 67 76 5b 35 5d 20 3a  =6 ? g.argv[5] :
2990: 20 30 3b 0a 20 20 20 20 74 61 67 5f 61 64 64 5f   0;.    tag_add_
29a0: 61 72 74 69 66 61 63 74 28 62 6c 6f 62 5f 73 74  artifact(blob_st
29b0: 72 28 26 74 61 67 6e 61 6d 65 29 2c 20 67 2e 61  r(&tagname), g.a
29c0: 72 67 76 5b 34 5d 2c 20 7a 56 61 6c 75 65 2c 20  rgv[4], zValue, 
29d0: 32 29 3b 0a 20 20 7d 65 6c 73 65 0a 0a 20 20 69  2);.  }else..  i
29e0: 66 28 20 73 74 72 6e 63 6d 70 28 67 2e 61 72 67  f( strncmp(g.arg
29f0: 76 5b 32 5d 2c 22 64 65 6c 65 74 65 22 2c 6e 29  v[2],"delete",n)
2a00: 3d 3d 30 20 29 7b 0a 20 20 20 20 69 66 28 20 67  ==0 ){.    if( g
2a10: 2e 61 72 67 63 21 3d 35 20 29 7b 0a 20 20 20 20  .argc!=5 ){.    
2a20: 20 20 75 73 61 67 65 28 22 64 65 6c 65 74 65 20    usage("delete 
2a30: 54 41 47 4e 41 4d 45 20 55 55 49 44 22 29 3b 0a  TAGNAME UUID");.
2a40: 20 20 20 20 7d 0a 20 20 20 20 62 6c 6f 62 5f 61      }.    blob_a
2a50: 70 70 65 6e 64 28 26 74 61 67 6e 61 6d 65 2c 20  ppend(&tagname, 
2a60: 67 2e 61 72 67 76 5b 33 5d 2c 20 73 74 72 6c 65  g.argv[3], strle
2a70: 6e 28 67 2e 61 72 67 76 5b 33 5d 29 29 3b 0a 20  n(g.argv[3]));. 
2a80: 20 20 20 74 61 67 5f 61 64 64 5f 61 72 74 69 66     tag_add_artif
2a90: 61 63 74 28 62 6c 6f 62 5f 73 74 72 28 26 74 61  act(blob_str(&ta
2aa0: 67 6e 61 6d 65 29 2c 20 67 2e 61 72 67 76 5b 34  gname), g.argv[4
2ab0: 5d 2c 20 30 2c 20 30 29 3b 0a 20 20 7d 65 6c 73  ], 0, 0);.  }els
2ac0: 65 0a 0a 20 20 69 66 28 20 73 74 72 6e 63 6d 70  e..  if( strncmp
2ad0: 28 67 2e 61 72 67 76 5b 32 5d 2c 22 66 69 6e 64  (g.argv[2],"find
2ae0: 22 2c 6e 29 3d 3d 30 20 29 7b 0a 20 20 20 20 53  ",n)==0 ){.    S
2af0: 74 6d 74 20 71 3b 0a 20 20 20 20 69 66 28 20 67  tmt q;.    if( g
2b00: 2e 61 72 67 63 21 3d 34 20 29 7b 0a 20 20 20 20  .argc!=4 ){.    
2b10: 20 20 75 73 61 67 65 28 22 66 69 6e 64 20 54 41    usage("find TA
2b20: 47 4e 41 4d 45 22 29 3b 0a 20 20 20 20 7d 0a 20  GNAME");.    }. 
2b30: 20 20 20 62 6c 6f 62 5f 61 70 70 65 6e 64 28 26     blob_append(&
2b40: 74 61 67 6e 61 6d 65 2c 20 67 2e 61 72 67 76 5b  tagname, g.argv[
2b50: 33 5d 2c 20 73 74 72 6c 65 6e 28 67 2e 61 72 67  3], strlen(g.arg
2b60: 76 5b 33 5d 29 29 3b 0a 20 20 20 20 64 62 5f 70  v[3]));.    db_p
2b70: 72 65 70 61 72 65 28 26 71 2c 0a 20 20 20 20 20  repare(&q,.     
2b80: 20 22 53 45 4c 45 43 54 20 62 6c 6f 62 2e 75 75   "SELECT blob.uu
2b90: 69 64 20 46 52 4f 4d 20 74 61 67 78 72 65 66 2c  id FROM tagxref,
2ba0: 20 62 6c 6f 62 22 0a 20 20 20 20 20 20 22 20 57   blob".      " W
2bb0: 48 45 52 45 20 74 61 67 69 64 3d 28 53 45 4c 45  HERE tagid=(SELE
2bc0: 43 54 20 74 61 67 69 64 20 46 52 4f 4d 20 74 61  CT tagid FROM ta
2bd0: 67 20 57 48 45 52 45 20 74 61 67 6e 61 6d 65 3d  g WHERE tagname=
2be0: 25 42 29 22 0a 20 20 20 20 20 20 22 20 20 20 41  %B)".      "   A
2bf0: 4e 44 20 62 6c 6f 62 2e 72 69 64 3d 74 61 67 78  ND blob.rid=tagx
2c00: 72 65 66 2e 72 69 64 22 2c 20 26 74 61 67 6e 61  ref.rid", &tagna
2c10: 6d 65 0a 20 20 20 20 29 3b 0a 20 20 20 20 77 68  me.    );.    wh
2c20: 69 6c 65 28 20 64 62 5f 73 74 65 70 28 26 71 29  ile( db_step(&q)
2c30: 3d 3d 53 51 4c 49 54 45 5f 52 4f 57 20 29 7b 0a  ==SQLITE_ROW ){.
2c40: 20 20 20 20 20 20 70 72 69 6e 74 66 28 22 25 73        printf("%s
2c50: 5c 6e 22 2c 20 64 62 5f 63 6f 6c 75 6d 6e 5f 74  \n", db_column_t
2c60: 65 78 74 28 26 71 2c 20 30 29 29 3b 0a 20 20 20  ext(&q, 0));.   
2c70: 20 7d 0a 20 20 20 20 64 62 5f 66 69 6e 61 6c 69   }.    db_finali
2c80: 7a 65 28 26 71 29 3b 0a 20 20 7d 65 6c 73 65 0a  ze(&q);.  }else.
2c90: 0a 20 20 69 66 28 20 73 74 72 6e 63 6d 70 28 67  .  if( strncmp(g
2ca0: 2e 61 72 67 76 5b 32 5d 2c 22 6c 69 73 74 22 2c  .argv[2],"list",
2cb0: 6e 29 3d 3d 30 20 29 7b 0a 20 20 20 20 53 74 6d  n)==0 ){.    Stm
2cc0: 74 20 71 3b 0a 20 20 20 20 69 66 28 20 67 2e 61  t q;.    if( g.a
2cd0: 72 67 63 3d 3d 33 20 29 7b 0a 20 20 20 20 20 20  rgc==3 ){.      
2ce0: 64 62 5f 70 72 65 70 61 72 65 28 26 71 2c 20 0a  db_prepare(&q, .
2cf0: 20 20 20 20 20 20 20 20 22 53 45 4c 45 43 54 20          "SELECT 
2d00: 74 61 67 6e 61 6d 65 22 0a 20 20 20 20 20 20 20  tagname".       
2d10: 20 22 20 20 46 52 4f 4d 20 74 61 67 22 0a 20 20   "  FROM tag".  
2d20: 20 20 20 20 20 20 22 20 57 48 45 52 45 20 45 58        " WHERE EX
2d30: 49 53 54 53 28 53 45 4c 45 43 54 20 31 20 46 52  ISTS(SELECT 1 FR
2d40: 4f 4d 20 74 61 67 78 72 65 66 22 0a 20 20 20 20  OM tagxref".    
2d50: 20 20 20 20 22 20 20 20 20 20 20 20 20 20 20 20      "           
2d60: 20 20 20 20 57 48 45 52 45 20 74 61 67 69 64 3d      WHERE tagid=
2d70: 74 61 67 2e 74 61 67 69 64 22 0a 20 20 20 20 20  tag.tagid".     
2d80: 20 20 20 22 20 20 20 20 20 20 20 20 20 20 20 20     "            
2d90: 20 20 20 20 20 41 4e 44 20 74 61 67 74 79 70 65       AND tagtype
2da0: 3e 30 29 22 0a 20 20 20 20 20 20 20 20 22 20 4f  >0)".        " O
2db0: 52 44 45 52 20 42 59 20 74 61 67 6e 61 6d 65 22  RDER BY tagname"
2dc0: 0a 20 20 20 20 20 20 29 3b 0a 20 20 20 20 20 20  .      );.      
2dd0: 77 68 69 6c 65 28 20 64 62 5f 73 74 65 70 28 26  while( db_step(&
2de0: 71 29 3d 3d 53 51 4c 49 54 45 5f 52 4f 57 20 29  q)==SQLITE_ROW )
2df0: 7b 0a 20 20 20 20 20 20 20 20 63 6f 6e 73 74 20  {.        const 
2e00: 63 68 61 72 20 2a 6e 61 6d 65 20 3d 20 64 62 5f  char *name = db_
2e10: 63 6f 6c 75 6d 6e 5f 74 65 78 74 28 26 71 2c 20  column_text(&q, 
2e20: 30 29 3b 0a 20 20 20 20 20 20 20 20 69 66 28 20  0);.        if( 
2e30: 72 61 77 20 7c 7c 20 73 74 72 6e 63 6d 70 28 6e  raw || strncmp(n
2e40: 61 6d 65 2c 20 70 72 65 66 69 78 2c 20 70 72 65  ame, prefix, pre
2e50: 66 6c 65 6e 29 3d 3d 30 20 29 7b 0a 20 20 20 20  flen)==0 ){.    
2e60: 20 20 20 20 20 20 70 72 69 6e 74 66 28 22 25 73        printf("%s
2e70: 5c 6e 22 2c 20 6e 61 6d 65 2b 70 72 65 66 6c 65  \n", name+prefle
2e80: 6e 29 3b 0a 20 20 20 20 20 20 20 20 7d 0a 20 20  n);.        }.  
2e90: 20 20 20 20 7d 0a 20 20 20 20 20 20 64 62 5f 66      }.      db_f
2ea0: 69 6e 61 6c 69 7a 65 28 26 71 29 3b 0a 20 20 20  inalize(&q);.   
2eb0: 20 7d 65 6c 73 65 20 69 66 28 20 67 2e 61 72 67   }else if( g.arg
2ec0: 63 3d 3d 34 20 29 7b 0a 20 20 20 20 20 20 69 6e  c==4 ){.      in
2ed0: 74 20 72 69 64 20 3d 20 6e 61 6d 65 5f 74 6f 5f  t rid = name_to_
2ee0: 72 69 64 28 67 2e 61 72 67 76 5b 33 5d 29 3b 0a  rid(g.argv[3]);.
2ef0: 20 20 20 20 20 20 64 62 5f 70 72 65 70 61 72 65        db_prepare
2f00: 28 26 71 2c 0a 20 20 20 20 20 20 20 20 22 53 45  (&q,.        "SE
2f10: 4c 45 43 54 20 74 61 67 6e 61 6d 65 2c 20 76 61  LECT tagname, va
2f20: 6c 75 65 22 0a 20 20 20 20 20 20 20 20 22 20 20  lue".        "  
2f30: 46 52 4f 4d 20 74 61 67 78 72 65 66 2c 20 74 61  FROM tagxref, ta
2f40: 67 22 0a 20 20 20 20 20 20 20 20 22 20 57 48 45  g".        " WHE
2f50: 52 45 20 74 61 67 78 72 65 66 2e 72 69 64 3d 25  RE tagxref.rid=%
2f60: 64 20 41 4e 44 20 74 61 67 78 72 65 66 2e 74 61  d AND tagxref.ta
2f70: 67 69 64 3d 74 61 67 2e 74 61 67 69 64 22 0a 20  gid=tag.tagid". 
2f80: 20 20 20 20 20 20 20 22 20 20 20 41 4e 44 20 74         "   AND t
2f90: 61 67 74 79 70 65 3e 30 22 0a 20 20 20 20 20 20  agtype>0".      
2fa0: 20 20 22 20 4f 52 44 45 52 20 42 59 20 74 61 67    " ORDER BY tag
2fb0: 6e 61 6d 65 22 2c 0a 20 20 20 20 20 20 20 20 72  name",.        r
2fc0: 69 64 0a 20 20 20 20 20 20 29 3b 0a 20 20 20 20  id.      );.    
2fd0: 20 20 77 68 69 6c 65 28 20 64 62 5f 73 74 65 70    while( db_step
2fe0: 28 26 71 29 3d 3d 53 51 4c 49 54 45 5f 52 4f 57  (&q)==SQLITE_ROW
2ff0: 20 29 7b 0a 20 20 20 20 20 20 20 20 63 6f 6e 73   ){.        cons
3000: 74 20 63 68 61 72 20 2a 7a 4e 61 6d 65 20 3d 20  t char *zName = 
3010: 64 62 5f 63 6f 6c 75 6d 6e 5f 74 65 78 74 28 26  db_column_text(&
3020: 71 2c 20 30 29 3b 0a 20 20 20 20 20 20 20 20 63  q, 0);.        c
3030: 6f 6e 73 74 20 63 68 61 72 20 2a 7a 56 61 6c 75  onst char *zValu
3040: 65 20 3d 20 64 62 5f 63 6f 6c 75 6d 6e 5f 74 65  e = db_column_te
3050: 78 74 28 26 71 2c 20 31 29 3b 0a 20 20 20 20 20  xt(&q, 1);.     
3060: 20 20 20 69 66 28 20 7a 56 61 6c 75 65 20 29 7b     if( zValue ){
3070: 0a 20 20 20 20 20 20 20 20 20 20 69 66 28 20 72  .          if( r
3080: 61 77 20 7c 7c 20 73 74 72 6e 63 6d 70 28 7a 4e  aw || strncmp(zN
3090: 61 6d 65 2c 20 70 72 65 66 69 78 2c 20 70 72 65  ame, prefix, pre
30a0: 66 6c 65 6e 29 3d 3d 30 20 29 7b 0a 20 20 20 20  flen)==0 ){.    
30b0: 20 20 20 20 20 20 20 20 70 72 69 6e 74 66 28 22          printf("
30c0: 25 73 3d 25 73 5c 6e 22 2c 20 7a 4e 61 6d 65 2b  %s=%s\n", zName+
30d0: 70 72 65 66 6c 65 6e 2c 20 7a 56 61 6c 75 65 29  preflen, zValue)
30e0: 3b 0a 20 20 20 20 20 20 20 20 20 20 7d 0a 20 20  ;.          }.  
30f0: 20 20 20 20 20 20 7d 65 6c 73 65 7b 0a 20 20 20        }else{.   
3100: 20 20 20 20 20 20 20 69 66 28 20 72 61 77 20 7c         if( raw |
3110: 7c 20 73 74 72 6e 63 6d 70 28 7a 4e 61 6d 65 2c  | strncmp(zName,
3120: 20 70 72 65 66 69 78 2c 20 70 72 65 66 6c 65 6e   prefix, preflen
3130: 29 3d 3d 30 20 29 7b 0a 20 20 20 20 20 20 20 20  )==0 ){.        
3140: 20 20 20 20 70 72 69 6e 74 66 28 22 25 73 5c 6e      printf("%s\n
3150: 22 2c 20 7a 4e 61 6d 65 2b 70 72 65 66 6c 65 6e  ", zName+preflen
3160: 29 3b 0a 20 20 20 20 20 20 20 20 20 20 7d 0a 20  );.          }. 
3170: 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 7d         }.      }
3180: 0a 20 20 20 20 20 20 64 62 5f 66 69 6e 61 6c 69  .      db_finali
3190: 7a 65 28 26 71 29 3b 0a 20 20 20 20 7d 65 6c 73  ze(&q);.    }els
31a0: 65 7b 0a 20 20 20 20 20 20 75 73 61 67 65 28 22  e{.      usage("
31b0: 74 61 67 20 6c 69 73 74 20 3f 55 55 49 44 3f 22  tag list ?UUID?"
31c0: 29 3b 0a 20 20 20 20 7d 0a 20 20 7d 65 6c 73 65  );.    }.  }else
31d0: 0a 20 20 7b 0a 20 20 20 20 67 6f 74 6f 20 74 61  .  {.    goto ta
31e0: 67 5f 63 6d 64 5f 75 73 61 67 65 3b 0a 20 20 7d  g_cmd_usage;.  }
31f0: 0a 0a 20 20 2f 2a 20 43 6c 65 61 6e 75 70 20 2a  ..  /* Cleanup *
3200: 2f 0a 20 20 62 6c 6f 62 5f 72 65 73 65 74 28 26  /.  blob_reset(&
3210: 74 61 67 6e 61 6d 65 29 3b 0a 20 20 72 65 74 75  tagname);.  retu
3220: 72 6e 3b 0a 0a 74 61 67 5f 63 6d 64 5f 75 73 61  rn;..tag_cmd_usa
3230: 67 65 3a 0a 20 20 75 73 61 67 65 28 22 61 64 64  ge:.  usage("add
3240: 7c 62 72 61 6e 63 68 7c 64 65 6c 65 74 65 7c 66  |branch|delete|f
3250: 69 6e 64 7c 6c 69 73 74 20 2e 2e 2e 22 29 3b 0a  ind|list ...");.
3260: 7d 0a                                            }.