Hex Artifact Content
Not logged in

Artifact fa0c2531fc157a0b351a207737702ab859f1d8b2:

File src/configure.c part of check-in [27d2e6e458] - More ticket processing refinements. by drh on 2008-05-28 19:24:58.

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 38 20 44 2e 20 52 69 63 68  (c) 2008 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 72 65  sed to manage re
0390: 70 6f 73 69 74 6f 72 79 20 63 6f 6e 66 69 67 75  pository configu
03a0: 72 61 74 69 6f 6e 73 2e 0a 2a 2a 20 42 79 20 22  rations..** By "
03b0: 72 65 73 70 6f 6e 73 69 74 6f 72 79 20 63 6f 6e  responsitory con
03c0: 66 69 67 75 72 65 22 20 77 65 20 6d 65 61 6e 20  figure" we mean 
03d0: 74 68 65 20 6c 6f 63 61 6c 20 73 74 61 74 65 20  the local state 
03e0: 6f 66 20 61 20 72 65 70 6f 73 69 74 6f 72 79 0a  of a repository.
03f0: 2a 2a 20 64 69 73 74 69 6e 63 74 20 66 72 6f 6d  ** distinct from
0400: 20 74 68 65 20 76 65 72 73 69 6f 6e 65 64 20 66   the versioned f
0410: 69 6c 65 73 2e 0a 2a 2f 0a 23 69 6e 63 6c 75 64  iles..*/.#includ
0420: 65 20 22 63 6f 6e 66 69 67 2e 68 22 0a 23 69 6e  e "config.h".#in
0430: 63 6c 75 64 65 20 22 63 6f 6e 66 69 67 75 72 65  clude "configure
0440: 2e 68 22 0a 23 69 6e 63 6c 75 64 65 20 3c 61 73  .h".#include <as
0450: 73 65 72 74 2e 68 3e 0a 0a 23 69 66 20 49 4e 54  sert.h>..#if INT
0460: 45 52 46 41 43 45 0a 2f 2a 0a 2a 2a 20 43 6f 6e  ERFACE./*.** Con
0470: 66 69 67 75 72 61 74 69 6f 6e 20 74 72 61 6e 73  figuration trans
0480: 66 65 72 73 20 6f 63 63 75 72 20 69 6e 20 67 72  fers occur in gr
0490: 6f 75 70 73 2e 20 20 54 68 65 73 65 20 61 72 65  oups.  These are
04a0: 20 74 68 65 20 61 6c 6c 6f 77 65 64 0a 2a 2a 20   the allowed.** 
04b0: 67 72 6f 75 70 69 6e 67 73 3a 0a 2a 2f 0a 23 64  groupings:.*/.#d
04c0: 65 66 69 6e 65 20 43 4f 4e 46 49 47 53 45 54 5f  efine CONFIGSET_
04d0: 53 4b 49 4e 20 20 20 30 78 30 30 30 30 30 31 20  SKIN   0x000001 
04e0: 20 20 20 20 2f 2a 20 57 57 57 20 69 6e 74 65 72      /* WWW inter
04f0: 66 61 63 65 20 61 70 70 65 61 72 61 6e 63 65 20  face appearance 
0500: 2a 2f 0a 23 64 65 66 69 6e 65 20 43 4f 4e 46 49  */.#define CONFI
0510: 47 53 45 54 5f 54 4b 54 20 20 20 20 30 78 30 30  GSET_TKT    0x00
0520: 30 30 30 32 20 20 20 20 20 2f 2a 20 54 69 63 6b  0002     /* Tick
0530: 65 74 20 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e  et configuration
0540: 20 2a 2f 0a 23 64 65 66 69 6e 65 20 43 4f 4e 46   */.#define CONF
0550: 49 47 53 45 54 5f 50 52 4f 4a 20 20 20 30 78 30  IGSET_PROJ   0x0
0560: 30 30 30 30 34 20 20 20 20 20 2f 2a 20 50 72 6f  00004     /* Pro
0570: 6a 65 63 74 20 6e 61 6d 65 20 2a 2f 0a 0a 23 64  ject name */..#d
0580: 65 66 69 6e 65 20 43 4f 4e 46 49 47 53 45 54 5f  efine CONFIGSET_
0590: 41 4c 4c 20 20 20 20 30 78 66 66 66 66 66 66 20  ALL    0xffffff 
05a0: 20 20 20 20 2f 2a 20 45 76 65 72 79 74 68 69 6e      /* Everythin
05b0: 67 20 2a 2f 0a 0a 23 65 6e 64 69 66 20 2f 2a 20  g */..#endif /* 
05c0: 49 4e 54 45 52 46 41 43 45 20 2a 2f 0a 0a 2f 2a  INTERFACE */../*
05d0: 0a 2a 2a 20 4e 61 6d 65 73 20 6f 66 20 74 68 65  .** Names of the
05e0: 20 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 20 73   configuration s
05f0: 65 74 73 0a 2a 2f 0a 73 74 61 74 69 63 20 73 74  ets.*/.static st
0600: 72 75 63 74 20 7b 0a 20 20 63 6f 6e 73 74 20 63  ruct {.  const c
0610: 68 61 72 20 2a 7a 4e 61 6d 65 3b 20 20 20 2f 2a  har *zName;   /*
0620: 20 4e 61 6d 65 20 6f 66 20 74 68 65 20 63 6f 6e   Name of the con
0630: 66 69 67 75 72 61 74 69 6f 6e 20 73 65 74 20 2a  figuration set *
0640: 2f 0a 20 20 69 6e 74 20 67 72 6f 75 70 4d 61 73  /.  int groupMas
0650: 6b 3b 20 20 20 20 20 20 20 2f 2a 20 4d 61 73 6b  k;       /* Mask
0660: 20 66 6f 72 20 74 68 61 74 20 63 6f 6e 66 69 67   for that config
0670: 75 72 61 74 69 6f 6e 20 73 65 74 20 2a 2f 0a 7d  uration set */.}
0680: 20 61 47 72 6f 75 70 4e 61 6d 65 5b 5d 20 3d 20   aGroupName[] = 
0690: 7b 0a 20 20 7b 20 22 73 6b 69 6e 22 2c 20 20 20  {.  { "skin",   
06a0: 20 20 20 20 20 20 43 4f 4e 46 49 47 53 45 54 5f        CONFIGSET_
06b0: 53 4b 49 4e 20 7d 2c 0a 20 20 7b 20 22 74 69 63  SKIN },.  { "tic
06c0: 6b 65 74 22 2c 20 20 20 20 20 20 20 43 4f 4e 46  ket",       CONF
06d0: 49 47 53 45 54 5f 54 4b 54 20 20 7d 2c 0a 20 20  IGSET_TKT  },.  
06e0: 7b 20 22 70 72 6f 6a 65 63 74 22 2c 20 20 20 20  { "project",    
06f0: 20 20 43 4f 4e 46 49 47 53 45 54 5f 50 52 4f 4a    CONFIGSET_PROJ
0700: 20 7d 2c 0a 20 20 7b 20 22 61 6c 6c 22 2c 20 20   },.  { "all",  
0710: 20 20 20 20 20 20 20 20 43 4f 4e 46 49 47 53 45          CONFIGSE
0720: 54 5f 41 4c 4c 20 20 7d 2c 0a 7d 3b 0a 0a 0a 2f  T_ALL  },.};.../
0730: 2a 0a 2a 2a 20 54 68 65 20 66 6f 6c 6c 6f 77 69  *.** The followi
0740: 6e 67 20 69 73 20 61 20 6c 69 73 74 20 6f 66 20  ng is a list of 
0750: 73 65 74 74 69 6e 67 73 20 74 68 61 74 20 77 65  settings that we
0760: 20 61 72 65 20 77 69 6c 6c 69 6e 67 20 74 6f 0a   are willing to.
0770: 2a 2a 20 74 72 61 6e 73 66 65 72 2e 0a 2a 2f 0a  ** transfer..*/.
0780: 73 74 61 74 69 63 20 73 74 72 75 63 74 20 7b 0a  static struct {.
0790: 20 20 63 6f 6e 73 74 20 63 68 61 72 20 2a 7a 4e    const char *zN
07a0: 61 6d 65 3b 20 20 20 2f 2a 20 4e 61 6d 65 20 6f  ame;   /* Name o
07b0: 66 20 74 68 65 20 63 6f 6e 66 69 67 75 72 61 74  f the configurat
07c0: 69 6f 6e 20 70 61 72 61 6d 65 74 65 72 20 2a 2f  ion parameter */
07d0: 0a 20 20 69 6e 74 20 67 72 6f 75 70 4d 61 73 6b  .  int groupMask
07e0: 3b 20 20 20 20 20 20 20 2f 2a 20 57 68 69 63 68  ;       /* Which
07f0: 20 63 6f 6e 66 69 67 20 67 72 6f 75 70 73 20 69   config groups i
0800: 73 20 69 74 20 70 61 72 74 20 6f 66 20 2a 2f 0a  s it part of */.
0810: 7d 20 61 43 6f 6e 66 69 67 5b 5d 20 3d 20 7b 0a  } aConfig[] = {.
0820: 20 20 7b 20 22 63 73 73 22 2c 20 20 20 20 20 20    { "css",      
0830: 20 20 20 20 20 20 20 20 20 20 20 20 20 43 4f 4e               CON
0840: 46 49 47 53 45 54 5f 53 4b 49 4e 20 7d 2c 0a 20  FIGSET_SKIN },. 
0850: 20 7b 20 22 68 65 61 64 65 72 22 2c 20 20 20 20   { "header",    
0860: 20 20 20 20 20 20 20 20 20 20 20 20 43 4f 4e 46              CONF
0870: 49 47 53 45 54 5f 53 4b 49 4e 20 7d 2c 0a 20 20  IGSET_SKIN },.  
0880: 7b 20 22 66 6f 6f 74 65 72 22 2c 20 20 20 20 20  { "footer",     
0890: 20 20 20 20 20 20 20 20 20 20 20 43 4f 4e 46 49             CONFI
08a0: 47 53 45 54 5f 53 4b 49 4e 20 7d 2c 0a 20 20 7b  GSET_SKIN },.  {
08b0: 20 22 70 72 6f 6a 65 63 74 2d 6e 61 6d 65 22 2c   "project-name",
08c0: 20 20 20 20 20 20 20 20 20 20 43 4f 4e 46 49 47            CONFIG
08d0: 53 45 54 5f 50 52 4f 4a 20 7d 2c 0a 20 20 7b 20  SET_PROJ },.  { 
08e0: 22 70 72 6f 6a 65 63 74 2d 64 65 73 63 72 69 70  "project-descrip
08f0: 74 69 6f 6e 22 2c 20 20 20 43 4f 4e 46 49 47 53  tion",   CONFIGS
0900: 45 54 5f 50 52 4f 4a 20 7d 2c 0a 20 20 7b 20 22  ET_PROJ },.  { "
0910: 69 6e 64 65 78 2d 70 61 67 65 22 2c 20 20 20 20  index-page",    
0920: 20 20 20 20 20 20 20 20 43 4f 4e 46 49 47 53 45          CONFIGSE
0930: 54 5f 53 4b 49 4e 20 7d 2c 0a 20 20 7b 20 22 74  T_SKIN },.  { "t
0940: 69 6d 65 6c 69 6e 65 2d 62 6c 6f 63 6b 2d 6d 61  imeline-block-ma
0950: 72 6b 75 70 22 2c 20 43 4f 4e 46 49 47 53 45 54  rkup", CONFIGSET
0960: 5f 53 4b 49 4e 20 7d 2c 0a 20 20 7b 20 22 74 69  _SKIN },.  { "ti
0970: 6d 65 6c 69 6e 65 2d 6d 61 78 2d 63 6f 6d 6d 65  meline-max-comme
0980: 6e 74 22 2c 20 20 43 4f 4e 46 49 47 53 45 54 5f  nt",  CONFIGSET_
0990: 53 4b 49 4e 20 7d 2c 0a 20 20 7b 20 22 74 69 63  SKIN },.  { "tic
09a0: 6b 65 74 2d 74 61 62 6c 65 22 2c 20 20 20 20 20  ket-table",     
09b0: 20 20 20 20 20 43 4f 4e 46 49 47 53 45 54 5f 54       CONFIGSET_T
09c0: 4b 54 20 20 7d 2c 0a 20 20 7b 20 22 74 69 63 6b  KT  },.  { "tick
09d0: 65 74 2d 63 6f 6d 6d 6f 6e 22 2c 20 20 20 20 20  et-common",     
09e0: 20 20 20 20 43 4f 4e 46 49 47 53 45 54 5f 54 4b      CONFIGSET_TK
09f0: 54 20 20 7d 2c 0a 20 20 7b 20 22 74 69 63 6b 65  T  },.  { "ticke
0a00: 74 2d 6e 65 77 70 61 67 65 22 2c 20 20 20 20 20  t-newpage",     
0a10: 20 20 20 43 4f 4e 46 49 47 53 45 54 5f 54 4b 54     CONFIGSET_TKT
0a20: 20 20 7d 2c 0a 20 20 7b 20 22 74 69 63 6b 65 74    },.  { "ticket
0a30: 2d 76 69 65 77 70 61 67 65 22 2c 20 20 20 20 20  -viewpage",     
0a40: 20 20 43 4f 4e 46 49 47 53 45 54 5f 54 4b 54 20    CONFIGSET_TKT 
0a50: 20 7d 2c 0a 20 20 7b 20 22 74 69 63 6b 65 74 2d   },.  { "ticket-
0a60: 65 64 69 74 70 61 67 65 22 2c 20 20 20 20 20 20  editpage",      
0a70: 20 43 4f 4e 46 49 47 53 45 54 5f 54 4b 54 20 20   CONFIGSET_TKT  
0a80: 7d 2c 0a 20 20 7b 20 22 74 69 63 6b 65 74 2d 72  },.  { "ticket-r
0a90: 65 70 6f 72 74 2d 74 65 6d 70 6c 61 74 65 22 2c  eport-template",
0aa0: 20 43 4f 4e 46 49 47 53 45 54 5f 54 4b 54 20 7d   CONFIGSET_TKT }
0ab0: 2c 0a 20 20 7b 20 22 74 69 63 6b 65 74 2d 6b 65  ,.  { "ticket-ke
0ac0: 79 2d 74 65 6d 70 6c 61 74 65 22 2c 20 20 20 20  y-template",    
0ad0: 43 4f 4e 46 49 47 53 45 54 5f 54 4b 54 20 7d 2c  CONFIGSET_TKT },
0ae0: 0a 7d 3b 0a 73 74 61 74 69 63 20 69 6e 74 20 69  .};.static int i
0af0: 43 6f 6e 66 69 67 20 3d 20 30 3b 0a 0a 2f 2a 0a  Config = 0;../*.
0b00: 2a 2a 20 52 65 74 75 72 6e 20 6e 61 6d 65 20 6f  ** Return name o
0b10: 66 20 66 69 72 73 74 20 63 6f 6e 66 69 67 75 72  f first configur
0b20: 61 74 69 6f 6e 20 70 72 6f 70 65 72 74 79 20 6d  ation property m
0b30: 61 74 63 68 69 6e 67 20 74 68 65 20 67 69 76 65  atching the give
0b40: 6e 20 6d 61 73 6b 2e 0a 2a 2f 0a 63 6f 6e 73 74  n mask..*/.const
0b50: 20 63 68 61 72 20 2a 63 6f 6e 66 69 67 75 72 65   char *configure
0b60: 5f 66 69 72 73 74 5f 6e 61 6d 65 28 69 6e 74 20  _first_name(int 
0b70: 69 4d 61 73 6b 29 7b 0a 20 20 69 43 6f 6e 66 69  iMask){.  iConfi
0b80: 67 20 3d 20 30 3b 0a 20 20 72 65 74 75 72 6e 20  g = 0;.  return 
0b90: 63 6f 6e 66 69 67 75 72 65 5f 6e 65 78 74 5f 6e  configure_next_n
0ba0: 61 6d 65 28 69 4d 61 73 6b 29 3b 0a 7d 0a 63 6f  ame(iMask);.}.co
0bb0: 6e 73 74 20 63 68 61 72 20 2a 63 6f 6e 66 69 67  nst char *config
0bc0: 75 72 65 5f 6e 65 78 74 5f 6e 61 6d 65 28 69 6e  ure_next_name(in
0bd0: 74 20 69 4d 61 73 6b 29 7b 0a 20 20 77 68 69 6c  t iMask){.  whil
0be0: 65 28 20 69 43 6f 6e 66 69 67 3c 63 6f 75 6e 74  e( iConfig<count
0bf0: 28 61 43 6f 6e 66 69 67 29 20 29 7b 0a 20 20 20  (aConfig) ){.   
0c00: 20 69 66 28 20 61 43 6f 6e 66 69 67 5b 69 43 6f   if( aConfig[iCo
0c10: 6e 66 69 67 5d 2e 67 72 6f 75 70 4d 61 73 6b 20  nfig].groupMask 
0c20: 26 20 69 4d 61 73 6b 20 29 7b 0a 20 20 20 20 20  & iMask ){.     
0c30: 20 72 65 74 75 72 6e 20 61 43 6f 6e 66 69 67 5b   return aConfig[
0c40: 69 43 6f 6e 66 69 67 2b 2b 5d 2e 7a 4e 61 6d 65  iConfig++].zName
0c50: 3b 0a 20 20 20 20 7d 65 6c 73 65 7b 0a 20 20 20  ;.    }else{.   
0c60: 20 20 20 69 43 6f 6e 66 69 67 2b 2b 3b 0a 20 20     iConfig++;.  
0c70: 20 20 7d 0a 20 20 7d 0a 20 20 72 65 74 75 72 6e    }.  }.  return
0c80: 20 30 3b 0a 7d 0a 0a 2f 2a 0a 2a 2a 20 52 65 74   0;.}../*.** Ret
0c90: 75 72 6e 20 54 52 55 45 20 69 66 20 61 20 70 61  urn TRUE if a pa
0ca0: 72 74 69 63 75 6c 61 72 20 63 6f 6e 66 69 67 75  rticular configu
0cb0: 72 61 74 69 6f 6e 20 70 61 72 61 6d 65 74 65 72  ration parameter
0cc0: 20 7a 4e 61 6d 65 20 69 73 0a 2a 2a 20 73 61 66   zName is.** saf
0cd0: 65 6c 79 20 65 78 70 6f 72 74 61 62 6c 65 2e 0a  ely exportable..
0ce0: 2a 2f 0a 69 6e 74 20 63 6f 6e 66 69 67 75 72 65  */.int configure
0cf0: 5f 69 73 5f 65 78 70 6f 72 74 61 62 6c 65 28 63  _is_exportable(c
0d00: 6f 6e 73 74 20 63 68 61 72 20 2a 7a 4e 61 6d 65  onst char *zName
0d10: 29 7b 0a 20 20 69 6e 74 20 69 3b 0a 20 20 66 6f  ){.  int i;.  fo
0d20: 72 28 69 3d 30 3b 20 69 3c 63 6f 75 6e 74 28 61  r(i=0; i<count(a
0d30: 43 6f 6e 66 69 67 29 3b 20 69 2b 2b 29 7b 0a 20  Config); i++){. 
0d40: 20 20 20 69 66 28 20 73 74 72 63 6d 70 28 7a 4e     if( strcmp(zN
0d50: 61 6d 65 2c 20 61 43 6f 6e 66 69 67 5b 69 5d 2e  ame, aConfig[i].
0d60: 7a 4e 61 6d 65 29 3d 3d 30 20 29 7b 0a 20 20 20  zName)==0 ){.   
0d70: 20 20 20 72 65 74 75 72 6e 20 61 43 6f 6e 66 69     return aConfi
0d80: 67 5b 69 5d 2e 67 72 6f 75 70 4d 61 73 6b 3b 0a  g[i].groupMask;.
0d90: 20 20 20 20 7d 0a 20 20 7d 0a 20 20 72 65 74 75      }.  }.  retu
0da0: 72 6e 20 30 3b 0a 7d 0a 0a 2f 2a 0a 2a 2a 20 49  rn 0;.}../*.** I
0db0: 64 65 6e 74 69 66 79 20 61 20 63 6f 6e 66 69 67  dentify a config
0dc0: 75 72 61 74 69 6f 6e 20 67 72 6f 75 70 20 62 79  uration group by
0dd0: 20 6e 61 6d 65 2e 20 20 52 65 74 75 72 6e 20 69   name.  Return i
0de0: 74 73 20 6d 61 73 6b 2e 0a 2a 2a 20 54 68 72 6f  ts mask..** Thro
0df0: 77 20 61 6e 20 65 72 72 6f 72 20 69 66 20 6e 6f  w an error if no
0e00: 20 6d 61 74 63 68 2e 0a 2a 2f 0a 73 74 61 74 69   match..*/.stati
0e10: 63 20 69 6e 74 20 66 69 6e 64 5f 61 72 65 61 28  c int find_area(
0e20: 63 6f 6e 73 74 20 63 68 61 72 20 2a 7a 29 7b 0a  const char *z){.
0e30: 20 20 69 6e 74 20 69 3b 0a 20 20 69 6e 74 20 6e    int i;.  int n
0e40: 20 3d 20 73 74 72 6c 65 6e 28 7a 29 3b 0a 20 20   = strlen(z);.  
0e50: 66 6f 72 28 69 3d 30 3b 20 69 3c 63 6f 75 6e 74  for(i=0; i<count
0e60: 28 61 47 72 6f 75 70 4e 61 6d 65 29 3b 20 69 2b  (aGroupName); i+
0e70: 2b 29 7b 0a 20 20 20 20 69 66 28 20 73 74 72 6e  +){.    if( strn
0e80: 63 6d 70 28 7a 2c 20 61 47 72 6f 75 70 4e 61 6d  cmp(z, aGroupNam
0e90: 65 5b 69 5d 2e 7a 4e 61 6d 65 2c 20 6e 29 3d 3d  e[i].zName, n)==
0ea0: 30 20 29 7b 0a 20 20 20 20 20 20 72 65 74 75 72  0 ){.      retur
0eb0: 6e 20 61 47 72 6f 75 70 4e 61 6d 65 5b 69 5d 2e  n aGroupName[i].
0ec0: 67 72 6f 75 70 4d 61 73 6b 3b 0a 20 20 20 20 7d  groupMask;.    }
0ed0: 0a 20 20 7d 0a 20 20 66 6f 73 73 69 6c 5f 66 61  .  }.  fossil_fa
0ee0: 74 61 6c 28 22 6e 6f 20 73 75 63 68 20 63 6f 6e  tal("no such con
0ef0: 66 69 67 75 72 61 74 69 6f 6e 20 61 72 65 61 3a  figuration area:
0f00: 20 5c 22 25 73 5c 22 22 2c 20 7a 29 3b 0a 20 20   \"%s\"", z);.  
0f10: 72 65 74 75 72 6e 20 30 3b 0a 7d 0a 0a 0a 2f 2a  return 0;.}.../*
0f20: 0a 2a 2a 20 43 4f 4d 4d 41 4e 44 3a 20 63 6f 6e  .** COMMAND: con
0f30: 66 69 67 75 72 61 74 69 6f 6e 0a 2a 2a 0a 2a 2a  figuration.**.**
0f40: 20 55 73 61 67 65 3a 20 25 66 6f 73 73 69 6c 20   Usage: %fossil 
0f50: 63 6f 6e 66 69 67 75 72 65 20 4d 45 54 48 4f 44  configure METHOD
0f60: 20 2e 2e 2e 0a 2a 2a 0a 2a 2a 20 57 68 65 72 65   ....**.** Where
0f70: 20 4d 45 54 48 4f 44 20 69 73 20 6f 6e 65 20 6f   METHOD is one o
0f80: 66 3a 20 65 78 70 6f 72 74 20 69 6d 70 6f 72 74  f: export import
0f90: 20 70 75 6c 6c 20 72 65 73 65 74 2e 20 20 41 6c   pull reset.  Al
0fa0: 6c 20 6d 65 74 68 6f 64 73 0a 2a 2a 20 61 63 63  l methods.** acc
0fb0: 65 70 74 20 74 68 65 20 2d 52 20 6f 72 20 2d 2d  ept the -R or --
0fc0: 72 65 70 6f 73 69 74 6f 72 79 20 6f 70 74 69 6f  repository optio
0fd0: 6e 20 74 6f 20 73 70 65 63 69 66 69 63 20 61 20  n to specific a 
0fe0: 72 65 70 6f 73 69 74 6f 72 79 2e 0a 2a 2a 0a 2a  repository..**.*
0ff0: 2a 20 20 20 20 25 66 6f 73 73 69 6c 20 63 6f 6e  *    %fossil con
1000: 66 69 67 75 72 61 74 69 6f 6e 20 65 78 70 6f 72  figuration expor
1010: 74 20 41 52 45 41 20 46 49 4c 45 4e 41 4d 45 0a  t AREA FILENAME.
1020: 2a 2a 0a 2a 2a 20 20 20 20 20 20 20 20 20 57 72  **.**         Wr
1030: 69 74 65 20 74 6f 20 46 49 4c 45 4e 41 4d 45 20  ite to FILENAME 
1040: 65 78 70 6f 72 74 65 64 20 63 6f 6e 66 69 67 75  exported configu
1050: 72 61 74 6f 6e 20 69 6e 66 6f 72 6d 61 74 69 6f  raton informatio
1060: 6e 20 66 6f 72 20 41 52 45 41 2e 0a 2a 2a 20 20  n for AREA..**  
1070: 20 20 20 20 20 20 20 41 52 45 41 20 63 61 6e 20         AREA can 
1080: 62 65 20 6f 6e 65 20 6f 66 3a 20 20 61 6c 6c 20  be one of:  all 
1090: 74 69 63 6b 65 74 20 73 6b 69 6e 20 70 72 6f 6a  ticket skin proj
10a0: 65 63 74 0a 2a 2a 0a 2a 2a 20 20 20 20 25 66 6f  ect.**.**    %fo
10b0: 73 73 69 6c 20 63 6f 6e 66 69 67 75 72 61 74 69  ssil configurati
10c0: 6f 6e 20 69 6d 70 6f 72 74 20 46 49 4c 45 4e 41  on import FILENA
10d0: 4d 45 0a 2a 2a 0a 2a 2a 20 20 20 20 20 20 20 20  ME.**.**        
10e0: 20 52 65 61 64 20 61 20 63 6f 6e 66 69 67 75 72   Read a configur
10f0: 61 74 69 6f 6e 20 66 72 6f 6d 20 46 49 4c 45 4e  ation from FILEN
1100: 41 4d 45 2c 20 6f 76 65 72 77 72 69 74 69 6e 67  AME, overwriting
1110: 20 74 68 65 20 63 75 72 72 65 6e 74 0a 2a 2a 20   the current.** 
1120: 20 20 20 20 20 20 20 20 63 6f 6e 66 69 67 75 72          configur
1130: 61 74 69 6f 6e 2e 20 20 57 61 72 6e 69 6e 67 3a  ation.  Warning:
1140: 20 20 44 6f 20 6e 6f 74 20 72 65 61 64 20 61 20    Do not read a 
1150: 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 20 66 72  configuration fr
1160: 6f 6d 0a 2a 2a 20 20 20 20 20 20 20 20 20 61 6e  om.**         an
1170: 20 75 6e 74 72 75 73 74 65 64 20 73 6f 75 72 63   untrusted sourc
1180: 65 20 73 69 6e 63 65 20 74 68 65 20 63 6f 6e 66  e since the conf
1190: 69 67 75 72 61 74 69 6f 6e 20 69 73 20 6e 6f 74  iguration is not
11a0: 20 63 68 65 63 6b 65 64 0a 2a 2a 20 20 20 20 20   checked.**     
11b0: 20 20 20 20 66 6f 72 20 73 61 66 65 74 79 20 61      for safety a
11c0: 6e 64 20 63 61 6e 20 69 6e 74 72 6f 64 75 63 65  nd can introduce
11d0: 20 73 65 63 75 72 69 74 79 20 74 68 72 65 61 74   security threat
11e0: 73 2e 0a 2a 2a 0a 2a 2a 20 20 20 20 25 66 6f 73  s..**.**    %fos
11f0: 73 69 6c 20 63 6f 6e 66 69 67 75 72 61 74 69 6f  sil configuratio
1200: 6e 20 70 75 6c 6c 20 41 52 45 41 20 55 52 4c 0a  n pull AREA URL.
1210: 2a 2a 0a 2a 2a 20 20 20 20 20 20 20 20 20 50 75  **.**         Pu
1220: 6c 6c 20 61 6e 64 20 69 6e 73 74 61 6c 6c 20 74  ll and install t
1230: 68 65 20 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e  he configuration
1240: 20 66 72 6f 6d 20 61 20 64 69 66 66 65 72 65 6e   from a differen
1250: 74 20 73 65 72 76 65 72 0a 2a 2a 20 20 20 20 20  t server.**     
1260: 20 20 20 20 69 64 65 6e 74 69 66 69 65 64 20 62      identified b
1270: 79 20 55 52 4c 2e 20 20 41 52 45 41 20 69 73 20  y URL.  AREA is 
1280: 61 73 20 69 6e 20 22 65 78 70 6f 72 74 22 2e 0a  as in "export"..
1290: 2a 2a 0a 2a 2a 20 20 20 20 25 66 6f 73 73 69 6c  **.**    %fossil
12a0: 20 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 20 72   configuration r
12b0: 65 73 65 74 20 41 52 45 41 0a 2a 2a 0a 2a 2a 20  eset AREA.**.** 
12c0: 20 20 20 20 20 20 20 20 52 65 73 74 6f 72 65 20          Restore 
12d0: 74 68 65 20 63 6f 6e 66 69 67 75 72 61 74 69 6f  the configuratio
12e0: 6e 20 74 6f 20 74 68 65 20 64 65 66 61 75 6c 74  n to the default
12f0: 2e 20 20 41 52 45 41 20 61 73 20 61 62 6f 76 65  .  AREA as above
1300: 2e 0a 2a 2f 0a 76 6f 69 64 20 63 6f 6e 66 69 67  ..*/.void config
1310: 75 72 61 74 69 6f 6e 5f 63 6d 64 28 76 6f 69 64  uration_cmd(void
1320: 29 7b 0a 20 20 69 6e 74 20 6e 3b 0a 20 20 63 6f  ){.  int n;.  co
1330: 6e 73 74 20 63 68 61 72 20 2a 7a 4d 65 74 68 6f  nst char *zMetho
1340: 64 3b 0a 20 20 69 66 28 20 67 2e 61 72 67 63 3c  d;.  if( g.argc<
1350: 33 20 29 7b 0a 20 20 20 20 75 73 61 67 65 28 22  3 ){.    usage("
1360: 4d 45 54 48 4f 44 20 2e 2e 2e 22 29 3b 0a 20 20  METHOD ...");.  
1370: 7d 0a 20 20 64 62 5f 66 69 6e 64 5f 61 6e 64 5f  }.  db_find_and_
1380: 6f 70 65 6e 5f 72 65 70 6f 73 69 74 6f 72 79 28  open_repository(
1390: 31 29 3b 0a 20 20 7a 4d 65 74 68 6f 64 20 3d 20  1);.  zMethod = 
13a0: 67 2e 61 72 67 76 5b 32 5d 3b 0a 20 20 6e 20 3d  g.argv[2];.  n =
13b0: 20 73 74 72 6c 65 6e 28 7a 4d 65 74 68 6f 64 29   strlen(zMethod)
13c0: 3b 0a 20 20 69 66 28 20 73 74 72 6e 63 6d 70 28  ;.  if( strncmp(
13d0: 7a 4d 65 74 68 6f 64 2c 20 22 65 78 70 6f 72 74  zMethod, "export
13e0: 22 2c 20 6e 29 3d 3d 30 20 29 7b 0a 20 20 20 20  ", n)==0 ){.    
13f0: 69 6e 74 20 69 3b 0a 20 20 20 20 69 6e 74 20 6d  int i;.    int m
1400: 61 73 6b 3b 0a 20 20 20 20 63 6f 6e 73 74 20 63  ask;.    const c
1410: 68 61 72 20 2a 7a 53 65 70 3b 0a 20 20 20 20 42  har *zSep;.    B
1420: 6c 6f 62 20 73 71 6c 3b 0a 20 20 20 20 53 74 6d  lob sql;.    Stm
1430: 74 20 71 3b 0a 20 20 20 20 42 6c 6f 62 20 6f 75  t q;.    Blob ou
1440: 74 3b 0a 20 20 20 20 69 66 28 20 67 2e 61 72 67  t;.    if( g.arg
1450: 63 21 3d 35 20 29 7b 0a 20 20 20 20 20 20 75 73  c!=5 ){.      us
1460: 61 67 65 28 22 65 78 70 6f 72 74 20 41 52 45 41  age("export AREA
1470: 20 46 49 4c 45 4e 41 4d 45 22 29 3b 0a 20 20 20   FILENAME");.   
1480: 20 7d 0a 20 20 20 20 6d 61 73 6b 20 3d 20 66 69   }.    mask = fi
1490: 6e 64 5f 61 72 65 61 28 67 2e 61 72 67 76 5b 33  nd_area(g.argv[3
14a0: 5d 29 3b 0a 20 20 20 20 62 6c 6f 62 5f 7a 65 72  ]);.    blob_zer
14b0: 6f 28 26 73 71 6c 29 3b 0a 20 20 20 20 62 6c 6f  o(&sql);.    blo
14c0: 62 5f 7a 65 72 6f 28 26 6f 75 74 29 3b 0a 20 20  b_zero(&out);.  
14d0: 20 20 62 6c 6f 62 5f 61 70 70 65 6e 64 66 28 26    blob_appendf(&
14e0: 73 71 6c 2c 20 0a 20 20 20 20 20 20 20 22 53 45  sql, .       "SE
14f0: 4c 45 43 54 20 27 52 45 50 4c 41 43 45 20 49 4e  LECT 'REPLACE IN
1500: 54 4f 20 63 6f 6e 66 69 67 28 6e 61 6d 65 2c 76  TO config(name,v
1510: 61 6c 75 65 29 20 56 41 4c 55 45 53 28 27 27 27  alue) VALUES('''
1520: 22 0a 20 20 20 20 20 20 20 22 20 20 20 20 20 20  ".       "      
1530: 20 20 20 7c 7c 20 6e 61 6d 65 20 7c 7c 20 27 27     || name || ''
1540: 27 2c 27 20 7c 7c 20 71 75 6f 74 65 28 76 61 6c  ',' || quote(val
1550: 75 65 29 20 7c 7c 20 27 29 3b 27 22 0a 20 20 20  ue) || ');'".   
1560: 20 20 20 20 22 20 20 46 52 4f 4d 20 63 6f 6e 66      "  FROM conf
1570: 69 67 20 57 48 45 52 45 20 6e 61 6d 65 20 49 4e  ig WHERE name IN
1580: 20 22 0a 20 20 20 20 29 3b 0a 20 20 20 20 7a 53   ".    );.    zS
1590: 65 70 20 3d 20 22 28 22 3b 0a 20 20 20 20 66 6f  ep = "(";.    fo
15a0: 72 28 69 3d 30 3b 20 69 3c 63 6f 75 6e 74 28 61  r(i=0; i<count(a
15b0: 43 6f 6e 66 69 67 29 3b 20 69 2b 2b 29 7b 0a 20  Config); i++){. 
15c0: 20 20 20 20 20 69 66 28 20 61 43 6f 6e 66 69 67       if( aConfig
15d0: 5b 69 5d 2e 67 72 6f 75 70 4d 61 73 6b 20 26 20  [i].groupMask & 
15e0: 6d 61 73 6b 20 29 7b 0a 20 20 20 20 20 20 20 20  mask ){.        
15f0: 62 6c 6f 62 5f 61 70 70 65 6e 64 66 28 26 73 71  blob_appendf(&sq
1600: 6c 2c 20 22 25 73 27 25 73 27 22 2c 20 7a 53 65  l, "%s'%s'", zSe
1610: 70 2c 20 61 43 6f 6e 66 69 67 5b 69 5d 2e 7a 4e  p, aConfig[i].zN
1620: 61 6d 65 29 3b 0a 20 20 20 20 20 20 20 20 7a 53  ame);.        zS
1630: 65 70 20 3d 20 22 2c 22 3b 0a 20 20 20 20 20 20  ep = ",";.      
1640: 7d 0a 20 20 20 20 7d 0a 20 20 20 20 62 6c 6f 62  }.    }.    blob
1650: 5f 61 70 70 65 6e 64 66 28 26 73 71 6c 2c 20 22  _appendf(&sql, "
1660: 29 20 4f 52 44 45 52 20 42 59 20 6e 61 6d 65 22  ) ORDER BY name"
1670: 29 3b 0a 20 20 20 20 64 62 5f 70 72 65 70 61 72  );.    db_prepar
1680: 65 28 26 71 2c 20 62 6c 6f 62 5f 73 74 72 28 26  e(&q, blob_str(&
1690: 73 71 6c 29 29 3b 0a 20 20 20 20 62 6c 6f 62 5f  sql));.    blob_
16a0: 72 65 73 65 74 28 26 73 71 6c 29 3b 0a 20 20 20  reset(&sql);.   
16b0: 20 62 6c 6f 62 5f 61 70 70 65 6e 64 66 28 26 6f   blob_appendf(&o
16c0: 75 74 2c 20 0a 20 20 20 20 20 20 20 20 22 2d 2d  ut, .        "--
16d0: 20 54 68 65 20 5c 22 25 73 5c 22 20 63 6f 6e 66   The \"%s\" conf
16e0: 69 67 75 72 61 74 69 6f 6e 20 65 78 70 6f 72 74  iguration export
16f0: 65 64 20 66 72 6f 6d 5c 6e 22 0a 20 20 20 20 20  ed from\n".     
1700: 20 20 20 22 2d 2d 20 72 65 70 6f 73 69 74 6f 72     "-- repositor
1710: 79 20 5c 22 25 73 5c 22 5c 6e 22 0a 20 20 20 20  y \"%s\"\n".    
1720: 20 20 20 20 22 2d 2d 20 6f 6e 20 25 73 5c 6e 22      "-- on %s\n"
1730: 2c 0a 20 20 20 20 20 20 20 20 67 2e 61 72 67 76  ,.        g.argv
1740: 5b 33 5d 2c 20 67 2e 7a 52 65 70 6f 73 69 74 6f  [3], g.zReposito
1750: 72 79 4e 61 6d 65 2c 0a 20 20 20 20 20 20 20 20  ryName,.        
1760: 64 62 5f 74 65 78 74 28 30 2c 20 22 53 45 4c 45  db_text(0, "SELE
1770: 43 54 20 64 61 74 65 74 69 6d 65 28 27 6e 6f 77  CT datetime('now
1780: 27 29 22 29 0a 20 20 20 20 29 3b 0a 20 20 20 20  ')").    );.    
1790: 77 68 69 6c 65 28 20 64 62 5f 73 74 65 70 28 26  while( db_step(&
17a0: 71 29 3d 3d 53 51 4c 49 54 45 5f 52 4f 57 20 29  q)==SQLITE_ROW )
17b0: 7b 0a 20 20 20 20 20 20 62 6c 6f 62 5f 61 70 70  {.      blob_app
17c0: 65 6e 64 66 28 26 6f 75 74 2c 20 22 25 73 5c 6e  endf(&out, "%s\n
17d0: 22 2c 20 64 62 5f 63 6f 6c 75 6d 6e 5f 74 65 78  ", db_column_tex
17e0: 74 28 26 71 2c 20 30 29 29 3b 0a 20 20 20 20 7d  t(&q, 0));.    }
17f0: 0a 20 20 20 20 64 62 5f 66 69 6e 61 6c 69 7a 65  .    db_finalize
1800: 28 26 71 29 3b 0a 20 20 20 20 62 6c 6f 62 5f 77  (&q);.    blob_w
1810: 72 69 74 65 5f 74 6f 5f 66 69 6c 65 28 26 6f 75  rite_to_file(&ou
1820: 74 2c 20 67 2e 61 72 67 76 5b 34 5d 29 3b 0a 20  t, g.argv[4]);. 
1830: 20 20 20 62 6c 6f 62 5f 72 65 73 65 74 28 26 6f     blob_reset(&o
1840: 75 74 29 3b 0a 20 20 7d 65 6c 73 65 0a 20 20 69  ut);.  }else.  i
1850: 66 28 20 73 74 72 6e 63 6d 70 28 7a 4d 65 74 68  f( strncmp(zMeth
1860: 6f 64 2c 20 22 69 6d 70 6f 72 74 22 2c 20 6e 29  od, "import", n)
1870: 3d 3d 30 20 29 7b 0a 20 20 20 20 42 6c 6f 62 20  ==0 ){.    Blob 
1880: 69 6e 3b 0a 20 20 20 20 69 66 28 20 67 2e 61 72  in;.    if( g.ar
1890: 67 63 21 3d 34 20 29 20 75 73 61 67 65 28 22 69  gc!=4 ) usage("i
18a0: 6d 70 6f 72 74 20 46 49 4c 45 4e 41 4d 45 22 29  mport FILENAME")
18b0: 3b 0a 20 20 20 20 62 6c 6f 62 5f 72 65 61 64 5f  ;.    blob_read_
18c0: 66 72 6f 6d 5f 66 69 6c 65 28 26 69 6e 2c 20 67  from_file(&in, g
18d0: 2e 61 72 67 76 5b 33 5d 29 3b 0a 20 20 20 20 64  .argv[3]);.    d
18e0: 62 5f 62 65 67 69 6e 5f 74 72 61 6e 73 61 63 74  b_begin_transact
18f0: 69 6f 6e 28 29 3b 0a 20 20 20 20 64 62 5f 6d 75  ion();.    db_mu
1900: 6c 74 69 5f 65 78 65 63 28 22 25 73 22 2c 20 62  lti_exec("%s", b
1910: 6c 6f 62 5f 73 74 72 28 26 69 6e 29 29 3b 0a 20  lob_str(&in));. 
1920: 20 20 20 64 62 5f 65 6e 64 5f 74 72 61 6e 73 61     db_end_transa
1930: 63 74 69 6f 6e 28 30 29 3b 0a 20 20 7d 65 6c 73  ction(0);.  }els
1940: 65 0a 20 20 69 66 28 20 73 74 72 6e 63 6d 70 28  e.  if( strncmp(
1950: 7a 4d 65 74 68 6f 64 2c 20 22 70 75 6c 6c 22 2c  zMethod, "pull",
1960: 20 6e 29 3d 3d 30 20 29 7b 0a 20 20 20 20 69 6e   n)==0 ){.    in
1970: 74 20 6d 61 73 6b 3b 0a 20 20 20 20 75 72 6c 5f  t mask;.    url_
1980: 70 72 6f 78 79 5f 6f 70 74 69 6f 6e 73 28 29 3b  proxy_options();
1990: 0a 20 20 20 20 69 66 28 20 67 2e 61 72 67 63 21  .    if( g.argc!
19a0: 3d 35 20 29 20 75 73 61 67 65 28 22 70 75 6c 6c  =5 ) usage("pull
19b0: 20 41 52 45 41 20 55 52 4c 22 29 3b 0a 20 20 20   AREA URL");.   
19c0: 20 6d 61 73 6b 20 3d 20 66 69 6e 64 5f 61 72 65   mask = find_are
19d0: 61 28 67 2e 61 72 67 76 5b 33 5d 29 3b 0a 20 20  a(g.argv[3]);.  
19e0: 20 20 75 72 6c 5f 70 61 72 73 65 28 67 2e 61 72    url_parse(g.ar
19f0: 67 76 5b 34 5d 29 3b 0a 20 20 20 20 69 66 28 20  gv[4]);.    if( 
1a00: 67 2e 75 72 6c 49 73 46 69 6c 65 20 29 7b 0a 20  g.urlIsFile ){. 
1a10: 20 20 20 20 20 66 6f 73 73 69 6c 5f 66 61 74 61       fossil_fata
1a20: 6c 28 22 6e 65 74 77 6f 72 6b 20 73 79 6e 63 20  l("network sync 
1a30: 6f 6e 6c 79 22 29 3b 0a 20 20 20 20 7d 0a 20 20  only");.    }.  
1a40: 20 20 75 73 65 72 5f 73 65 6c 65 63 74 28 29 3b    user_select();
1a50: 0a 20 20 20 20 63 6c 69 65 6e 74 5f 73 79 6e 63  .    client_sync
1a60: 28 30 2c 30 2c 30 2c 6d 61 73 6b 29 3b 0a 20 20  (0,0,0,mask);.  
1a70: 7d 65 6c 73 65 0a 20 20 69 66 28 20 73 74 72 6e  }else.  if( strn
1a80: 63 6d 70 28 7a 4d 65 74 68 6f 64 2c 20 22 72 65  cmp(zMethod, "re
1a90: 73 65 74 22 2c 20 6e 29 3d 3d 30 20 29 7b 0a 20  set", n)==0 ){. 
1aa0: 20 20 20 69 6e 74 20 6d 61 73 6b 2c 20 69 3b 0a     int mask, i;.
1ab0: 20 20 20 20 69 66 28 20 67 2e 61 72 67 63 21 3d      if( g.argc!=
1ac0: 34 20 29 20 75 73 61 67 65 28 22 72 65 73 65 74  4 ) usage("reset
1ad0: 20 41 52 45 41 22 29 3b 0a 20 20 20 20 6d 61 73   AREA");.    mas
1ae0: 6b 20 3d 20 66 69 6e 64 5f 61 72 65 61 28 67 2e  k = find_area(g.
1af0: 61 72 67 76 5b 33 5d 29 3b 0a 20 20 20 20 64 62  argv[3]);.    db
1b00: 5f 62 65 67 69 6e 5f 74 72 61 6e 73 61 63 74 69  _begin_transacti
1b10: 6f 6e 28 29 3b 0a 20 20 20 20 66 6f 72 28 69 3d  on();.    for(i=
1b20: 30 3b 20 69 3c 63 6f 75 6e 74 28 61 43 6f 6e 66  0; i<count(aConf
1b30: 69 67 29 3b 20 69 2b 2b 29 7b 0a 20 20 20 20 20  ig); i++){.     
1b40: 20 69 66 28 20 28 61 43 6f 6e 66 69 67 5b 69 5d   if( (aConfig[i]
1b50: 2e 67 72 6f 75 70 4d 61 73 6b 20 26 20 6d 61 73  .groupMask & mas
1b60: 6b 29 3d 3d 30 20 29 20 63 6f 6e 74 69 6e 75 65  k)==0 ) continue
1b70: 3b 0a 20 20 20 20 20 20 64 62 5f 6d 75 6c 74 69  ;.      db_multi
1b80: 5f 65 78 65 63 28 22 44 45 4c 45 54 45 20 46 52  _exec("DELETE FR
1b90: 4f 4d 20 63 6f 6e 66 69 67 20 57 48 45 52 45 20  OM config WHERE 
1ba0: 6e 61 6d 65 3d 25 51 22 2c 20 61 43 6f 6e 66 69  name=%Q", aConfi
1bb0: 67 5b 69 5d 2e 7a 4e 61 6d 65 29 3b 0a 20 20 20  g[i].zName);.   
1bc0: 20 7d 0a 20 20 20 20 64 62 5f 65 6e 64 5f 74 72   }.    db_end_tr
1bd0: 61 6e 73 61 63 74 69 6f 6e 28 30 29 3b 0a 20 20  ansaction(0);.  
1be0: 7d 65 6c 73 65 0a 20 20 7b 0a 20 20 20 20 66 6f  }else.  {.    fo
1bf0: 73 73 69 6c 5f 66 61 74 61 6c 28 22 4d 45 54 48  ssil_fatal("METH
1c00: 4f 44 20 73 68 6f 75 6c 64 20 62 65 20 6f 6e 65  OD should be one
1c10: 20 6f 66 3a 20 20 65 78 70 6f 72 74 20 69 6d 70   of:  export imp
1c20: 6f 72 74 20 70 75 6c 6c 20 72 65 73 65 74 22 29  ort pull reset")
1c30: 3b 0a 20 20 7d 0a 7d 0a                          ;.  }.}.