Hex Artifact Content
Not logged in

Artifact 0c75447b9be29570ec2cdd856af47484b4bb1318:

File src/checkout.c part of check-in [ab6a293182] - fix for ticket 8832434e32, wrong args for checkoutable() by bch on 2009-04-19 06:14:53.

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 63 68 65 63 6b 2d 6f 75 74  sed to check-out
0390: 20 76 65 72 73 69 6f 6e 73 20 6f 66 20 74 68 65   versions of the
03a0: 20 70 72 6f 6a 65 63 74 0a 2a 2a 20 66 72 6f 6d   project.** from
03b0: 20 74 68 65 20 6c 6f 63 61 6c 20 72 65 70 6f 73   the local repos
03c0: 69 74 6f 72 79 2e 0a 2a 2f 0a 23 69 6e 63 6c 75  itory..*/.#inclu
03d0: 64 65 20 22 63 6f 6e 66 69 67 2e 68 22 0a 23 69  de "config.h".#i
03e0: 6e 63 6c 75 64 65 20 22 63 68 65 63 6b 6f 75 74  nclude "checkout
03f0: 2e 68 22 0a 23 69 6e 63 6c 75 64 65 20 3c 61 73  .h".#include <as
0400: 73 65 72 74 2e 68 3e 0a 0a 2f 2a 0a 2a 2a 20 43  sert.h>../*.** C
0410: 68 65 63 6b 20 74 6f 20 73 65 65 20 69 66 20 74  heck to see if t
0420: 68 65 72 65 20 69 73 20 61 6e 20 65 78 69 73 74  here is an exist
0430: 69 6e 67 20 63 68 65 63 6b 6f 75 74 20 74 68 61  ing checkout tha
0440: 74 20 68 61 73 20 62 65 65 6e 0a 2a 2a 20 6d 6f  t has been.** mo
0450: 64 69 66 69 65 64 2e 20 20 52 65 74 75 72 6e 20  dified.  Return 
0460: 76 61 6c 75 65 73 3a 0a 2a 2a 0a 2a 2a 20 20 20  values:.**.**   
0470: 20 20 30 3a 20 20 20 54 68 65 72 65 20 69 73 20    0:   There is 
0480: 61 6e 20 65 78 69 73 74 69 6e 67 20 63 68 65 63  an existing chec
0490: 6b 6f 75 74 20 62 75 74 20 69 74 20 69 73 20 75  kout but it is u
04a0: 6e 6d 6f 64 69 66 69 65 64 0a 2a 2a 20 20 20 20  nmodified.**    
04b0: 20 31 3a 20 20 20 54 68 65 72 65 20 69 73 20 61   1:   There is a
04c0: 20 6d 6f 64 69 66 69 65 64 20 63 68 65 63 6b 6f   modified checko
04d0: 75 74 20 2d 20 74 68 65 72 65 20 61 72 65 20 75  ut - there are u
04e0: 6e 73 61 76 65 64 20 63 68 61 6e 67 65 73 0a 2a  nsaved changes.*
04f0: 2a 20 20 20 20 20 32 3a 20 20 20 54 68 65 72 65  *     2:   There
0500: 20 69 73 20 6e 6f 20 65 78 69 73 74 69 6e 67 20   is no existing 
0510: 63 68 65 63 6b 6f 75 74 0a 2a 2f 0a 69 6e 74 20  checkout.*/.int 
0520: 75 6e 73 61 76 65 64 5f 63 68 61 6e 67 65 73 28  unsaved_changes(
0530: 76 6f 69 64 29 7b 0a 20 20 69 6e 74 20 76 69 64  void){.  int vid
0540: 3b 0a 20 20 64 62 5f 6d 75 73 74 5f 62 65 5f 77  ;.  db_must_be_w
0550: 69 74 68 69 6e 5f 74 72 65 65 28 29 3b 0a 20 20  ithin_tree();.  
0560: 76 69 64 20 3d 20 64 62 5f 6c 67 65 74 5f 69 6e  vid = db_lget_in
0570: 74 28 22 63 68 65 63 6b 6f 75 74 22 2c 30 29 3b  t("checkout",0);
0580: 0a 20 20 69 66 28 20 76 69 64 3d 3d 30 20 29 20  .  if( vid==0 ) 
0590: 72 65 74 75 72 6e 20 32 3b 0a 20 20 76 66 69 6c  return 2;.  vfil
05a0: 65 5f 63 68 65 63 6b 5f 73 69 67 6e 61 74 75 72  e_check_signatur
05b0: 65 28 76 69 64 29 3b 0a 20 20 72 65 74 75 72 6e  e(vid);.  return
05c0: 20 64 62 5f 65 78 69 73 74 73 28 22 53 45 4c 45   db_exists("SELE
05d0: 43 54 20 31 20 46 52 4f 4d 20 76 66 69 6c 65 20  CT 1 FROM vfile 
05e0: 57 48 45 52 45 20 63 68 6e 67 65 64 22 0a 20 20  WHERE chnged".  
05f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0600: 20 22 20 4f 52 20 63 6f 61 6c 65 73 63 65 28 6f   " OR coalesce(o
0610: 72 69 67 6e 61 6d 65 21 3d 70 61 74 68 6e 61 6d  rigname!=pathnam
0620: 65 2c 30 29 22 29 3b 0a 7d 0a 0a 2f 2a 0a 2a 2a  e,0)");.}../*.**
0630: 20 43 68 65 63 6b 20 74 6f 20 73 65 65 20 69 66   Check to see if
0640: 20 74 68 65 20 72 65 71 75 65 73 74 65 64 20 63   the requested c
0650: 6f 20 69 73 20 69 6e 20 66 61 63 74 20 22 63 68  o is in fact "ch
0660: 65 63 6b 6f 75 74 2d 61 62 6c 65 22 0a 2a 2a 20  eckout-able".** 
0670: 52 65 74 75 72 6e 20 76 61 6c 75 65 73 3a 0a 2a  Return values:.*
0680: 2a 20 20 20 30 3a 20 4e 6f 74 20 63 68 65 63 6b  *   0: Not check
0690: 6f 75 74 2d 61 62 6c 65 20 28 64 6f 65 73 20 6e  out-able (does n
06a0: 6f 74 20 65 78 69 73 74 2c 20 6f 72 20 69 73 20  ot exist, or is 
06b0: 6e 6f 74 20 61 6e 20 6f 6e 2d 64 69 73 6b 20 61  not an on-disk a
06c0: 72 74 69 66 61 63 74 29 0a 2a 2a 20 20 20 31 3a  rtifact).**   1:
06d0: 20 49 73 20 63 68 65 63 6b 6f 75 74 2d 61 62 6c   Is checkout-abl
06e0: 65 2e 0a 2a 2f 0a 69 6e 74 20 63 68 65 63 6b 6f  e..*/.int checko
06f0: 75 74 61 62 6c 65 28 63 6f 6e 73 74 20 63 68 61  utable(const cha
0700: 72 20 2a 7a 4e 61 6d 65 29 7b 0a 20 20 69 6e 74  r *zName){.  int
0710: 20 72 63 3d 31 3b 20 2f 2a 20 61 73 73 75 6d 69   rc=1; /* assumi
0720: 6e 67 20 69 73 20 63 68 65 63 6b 6f 75 74 2d 61  ng is checkout-a
0730: 62 6c 65 20 2a 2f 0a 20 20 42 6c 6f 62 20 75 75  ble */.  Blob uu
0740: 69 64 3b 0a 20 20 63 6f 6e 73 74 20 63 68 61 72  id;.  const char
0750: 20 2a 72 69 64 3d 28 63 68 61 72 20 2a 29 4e 55   *rid=(char *)NU
0760: 4c 4c 3b 0a 20 20 53 74 6d 74 20 71 3b 20 2f 2f  LL;.  Stmt q; //
0770: 20 64 62 20 71 75 65 72 79 0a 20 20 63 68 61 72   db query.  char
0780: 20 2a 7a 53 51 4c 3b 20 2f 2f 62 75 69 6c 64 2d   *zSQL; //build-
0790: 75 70 20 73 71 6c 0a 0a 20 20 2f 2f 20 20 7a 53  up sql..  //  zS
07a0: 51 4c 20 3d 20 6d 70 72 69 6e 74 66 28 29 3b 0a  QL = mprintf();.
07b0: 0a 20 20 2f 2f 20 5b 63 72 65 61 74 65 20 73 71  .  // [create sq
07c0: 6c 20 73 74 61 74 65 6d 65 6e 74 5d 0a 20 20 2f  l statement].  /
07d0: 2f 20 64 62 5f 70 72 65 70 61 72 65 28 26 71 2c  / db_prepare(&q,
07e0: 73 71 6c 73 74 6d 74 29 3b 0a 0a 20 20 62 6c 6f  sqlstmt);..  blo
07f0: 62 5f 69 6e 69 74 28 26 75 75 69 64 2c 20 7a 4e  b_init(&uuid, zN
0800: 61 6d 65 2c 20 2d 31 29 3b 0a 20 20 69 66 28 20  ame, -1);.  if( 
0810: 6e 61 6d 65 5f 74 6f 5f 75 75 69 64 28 26 75 75  name_to_uuid(&uu
0820: 69 64 2c 20 31 29 20 29 7b 0a 20 20 20 20 66 6f  id, 1) ){.    fo
0830: 73 73 69 6c 5f 70 61 6e 69 63 28 67 2e 7a 45 72  ssil_panic(g.zEr
0840: 72 4d 73 67 29 3b 0a 20 20 7d 0a 0a 20 20 2f 2a  rMsg);.  }..  /*
0850: 20 20 6e 50 61 72 65 6e 74 3d 64 62 5f 74 65 78    nParent=db_tex
0860: 74 28 30 2c 22 73 65 6c 65 63 74 20 72 69 64 20  t(0,"select rid 
0870: 66 72 6f 6d 20 62 6c 6f 62 20 77 68 65 72 65 20  from blob where 
0880: 75 75 69 64 3d 25 73 22 2c 75 75 69 64 2e 6e 61  uuid=%s",uuid.na
0890: 6d 65 6f 66 6f 62 6a 29 3b 20 2a 2f 0a 0a 20 20  meofobj); */..  
08a0: 2f 2a 20 20 69 6e 74 20 6e 50 61 72 65 6e 74 20  /*  int nParent 
08b0: 3d 20 64 62 5f 63 6f 6c 75 6d 6e 5f 69 6e 74 28  = db_column_int(
08c0: 71 2c 20 73 6f 6d 65 6e 75 6d 29 3b 20 2a 2f 0a  q, somenum); */.
08d0: 20 20 72 65 74 75 72 6e 20 72 63 3b 0a 7d 0a 0a    return rc;.}..
08e0: 0a 2f 2a 0a 2a 2a 20 55 6e 64 6f 20 74 68 65 20  ./*.** Undo the 
08f0: 63 75 72 72 65 6e 74 20 63 68 65 63 6b 2d 6f 75  current check-ou
0900: 74 2e 20 20 55 6e 6c 69 6e 6b 20 61 6c 6c 20 66  t.  Unlink all f
0910: 69 6c 65 73 20 66 72 6f 6d 20 74 68 65 20 64 69  iles from the di
0920: 73 6b 2e 0a 2a 2a 20 43 6c 65 61 72 20 74 68 65  sk..** Clear the
0930: 20 56 46 49 4c 45 20 74 61 62 6c 65 2e 0a 2a 2f   VFILE table..*/
0940: 0a 76 6f 69 64 20 75 6e 63 68 65 63 6b 6f 75 74  .void uncheckout
0950: 28 69 6e 74 20 76 69 64 29 7b 0a 20 20 69 66 28  (int vid){.  if(
0960: 20 76 69 64 3d 3d 30 20 29 20 72 65 74 75 72 6e   vid==0 ) return
0970: 3b 0a 20 20 76 66 69 6c 65 5f 75 6e 6c 69 6e 6b  ;.  vfile_unlink
0980: 28 76 69 64 29 3b 0a 20 20 64 62 5f 6d 75 6c 74  (vid);.  db_mult
0990: 69 5f 65 78 65 63 28 22 44 45 4c 45 54 45 20 46  i_exec("DELETE F
09a0: 52 4f 4d 20 76 66 69 6c 65 20 57 48 45 52 45 20  ROM vfile WHERE 
09b0: 76 69 64 3d 25 64 22 2c 20 76 69 64 29 3b 0a 7d  vid=%d", vid);.}
09c0: 0a 0a 0a 2f 2a 0a 2a 2a 20 47 69 76 65 6e 20 74  .../*.** Given t
09d0: 68 65 20 61 62 62 72 65 76 69 61 74 65 64 20 55  he abbreviated U
09e0: 55 49 44 20 6e 61 6d 65 20 6f 66 20 61 20 76 65  UID name of a ve
09f0: 72 73 69 6f 6e 2c 20 6c 6f 61 64 20 74 68 65 20  rsion, load the 
0a00: 63 6f 6e 74 65 6e 74 20 6f 66 20 74 68 61 74 0a  content of that.
0a10: 2a 2a 20 76 65 72 73 69 6f 6e 20 69 6e 20 74 68  ** version in th
0a20: 65 20 56 46 49 4c 45 20 74 61 62 6c 65 2e 20 20  e VFILE table.  
0a30: 52 65 74 75 72 6e 20 74 68 65 20 56 49 44 20 66  Return the VID f
0a40: 6f 72 20 74 68 65 20 76 65 72 73 69 6f 6e 2e 0a  or the version..
0a50: 2a 2a 0a 2a 2a 20 49 66 20 61 6e 79 74 68 69 6e  **.** If anythin
0a60: 67 20 67 6f 65 73 20 77 72 6f 6e 67 2c 20 70 61  g goes wrong, pa
0a70: 6e 69 63 2e 0a 2a 2f 0a 69 6e 74 20 6c 6f 61 64  nic..*/.int load
0a80: 5f 76 66 69 6c 65 28 63 6f 6e 73 74 20 63 68 61  _vfile(const cha
0a90: 72 20 2a 7a 4e 61 6d 65 29 7b 0a 20 20 42 6c 6f  r *zName){.  Blo
0aa0: 62 20 75 75 69 64 3b 0a 20 20 69 6e 74 20 76 69  b uuid;.  int vi
0ab0: 64 3b 0a 0a 20 20 62 6c 6f 62 5f 69 6e 69 74 28  d;..  blob_init(
0ac0: 26 75 75 69 64 2c 20 7a 4e 61 6d 65 2c 20 2d 31  &uuid, zName, -1
0ad0: 29 3b 0a 20 20 69 66 28 20 6e 61 6d 65 5f 74 6f  );.  if( name_to
0ae0: 5f 75 75 69 64 28 26 75 75 69 64 2c 20 31 29 20  _uuid(&uuid, 1) 
0af0: 29 7b 0a 20 20 20 20 66 6f 73 73 69 6c 5f 70 61  ){.    fossil_pa
0b00: 6e 69 63 28 67 2e 7a 45 72 72 4d 73 67 29 3b 0a  nic(g.zErrMsg);.
0b10: 20 20 7d 0a 20 20 76 69 64 20 3d 20 64 62 5f 69    }.  vid = db_i
0b20: 6e 74 28 30 2c 20 22 53 45 4c 45 43 54 20 72 69  nt(0, "SELECT ri
0b30: 64 20 46 52 4f 4d 20 62 6c 6f 62 20 57 48 45 52  d FROM blob WHER
0b40: 45 20 75 75 69 64 3d 25 42 22 2c 20 26 75 75 69  E uuid=%B", &uui
0b50: 64 29 3b 0a 20 20 69 66 28 20 76 69 64 3d 3d 30  d);.  if( vid==0
0b60: 20 29 7b 0a 20 20 20 20 66 6f 73 73 69 6c 5f 70   ){.    fossil_p
0b70: 61 6e 69 63 28 22 6e 6f 20 73 75 63 68 20 76 65  anic("no such ve
0b80: 72 73 69 6f 6e 3a 20 25 73 22 2c 20 67 2e 61 72  rsion: %s", g.ar
0b90: 67 76 5b 32 5d 29 3b 0a 20 20 7d 0a 20 20 6c 6f  gv[2]);.  }.  lo
0ba0: 61 64 5f 76 66 69 6c 65 5f 66 72 6f 6d 5f 72 69  ad_vfile_from_ri
0bb0: 64 28 76 69 64 29 3b 0a 20 20 72 65 74 75 72 6e  d(vid);.  return
0bc0: 20 76 69 64 3b 0a 7d 0a 0a 2f 2a 0a 2a 2a 20 4c   vid;.}../*.** L
0bd0: 6f 61 64 20 61 20 76 66 69 6c 65 20 66 72 6f 6d  oad a vfile from
0be0: 20 61 20 72 65 63 6f 72 64 20 49 44 2e 0a 2a 2f   a record ID..*/
0bf0: 0a 76 6f 69 64 20 6c 6f 61 64 5f 76 66 69 6c 65  .void load_vfile
0c00: 5f 66 72 6f 6d 5f 72 69 64 28 69 6e 74 20 76 69  _from_rid(int vi
0c10: 64 29 7b 0a 20 20 42 6c 6f 62 20 6d 61 6e 69 66  d){.  Blob manif
0c20: 65 73 74 3b 0a 0a 20 20 69 66 28 20 64 62 5f 65  est;..  if( db_e
0c30: 78 69 73 74 73 28 22 53 45 4c 45 43 54 20 31 20  xists("SELECT 1 
0c40: 46 52 4f 4d 20 76 66 69 6c 65 20 57 48 45 52 45  FROM vfile WHERE
0c50: 20 76 69 64 3d 25 64 22 2c 20 76 69 64 29 20 29   vid=%d", vid) )
0c60: 7b 0a 20 20 20 20 72 65 74 75 72 6e 3b 0a 20 20  {.    return;.  
0c70: 7d 0a 20 20 63 6f 6e 74 65 6e 74 5f 67 65 74 28  }.  content_get(
0c80: 76 69 64 2c 20 26 6d 61 6e 69 66 65 73 74 29 3b  vid, &manifest);
0c90: 0a 20 20 76 66 69 6c 65 5f 62 75 69 6c 64 28 76  .  vfile_build(v
0ca0: 69 64 2c 20 26 6d 61 6e 69 66 65 73 74 29 3b 0a  id, &manifest);.
0cb0: 20 20 62 6c 6f 62 5f 72 65 73 65 74 28 26 6d 61    blob_reset(&ma
0cc0: 6e 69 66 65 73 74 29 3b 0a 7d 0a 0a 2f 2a 0a 2a  nifest);.}../*.*
0cd0: 2a 20 52 65 61 64 20 74 68 65 20 6d 61 6e 69 66  * Read the manif
0ce0: 65 73 74 20 66 69 6c 65 20 67 69 76 65 6e 20 62  est file given b
0cf0: 79 20 76 69 64 20 6f 75 74 20 6f 66 20 74 68 65  y vid out of the
0d00: 20 72 65 70 6f 73 69 74 6f 72 79 0a 2a 2a 20 61   repository.** a
0d10: 6e 64 20 73 74 6f 72 65 20 69 74 20 69 6e 20 74  nd store it in t
0d20: 68 65 20 72 6f 6f 74 20 6f 66 20 74 68 65 20 6c  he root of the l
0d30: 6f 63 61 6c 20 63 68 65 63 6b 2d 6f 75 74 2e 0a  ocal check-out..
0d40: 2a 2f 0a 76 6f 69 64 20 6d 61 6e 69 66 65 73 74  */.void manifest
0d50: 5f 74 6f 5f 64 69 73 6b 28 69 6e 74 20 76 69 64  _to_disk(int vid
0d60: 29 7b 0a 20 20 63 68 61 72 20 2a 7a 4d 61 6e 46  ){.  char *zManF
0d70: 69 6c 65 3b 0a 20 20 42 6c 6f 62 20 6d 61 6e 69  ile;.  Blob mani
0d80: 66 65 73 74 3b 0a 20 20 42 6c 6f 62 20 68 61 73  fest;.  Blob has
0d90: 68 3b 0a 20 20 42 6c 6f 62 20 66 69 6c 65 6e 61  h;.  Blob filena
0da0: 6d 65 3b 0a 20 20 69 6e 74 20 62 61 73 65 4c 65  me;.  int baseLe
0db0: 6e 3b 0a 20 20 69 6e 74 20 69 3b 0a 20 20 4d 61  n;.  int i;.  Ma
0dc0: 6e 69 66 65 73 74 20 6d 3b 0a 0a 20 20 62 6c 6f  nifest m;..  blo
0dd0: 62 5f 7a 65 72 6f 28 26 6d 61 6e 69 66 65 73 74  b_zero(&manifest
0de0: 29 3b 0a 20 20 7a 4d 61 6e 46 69 6c 65 20 3d 20  );.  zManFile = 
0df0: 6d 70 72 69 6e 74 66 28 22 25 73 6d 61 6e 69 66  mprintf("%smanif
0e00: 65 73 74 22 2c 20 67 2e 7a 4c 6f 63 61 6c 52 6f  est", g.zLocalRo
0e10: 6f 74 29 3b 0a 20 20 63 6f 6e 74 65 6e 74 5f 67  ot);.  content_g
0e20: 65 74 28 76 69 64 2c 20 26 6d 61 6e 69 66 65 73  et(vid, &manifes
0e30: 74 29 3b 0a 20 20 62 6c 6f 62 5f 77 72 69 74 65  t);.  blob_write
0e40: 5f 74 6f 5f 66 69 6c 65 28 26 6d 61 6e 69 66 65  _to_file(&manife
0e50: 73 74 2c 20 7a 4d 61 6e 46 69 6c 65 29 3b 0a 20  st, zManFile);. 
0e60: 20 66 72 65 65 28 7a 4d 61 6e 46 69 6c 65 29 3b   free(zManFile);
0e70: 0a 20 20 62 6c 6f 62 5f 7a 65 72 6f 28 26 68 61  .  blob_zero(&ha
0e80: 73 68 29 3b 0a 20 20 73 68 61 31 73 75 6d 5f 62  sh);.  sha1sum_b
0e90: 6c 6f 62 28 26 6d 61 6e 69 66 65 73 74 2c 20 26  lob(&manifest, &
0ea0: 68 61 73 68 29 3b 0a 20 20 7a 4d 61 6e 46 69 6c  hash);.  zManFil
0eb0: 65 20 3d 20 6d 70 72 69 6e 74 66 28 22 25 73 6d  e = mprintf("%sm
0ec0: 61 6e 69 66 65 73 74 2e 75 75 69 64 22 2c 20 67  anifest.uuid", g
0ed0: 2e 7a 4c 6f 63 61 6c 52 6f 6f 74 29 3b 0a 20 20  .zLocalRoot);.  
0ee0: 62 6c 6f 62 5f 61 70 70 65 6e 64 28 26 68 61 73  blob_append(&has
0ef0: 68 2c 20 22 5c 6e 22 2c 20 31 29 3b 0a 20 20 62  h, "\n", 1);.  b
0f00: 6c 6f 62 5f 77 72 69 74 65 5f 74 6f 5f 66 69 6c  lob_write_to_fil
0f10: 65 28 26 68 61 73 68 2c 20 7a 4d 61 6e 46 69 6c  e(&hash, zManFil
0f20: 65 29 3b 0a 20 20 66 72 65 65 28 7a 4d 61 6e 46  e);.  free(zManF
0f30: 69 6c 65 29 3b 0a 20 20 62 6c 6f 62 5f 72 65 73  ile);.  blob_res
0f40: 65 74 28 26 68 61 73 68 29 3b 0a 20 20 6d 61 6e  et(&hash);.  man
0f50: 69 66 65 73 74 5f 70 61 72 73 65 28 26 6d 2c 20  ifest_parse(&m, 
0f60: 26 6d 61 6e 69 66 65 73 74 29 3b 0a 20 20 62 6c  &manifest);.  bl
0f70: 6f 62 5f 7a 65 72 6f 28 26 66 69 6c 65 6e 61 6d  ob_zero(&filenam
0f80: 65 29 3b 0a 20 20 62 6c 6f 62 5f 61 70 70 65 6e  e);.  blob_appen
0f90: 64 66 28 26 66 69 6c 65 6e 61 6d 65 2c 20 22 25  df(&filename, "%
0fa0: 73 2f 22 2c 20 67 2e 7a 4c 6f 63 61 6c 52 6f 6f  s/", g.zLocalRoo
0fb0: 74 29 3b 0a 20 20 62 61 73 65 4c 65 6e 20 3d 20  t);.  baseLen = 
0fc0: 62 6c 6f 62 5f 73 69 7a 65 28 26 66 69 6c 65 6e  blob_size(&filen
0fd0: 61 6d 65 29 3b 0a 20 20 66 6f 72 28 69 3d 30 3b  ame);.  for(i=0;
0fe0: 20 69 3c 6d 2e 6e 46 69 6c 65 3b 20 69 2b 2b 29   i<m.nFile; i++)
0ff0: 7b 20 0a 20 20 20 20 69 6e 74 20 69 73 45 78 65  { .    int isExe
1000: 3b 0a 20 20 20 20 62 6c 6f 62 5f 61 70 70 65 6e  ;.    blob_appen
1010: 64 28 26 66 69 6c 65 6e 61 6d 65 2c 20 6d 2e 61  d(&filename, m.a
1020: 46 69 6c 65 5b 69 5d 2e 7a 4e 61 6d 65 2c 20 2d  File[i].zName, -
1030: 31 29 3b 0a 20 20 20 20 69 73 45 78 65 20 3d 20  1);.    isExe = 
1040: 6d 2e 61 46 69 6c 65 5b 69 5d 2e 7a 50 65 72 6d  m.aFile[i].zPerm
1050: 20 26 26 20 73 74 72 73 74 72 28 6d 2e 61 46 69   && strstr(m.aFi
1060: 6c 65 5b 69 5d 2e 7a 50 65 72 6d 2c 20 22 78 22  le[i].zPerm, "x"
1070: 29 3b 0a 20 20 20 20 66 69 6c 65 5f 73 65 74 65  );.    file_sete
1080: 78 65 28 62 6c 6f 62 5f 73 74 72 28 26 66 69 6c  xe(blob_str(&fil
1090: 65 6e 61 6d 65 29 2c 20 69 73 45 78 65 29 3b 0a  ename), isExe);.
10a0: 20 20 20 20 62 6c 6f 62 5f 72 65 73 69 7a 65 28      blob_resize(
10b0: 26 66 69 6c 65 6e 61 6d 65 2c 20 62 61 73 65 4c  &filename, baseL
10c0: 65 6e 29 3b 0a 20 20 7d 0a 20 20 62 6c 6f 62 5f  en);.  }.  blob_
10d0: 72 65 73 65 74 28 26 66 69 6c 65 6e 61 6d 65 29  reset(&filename)
10e0: 3b 0a 20 20 6d 61 6e 69 66 65 73 74 5f 63 6c 65  ;.  manifest_cle
10f0: 61 72 28 26 6d 29 3b 0a 7d 0a 0a 2f 2a 0a 2a 2a  ar(&m);.}../*.**
1100: 20 43 4f 4d 4d 41 4e 44 3a 20 63 68 65 63 6b 6f   COMMAND: checko
1110: 75 74 0a 2a 2a 20 43 4f 4d 4d 41 4e 44 3a 20 63  ut.** COMMAND: c
1120: 6f 0a 2a 2a 0a 2a 2a 20 55 73 61 67 65 3a 20 25  o.**.** Usage: %
1130: 66 6f 73 73 69 6c 20 63 68 65 63 6b 6f 75 74 20  fossil checkout 
1140: 56 45 52 53 49 4f 4e 20 3f 2d 66 7c 2d 2d 66 6f  VERSION ?-f|--fo
1150: 72 63 65 3f 0a 2a 2a 0a 2a 2a 20 43 68 65 63 6b  rce?.**.** Check
1160: 20 6f 75 74 20 61 20 76 65 72 73 69 6f 6e 20 73   out a version s
1170: 70 65 63 69 66 69 65 64 20 6f 6e 20 74 68 65 20  pecified on the 
1180: 63 6f 6d 6d 61 6e 64 2d 6c 69 6e 65 2e 20 20 54  command-line.  T
1190: 68 69 73 20 63 6f 6d 6d 61 6e 64 0a 2a 2a 20 77  his command.** w
11a0: 69 6c 6c 20 6e 6f 74 20 6f 76 65 72 77 72 69 74  ill not overwrit
11b0: 65 20 65 64 69 74 65 64 20 66 69 6c 65 73 20 69  e edited files i
11c0: 6e 20 74 68 65 20 63 75 72 72 65 6e 74 20 63 68  n the current ch
11d0: 65 63 6b 6f 75 74 20 75 6e 6c 65 73 73 0a 2a 2a  eckout unless.**
11e0: 20 74 68 65 20 2d 2d 66 6f 72 63 65 20 6f 70 74   the --force opt
11f0: 69 6f 6e 20 61 70 70 65 61 72 73 20 6f 6e 20 74  ion appears on t
1200: 68 65 20 63 6f 6d 6d 61 6e 64 2d 6c 69 6e 65 2e  he command-line.
1210: 0a 2a 2a 0a 2a 2a 20 53 65 65 20 61 6c 73 6f 20  .**.** See also 
1220: 74 68 65 20 22 75 70 64 61 74 65 22 20 63 6f 6d  the "update" com
1230: 6d 61 6e 64 2e 0a 2a 2f 0a 76 6f 69 64 20 63 68  mand..*/.void ch
1240: 65 63 6b 6f 75 74 5f 63 6d 64 28 76 6f 69 64 29  eckout_cmd(void)
1250: 7b 0a 20 20 69 6e 74 20 66 6f 72 63 65 46 6c 61  {.  int forceFla
1260: 67 3b 0a 20 20 69 6e 74 20 6e 6f 57 72 69 74 65  g;.  int noWrite
1270: 3b 0a 20 20 69 6e 74 20 76 69 64 2c 20 70 72 69  ;.  int vid, pri
1280: 6f 72 3b 0a 20 20 42 6c 6f 62 20 63 6b 73 75 6d  or;.  Blob cksum
1290: 31 2c 20 63 6b 73 75 6d 31 62 2c 20 63 6b 73 75  1, cksum1b, cksu
12a0: 6d 32 3b 0a 20 20 0a 20 20 64 62 5f 6d 75 73 74  m2;.  .  db_must
12b0: 5f 62 65 5f 77 69 74 68 69 6e 5f 74 72 65 65 28  _be_within_tree(
12c0: 29 3b 0a 20 20 64 62 5f 62 65 67 69 6e 5f 74 72  );.  db_begin_tr
12d0: 61 6e 73 61 63 74 69 6f 6e 28 29 3b 0a 20 20 66  ansaction();.  f
12e0: 6f 72 63 65 46 6c 61 67 20 3d 20 66 69 6e 64 5f  orceFlag = find_
12f0: 6f 70 74 69 6f 6e 28 22 66 6f 72 63 65 22 2c 22  option("force","
1300: 66 22 2c 30 29 21 3d 30 3b 0a 20 20 6e 6f 57 72  f",0)!=0;.  noWr
1310: 69 74 65 20 3d 20 66 69 6e 64 5f 6f 70 74 69 6f  ite = find_optio
1320: 6e 28 22 64 6f 6e 74 77 72 69 74 65 22 2c 30 2c  n("dontwrite",0,
1330: 30 29 21 3d 30 3b 0a 20 20 69 66 28 20 67 2e 61  0)!=0;.  if( g.a
1340: 72 67 63 21 3d 33 20 29 20 75 73 61 67 65 28 22  rgc!=3 ) usage("
1350: 3f 2d 2d 66 6f 72 63 65 3f 20 56 45 52 53 49 4f  ?--force? VERSIO
1360: 4e 22 29 3b 0a 20 20 69 66 28 20 21 66 6f 72 63  N");.  if( !forc
1370: 65 46 6c 61 67 20 26 26 20 75 6e 73 61 76 65 64  eFlag && unsaved
1380: 5f 63 68 61 6e 67 65 73 28 29 3d 3d 31 20 29 7b  _changes()==1 ){
1390: 0a 20 20 20 20 66 6f 73 73 69 6c 5f 66 61 74 61  .    fossil_fata
13a0: 6c 28 22 74 68 65 72 65 20 61 72 65 20 75 6e 73  l("there are uns
13b0: 61 76 65 64 20 63 68 61 6e 67 65 73 20 69 6e 20  aved changes in 
13c0: 74 68 65 20 63 75 72 72 65 6e 74 20 63 68 65 63  the current chec
13d0: 6b 6f 75 74 22 29 3b 0a 20 20 7d 0a 20 20 69 66  kout");.  }.  if
13e0: 28 21 63 68 65 63 6b 6f 75 74 61 62 6c 65 28 67  (!checkoutable(g
13f0: 2e 61 72 67 76 5b 32 5d 29 29 7b 0a 20 20 20 20  .argv[2])){.    
1400: 66 6f 73 73 69 6c 5f 66 61 74 61 6c 28 22 74 68  fossil_fatal("th
1410: 65 20 56 45 52 53 49 4f 4e 20 79 6f 75 20 72 65  e VERSION you re
1420: 71 75 65 73 74 65 64 20 69 73 20 6e 6f 74 20 61  quested is not a
1430: 20 63 68 65 63 6b 6f 75 74 2d 61 62 6c 65 20 61   checkout-able a
1440: 72 74 69 66 61 63 74 22 29 3b 0a 20 20 7d 0a 20  rtifact");.  }. 
1450: 20 69 66 28 20 66 6f 72 63 65 46 6c 61 67 20 29   if( forceFlag )
1460: 7b 0a 20 20 20 20 64 62 5f 6d 75 6c 74 69 5f 65  {.    db_multi_e
1470: 78 65 63 28 22 44 45 4c 45 54 45 20 46 52 4f 4d  xec("DELETE FROM
1480: 20 76 66 69 6c 65 22 29 3b 0a 20 20 20 20 70 72   vfile");.    pr
1490: 69 6f 72 20 3d 20 30 3b 0a 20 20 7d 65 6c 73 65  ior = 0;.  }else
14a0: 7b 0a 20 20 20 20 70 72 69 6f 72 20 3d 20 64 62  {.    prior = db
14b0: 5f 6c 67 65 74 5f 69 6e 74 28 22 63 68 65 63 6b  _lget_int("check
14c0: 6f 75 74 22 2c 30 29 3b 0a 20 20 7d 0a 20 20 76  out",0);.  }.  v
14d0: 69 64 20 3d 20 6c 6f 61 64 5f 76 66 69 6c 65 28  id = load_vfile(
14e0: 67 2e 61 72 67 76 5b 32 5d 29 3b 0a 20 20 69 66  g.argv[2]);.  if
14f0: 28 20 70 72 69 6f 72 3d 3d 76 69 64 20 29 7b 0a  ( prior==vid ){.
1500: 20 20 20 20 72 65 74 75 72 6e 3b 0a 20 20 7d 0a      return;.  }.
1510: 20 20 69 66 28 20 21 6e 6f 57 72 69 74 65 20 29    if( !noWrite )
1520: 7b 0a 20 20 20 20 75 6e 63 68 65 63 6b 6f 75 74  {.    uncheckout
1530: 28 70 72 69 6f 72 29 3b 0a 20 20 7d 0a 20 20 64  (prior);.  }.  d
1540: 62 5f 6d 75 6c 74 69 5f 65 78 65 63 28 22 44 45  b_multi_exec("DE
1550: 4c 45 54 45 20 46 52 4f 4d 20 76 66 69 6c 65 20  LETE FROM vfile 
1560: 57 48 45 52 45 20 76 69 64 21 3d 25 64 22 2c 20  WHERE vid!=%d", 
1570: 76 69 64 29 3b 0a 20 20 69 66 28 20 21 6e 6f 57  vid);.  if( !noW
1580: 72 69 74 65 20 29 7b 0a 20 20 20 20 76 66 69 6c  rite ){.    vfil
1590: 65 5f 74 6f 5f 64 69 73 6b 28 76 69 64 2c 20 30  e_to_disk(vid, 0
15a0: 2c 20 31 29 3b 0a 20 20 20 20 6d 61 6e 69 66 65  , 1);.    manife
15b0: 73 74 5f 74 6f 5f 64 69 73 6b 28 76 69 64 29 3b  st_to_disk(vid);
15c0: 0a 20 20 20 20 64 62 5f 6c 73 65 74 5f 69 6e 74  .    db_lset_int
15d0: 28 22 63 68 65 63 6b 6f 75 74 22 2c 20 76 69 64  ("checkout", vid
15e0: 29 3b 0a 20 20 20 20 75 6e 64 6f 5f 72 65 73 65  );.    undo_rese
15f0: 74 28 29 3b 0a 20 20 7d 0a 20 20 64 62 5f 6d 75  t();.  }.  db_mu
1600: 6c 74 69 5f 65 78 65 63 28 22 44 45 4c 45 54 45  lti_exec("DELETE
1610: 20 46 52 4f 4d 20 76 6d 65 72 67 65 22 29 3b 0a   FROM vmerge");.
1620: 20 20 76 66 69 6c 65 5f 61 67 67 72 65 67 61 74    vfile_aggregat
1630: 65 5f 63 68 65 63 6b 73 75 6d 5f 6d 61 6e 69 66  e_checksum_manif
1640: 65 73 74 28 76 69 64 2c 20 26 63 6b 73 75 6d 31  est(vid, &cksum1
1650: 2c 20 26 63 6b 73 75 6d 31 62 29 3b 0a 20 20 76  , &cksum1b);.  v
1660: 66 69 6c 65 5f 61 67 67 72 65 67 61 74 65 5f 63  file_aggregate_c
1670: 68 65 63 6b 73 75 6d 5f 64 69 73 6b 28 76 69 64  hecksum_disk(vid
1680: 2c 20 26 63 6b 73 75 6d 32 29 3b 0a 20 20 69 66  , &cksum2);.  if
1690: 28 20 62 6c 6f 62 5f 63 6f 6d 70 61 72 65 28 26  ( blob_compare(&
16a0: 63 6b 73 75 6d 31 2c 20 26 63 6b 73 75 6d 32 29  cksum1, &cksum2)
16b0: 20 29 7b 0a 20 20 20 20 70 72 69 6e 74 66 28 22   ){.    printf("
16c0: 57 41 52 4e 49 4e 47 3a 20 6d 61 6e 69 66 65 73  WARNING: manifes
16d0: 74 20 63 68 65 63 6b 73 75 6d 20 64 6f 65 73 20  t checksum does 
16e0: 6e 6f 74 20 61 67 72 65 65 20 77 69 74 68 20 64  not agree with d
16f0: 69 73 6b 5c 6e 22 29 3b 0a 20 20 7d 0a 20 20 69  isk\n");.  }.  i
1700: 66 28 20 62 6c 6f 62 5f 63 6f 6d 70 61 72 65 28  f( blob_compare(
1710: 26 63 6b 73 75 6d 31 2c 20 26 63 6b 73 75 6d 31  &cksum1, &cksum1
1720: 62 29 20 29 7b 0a 20 20 20 20 70 72 69 6e 74 66  b) ){.    printf
1730: 28 22 57 41 52 4e 49 4e 47 3a 20 6d 61 6e 69 66  ("WARNING: manif
1740: 65 73 74 20 63 68 65 63 6b 73 75 6d 20 64 6f 65  est checksum doe
1750: 73 20 6e 6f 74 20 61 67 72 65 65 20 77 69 74 68  s not agree with
1760: 20 6d 61 6e 69 66 65 73 74 5c 6e 22 29 3b 0a 20   manifest\n");. 
1770: 20 7d 0a 20 20 64 62 5f 65 6e 64 5f 74 72 61 6e   }.  db_end_tran
1780: 73 61 63 74 69 6f 6e 28 30 29 3b 0a 7d 0a 0a 2f  saction(0);.}../
1790: 2a 0a 2a 2a 20 43 4f 4d 4d 41 4e 44 3a 20 63 6c  *.** COMMAND: cl
17a0: 6f 73 65 0a 2a 2a 0a 2a 2a 20 55 73 61 67 65 3a  ose.**.** Usage:
17b0: 20 25 66 6f 73 73 69 6c 20 63 6c 6f 73 65 20 3f   %fossil close ?
17c0: 2d 66 7c 2d 2d 66 6f 72 63 65 3f 0a 2a 2a 0a 2a  -f|--force?.**.*
17d0: 2a 20 54 68 65 20 6f 70 70 6f 73 69 74 65 20 6f  * The opposite o
17e0: 66 20 22 6f 70 65 6e 22 2e 20 20 43 6c 6f 73 65  f "open".  Close
17f0: 20 74 68 65 20 63 75 72 72 65 6e 74 20 64 61 74   the current dat
1800: 61 62 61 73 65 20 63 6f 6e 6e 65 63 74 69 6f 6e  abase connection
1810: 2e 0a 2a 2a 20 52 65 71 75 69 72 65 20 61 20 2d  ..** Require a -
1820: 66 20 6f 72 20 2d 2d 66 6f 72 63 65 20 66 6c 61  f or --force fla
1830: 67 20 69 66 20 74 68 65 72 65 20 61 72 65 20 75  g if there are u
1840: 6e 73 61 76 65 64 20 63 68 61 6e 67 65 64 20 69  nsaved changed i
1850: 6e 20 74 68 65 0a 2a 2a 20 63 75 72 72 65 6e 74  n the.** current
1860: 20 63 68 65 63 6b 2d 6f 75 74 2e 0a 2a 2f 0a 76   check-out..*/.v
1870: 6f 69 64 20 63 6c 6f 73 65 5f 63 6d 64 28 76 6f  oid close_cmd(vo
1880: 69 64 29 7b 0a 20 20 69 6e 74 20 66 6f 72 63 65  id){.  int force
1890: 46 6c 61 67 20 3d 20 66 69 6e 64 5f 6f 70 74 69  Flag = find_opti
18a0: 6f 6e 28 22 66 6f 72 63 65 22 2c 22 66 22 2c 30  on("force","f",0
18b0: 29 21 3d 30 3b 0a 20 20 64 62 5f 6d 75 73 74 5f  )!=0;.  db_must_
18c0: 62 65 5f 77 69 74 68 69 6e 5f 74 72 65 65 28 29  be_within_tree()
18d0: 3b 0a 20 20 69 66 28 20 21 66 6f 72 63 65 46 6c  ;.  if( !forceFl
18e0: 61 67 20 26 26 20 75 6e 73 61 76 65 64 5f 63 68  ag && unsaved_ch
18f0: 61 6e 67 65 73 28 29 3d 3d 31 20 29 7b 0a 20 20  anges()==1 ){.  
1900: 20 20 66 6f 73 73 69 6c 5f 66 61 74 61 6c 28 22    fossil_fatal("
1910: 74 68 65 72 65 20 61 72 65 20 75 6e 73 61 76 65  there are unsave
1920: 64 20 63 68 61 6e 67 65 73 20 69 6e 20 74 68 65  d changes in the
1930: 20 63 75 72 72 65 6e 74 20 63 68 65 63 6b 6f 75   current checkou
1940: 74 22 29 3b 0a 20 20 7d 0a 20 20 64 62 5f 63 6c  t");.  }.  db_cl
1950: 6f 73 65 28 29 3b 0a 20 20 75 6e 6c 69 6e 6b 28  ose();.  unlink(
1960: 6d 70 72 69 6e 74 66 28 22 25 73 5f 46 4f 53 53  mprintf("%s_FOSS
1970: 49 4c 5f 22 2c 20 67 2e 7a 4c 6f 63 61 6c 52 6f  IL_", g.zLocalRo
1980: 6f 74 29 29 3b 0a 20 20 75 6e 6c 69 6e 6b 28 6d  ot));.  unlink(m
1990: 70 72 69 6e 74 66 28 22 25 73 5f 46 4f 53 53 49  printf("%s_FOSSI
19a0: 4c 5f 2d 6a 6f 75 72 6e 61 6c 22 2c 20 67 2e 7a  L_-journal", g.z
19b0: 4c 6f 63 61 6c 52 6f 6f 74 29 29 3b 0a 7d 0a     LocalRoot));.}.