Check-in [3555c0fc6f]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
SHA1 Hash:3555c0fc6fd0d1684422c729ac6a571ec3762715
Date: 2010-03-15 17:41:54
User: drh
Comment:Add a --ignore option to the "extra" command, and an "ignore-glob" setting which causes files with given patterns to be ignored. Tickets [705181a992c] and [5125de2e624]. See also ticket [4e8410bfd69].
Tags And Properties
Changes

Changes to src/checkin.c

Old (68f82b881294436e) New (5c5ed2a07e6fa7a6)
1 /* 1 /*
2 ** Copyright (c) 2007 D. Richard Hipp 2 ** Copyright (c) 2007 D. Richard Hipp
3 ** 3 **
4 ** This program is free software; you can redistribute it and/or 4 ** This program is free software; you can redistribute it and/or
5 ** modify it under the terms of the GNU General Public 5 ** modify it under the terms of the GNU General Public
189 hidden lines
195 } 195 }
196 db_finalize(&q); 196 db_finalize(&q);
197 } 197 }
198 198
199 /* 199 /*
> 200 ** Construct and return a string which is an SQL expression that will
> 201 ** be TRUE if value zVal matches any of the GLOB expressions in the list
> 202 ** zGlobList. For example:
> 203 **
> 204 ** zVal: "x"
> 205 ** zGlobList: "*.o,*.obj"
> 206 **
> 207 ** Result: "(x GLOB '*.o' OR x GLOB '*.obj')"
> 208 **
> 209 ** Each element of the GLOB list may optionally be enclosed in either '...'
> 210 ** or "...". This allows commas in the expression. Whitespace at the
> 211 ** beginning and end of each GLOB pattern is ignored, except when enclosed
> 212 ** within '...' or "...".
> 213 **
> 214 ** This routine makes no effort to free the memory space it uses.
> 215 */
> 216 char *glob_expr(const char *zVal, const char *zGlobList){
> 217 Blob expr;
> 218 char *zSep = "(";
> 219 int nTerm = 0;
> 220 int i;
> 221 int cTerm;
> 222
> 223 if( zGlobList==0 || zGlobList[0]==0 ) return "0";
> 224 blob_zero(&expr);
> 225 while( zGlobList[0] ){
> 226 while( isspace(zGlobList[0]) || zGlobList[0]==',' ) zGlobList++;
> 227 if( zGlobList[0]==0 ) break;
> 228 if( zGlobList[0]=='\'' || zGlobList[0]=='"' ){
> 229 cTerm = zGlobList[0];
> 230 zGlobList++;
> 231 }else{
> 232 cTerm = ',';
> 233 }
> 234 for(i=0; zGlobList[i] && zGlobList[i]!=cTerm; i++){}
> 235 if( cTerm==',' ){
> 236 while( i>0 && isspace(zGlobList[i-1]) ){ i--; }
> 237 }
> 238 blob_appendf(&expr, "%s%s GLOB '%.*q'", zSep, zVal, i, zGlobList);
> 239 zSep = " OR ";
> 240 if( cTerm!=',' && zGlobList[i] ) i++;
> 241 zGlobList += i;
> 242 if( zGlobList[0] ) zGlobList++;
> 243 nTerm++;
> 244 }
> 245 if( nTerm ){
> 246 blob_appendf(&expr, ")");
> 247 return blob_str(&expr);
> 248 }else{
> 249 return "0";
> 250 }
> 251 }
> 252
> 253 /*
200 ** COMMAND: extras 254 ** COMMAND: extras
201 ** Usage: %fossil extras ?--dotfiles? | 255 ** Usage: %fossil extras ?--dotfiles? ?--ignore GLOBPATTERN?
202 ** 256 **
203 ** Print a list of all files in the source tree that are not part of 257 ** Print a list of all files in the source tree that are not part of
204 ** the current checkout. See also the "clean" command. 258 ** the current checkout. See also the "clean" command.
205 ** 259 **
206 ** Files and subdirectories whose names begin with "." are normally 260 ** Files and subdirectories whose names begin with "." are normally
2 hidden lines
209 void extra_cmd(void){ 263 void extra_cmd(void){
210 Blob path; 264 Blob path;
211 Blob repo; 265 Blob repo;
212 Stmt q; 266 Stmt q;
213 int n; 267 int n;
> 268 const char *zIgnoreFlag = find_option("ignore",0,1);
214 int allFlag = find_option("dotfiles",0,0)!=0; 269 int allFlag = find_option("dotfiles",0,0)!=0;
> 270
215 db_must_be_within_tree(); 271 db_must_be_within_tree();
216 db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY)"); 272 db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY)");
217 n = strlen(g.zLocalRoot); 273 n = strlen(g.zLocalRoot);
218 blob_init(&path, g.zLocalRoot, n-1); 274 blob_init(&path, g.zLocalRoot, n-1);
> 275 if( zIgnoreFlag==0 ){
> 276 zIgnoreFlag = db_get("ignore-glob", 0);
> 277 }
219 vfile_scan(0, &path, blob_size(&path), allFlag); 278 vfile_scan(0, &path, blob_size(&path), allFlag);
220 db_prepare(&q, 279 db_prepare(&q,
221 "SELECT x FROM sfile" 280 "SELECT x FROM sfile"
222 " WHERE x NOT IN ('manifest','manifest.uuid','_FOSSIL_')" 281 " WHERE x NOT IN ('manifest','manifest.uuid','_FOSSIL_')"
223 " ORDER BY 1"); | 282 " AND NOT %s"
| 283 " ORDER BY 1",
| 284 glob_expr("x", zIgnoreFlag)
| 285 );
224 if( file_tree_name(g.zRepositoryName, &repo, 0) ){ 286 if( file_tree_name(g.zRepositoryName, &repo, 0) ){
225 db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo); 287 db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo);
226 } 288 }
227 while( db_step(&q)==SQLITE_ROW ){ 289 while( db_step(&q)==SQLITE_ROW ){
228 printf("%s\n", db_column_text(&q, 0)); 290 printf("%s\n", db_column_text(&q, 0));
880 hidden lines
1109 free(zMidUuid); 1171 free(zMidUuid);
1110 return; 1172 return;
1111 1173
1112 #undef USAGE 1174 #undef USAGE
1113 } 1175 }

Changes to src/db.c

Old (20b0e9153b4bf5ae) New (62f60a50b626578f)
1 /* 1 /*
2 ** Copyright (c) 2006 D. Richard Hipp 2 ** Copyright (c) 2006 D. Richard Hipp
3 ** 3 **
4 ** This program is free software; you can redistribute it and/or 4 ** This program is free software; you can redistribute it and/or
5 ** modify it under the terms of the GNU General Public 5 ** modify it under the terms of the GNU General Public
1451 hidden lines
1457 ** diff. If undefined, text diff will be used. 1457 ** diff. If undefined, text diff will be used.
1458 ** 1458 **
1459 ** http-port The TCP/IP port number to use by the "server" 1459 ** http-port The TCP/IP port number to use by the "server"
1460 ** and "ui" commands. Default: 8080 1460 ** and "ui" commands. Default: 8080
1461 ** 1461 **
> 1462 ** ignore-glob The VALUE is a comma-separated list of GLOB patterns
> 1463 ** specifying files that the "extra" command will ignore.
> 1464 ** Example: *.o,*.obj,*.exe
> 1465 **
1462 ** localauth If enabled, require that HTTP connections from 1466 ** localauth If enabled, require that HTTP connections from
1463 ** 127.0.0.1 be authenticated by password. If 1467 ** 127.0.0.1 be authenticated by password. If
1464 ** false, all HTTP requests from localhost have 1468 ** false, all HTTP requests from localhost have
1465 ** unrestricted access to the repository. 1469 ** unrestricted access to the repository.
1466 ** 1470 **
20 hidden lines
1487 "clearsign", 1491 "clearsign",
1488 "diff-command", 1492 "diff-command",
1489 "dont-push", 1493 "dont-push",
1490 "editor", 1494 "editor",
1491 "gdiff-command", 1495 "gdiff-command",
> 1496 "ignore-glob",
1492 "http-port", 1497 "http-port",
1493 "localauth", 1498 "localauth",
1494 "mtime-changes", 1499 "mtime-changes",
1495 "pgp-command", 1500 "pgp-command",
1496 "proxy", 1501 "proxy",
32 hidden lines
1529 } 1534 }
1530 }else{ 1535 }else{
1531 usage("?PROPERTY? ?VALUE?"); 1536 usage("?PROPERTY? ?VALUE?");
1532 } 1537 }
1533 } 1538 }