| | @@ -29,11 +29,11 @@ |
| 29 | 29 | ** or merge, and should be omitted from "clean" and "extra" lists. |
| 30 | 30 | ** |
| 31 | 31 | ** Return the N-th name. The first name has N==0. When all names have |
| 32 | 32 | ** been used, return 0. |
| 33 | 33 | */ |
| 34 | | -const char *fossil_reserved_name(int N){ |
| 34 | +const char *fossil_reserved_name(int N, int omitRepo){ |
| 35 | 35 | /* Possible names of the local per-checkout database file and |
| 36 | 36 | ** its associated journals |
| 37 | 37 | */ |
| 38 | 38 | static const char *const azName[] = { |
| 39 | 39 | "_FOSSIL_", |
| | @@ -88,25 +88,25 @@ |
| 88 | 88 | N -= count(azName); |
| 89 | 89 | if( cachedManifest ){ |
| 90 | 90 | if( N<count(azManifest) ) return azManifest[N]; |
| 91 | 91 | N -= count(azManifest); |
| 92 | 92 | } |
| 93 | | - if( N<count(azRepo) ) return azRepo[N]; |
| 93 | + if( !omitRepo && N<count(azRepo) ) return azRepo[N]; |
| 94 | 94 | return 0; |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | /* |
| 98 | 98 | ** Return a list of all reserved filenames as an SQL list. |
| 99 | 99 | */ |
| 100 | | -const char *fossil_all_reserved_names(void){ |
| 100 | +const char *fossil_all_reserved_names(int omitRepo){ |
| 101 | 101 | static char *zAll = 0; |
| 102 | 102 | if( zAll==0 ){ |
| 103 | 103 | Blob x; |
| 104 | 104 | int i; |
| 105 | 105 | const char *z; |
| 106 | 106 | blob_zero(&x); |
| 107 | | - for(i=0; (z = fossil_reserved_name(i))!=0; i++){ |
| 107 | + for(i=0; (z = fossil_reserved_name(i, omitRepo))!=0; i++){ |
| 108 | 108 | if( i>0 ) blob_append(&x, ",", 1); |
| 109 | 109 | blob_appendf(&x, "'%q'", z); |
| 110 | 110 | } |
| 111 | 111 | zAll = blob_str(&x); |
| 112 | 112 | } |
| | @@ -113,21 +113,24 @@ |
| 113 | 113 | return zAll; |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | /* |
| 117 | 117 | ** COMMAND: test-reserved-names |
| 118 | +** |
| 119 | +** Usage: %fossil test-reserved-names [-omitrepo] |
| 118 | 120 | ** |
| 119 | 121 | ** Show all reserved filenames for the current check-out. |
| 120 | 122 | */ |
| 121 | 123 | void test_reserved_names(void){ |
| 122 | 124 | int i; |
| 123 | 125 | const char *z; |
| 126 | + int omitRepo = find_option("omitrepo",0,0)!=0; |
| 124 | 127 | db_must_be_within_tree(); |
| 125 | | - for(i=0; (z = fossil_reserved_name(i))!=0; i++){ |
| 128 | + for(i=0; (z = fossil_reserved_name(i, omitRepo))!=0; i++){ |
| 126 | 129 | fossil_print("%3d: %s\n", i, z); |
| 127 | 130 | } |
| 128 | | - fossil_print("ALL: (%s)\n", fossil_all_reserved_names()); |
| 131 | + fossil_print("ALL: (%s)\n", fossil_all_reserved_names(omitRepo)); |
| 129 | 132 | } |
| 130 | 133 | |
| 131 | 134 | /* |
| 132 | 135 | ** Add a single file named zName to the VFILE table with vid. |
| 133 | 136 | ** |
| | @@ -195,11 +198,11 @@ |
| 195 | 198 | } |
| 196 | 199 | db_prepare(&loop, "SELECT x FROM sfile ORDER BY x"); |
| 197 | 200 | while( db_step(&loop)==SQLITE_ROW ){ |
| 198 | 201 | const char *zToAdd = db_column_text(&loop, 0); |
| 199 | 202 | if( fossil_strcmp(zToAdd, zRepo)==0 ) continue; |
| 200 | | - for(i=0; (zReserved = fossil_reserved_name(i))!=0; i++){ |
| 203 | + for(i=0; (zReserved = fossil_reserved_name(i, 0))!=0; i++){ |
| 201 | 204 | if( xCmp(zToAdd, zReserved)==0 ) break; |
| 202 | 205 | } |
| 203 | 206 | if( zReserved ) continue; |
| 204 | 207 | nAdd += add_one_file(zToAdd, vid, caseSensitive); |
| 205 | 208 | } |
| 206 | 209 | |