Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | The finfo command and the file browsing pages of the web UI now honor the case-sensitive option and merge filenames that differ only in case as requested. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
9c90b0f0522c2fc3b8842f459bea910d |
| User & Date: | drh 2011-12-06 00:09:09.867 |
Context
|
2011-12-13
| ||
| 13:53 | Version 1.21 check-in: 002580c50d user: drh tags: trunk, release, version-1.21 | |
|
2011-12-08
| ||
| 02:05 | merge with latest trunk check-in: 4d39236638 user: mgagnon tags: mgagnon_fix | |
|
2011-12-06
| ||
| 00:09 | The finfo command and the file browsing pages of the web UI now honor the case-sensitive option and merge filenames that differ only in case as requested. check-in: 9c90b0f052 user: drh tags: trunk | |
|
2011-11-30
| ||
| 17:26 | Bug fix: If a repository contains public artifacts that are deltas from private artifacts, expand the artifact content prior to cloning. check-in: 8d155c5f1f user: drh tags: trunk | |
Changes
Changes to src/add.c.
| ︙ | ︙ | |||
335 336 337 338 339 340 341 |
** the case-sensitive setting is undefined, then case sensitivity
** defaults on for Mac and Windows and off for all other unix.
**
** The --case-sensitive BOOLEAN command-line option overrides any
** setting.
*/
int filenames_are_case_sensitive(void){
| | > > > | | | | | | > > > > > > > > > > > > | 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 |
** the case-sensitive setting is undefined, then case sensitivity
** defaults on for Mac and Windows and off for all other unix.
**
** The --case-sensitive BOOLEAN command-line option overrides any
** setting.
*/
int filenames_are_case_sensitive(void){
static int caseSensitive;
static int once = 1;
if( once ){
once = 0;
if( zCaseSensitive ){
caseSensitive = is_truth(zCaseSensitive);
}else{
#if !defined(_WIN32) && !defined(__DARWIN__) && !defined(__APPLE__)
caseSensitive = 1; /* Unix */
#else
caseSensitive = 0; /* Windows and Mac */
#endif
caseSensitive = db_get_boolean("case-sensitive",caseSensitive);
}
}
return caseSensitive;
}
/*
** Return one of two things:
**
** "" (empty string) if filenames are case sensitive
**
** "COLLATE nocase" if filenames are not case sensitive.
*/
const char *filename_collation(void){
return filenames_are_case_sensitive() ? "" : "COLLATE nocase";
}
/*
** COMMAND: addremove
**
** Usage: %fossil addremove ?OPTIONS?
**
** Do all necessary "add" and "rm" commands to synchronize the repository
|
| ︙ | ︙ |
Changes to src/browse.c.
| ︙ | ︙ | |||
194 195 196 197 198 199 200 | ** of all files and subdirectories in the zD[] directory. ** ** Subdirectory names begin with "/". This causes them to sort ** first and it also gives us an easy way to distinguish files ** from directories in the loop that follows. */ db_multi_exec( | | > | 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 |
** of all files and subdirectories in the zD[] directory.
**
** Subdirectory names begin with "/". This causes them to sort
** first and it also gives us an easy way to distinguish files
** from directories in the loop that follows.
*/
db_multi_exec(
"CREATE TEMP TABLE localfiles(x UNIQUE NOT NULL %s, u);",
filename_collation()
);
if( zCI ){
Stmt ins;
ManifestFile *pFile;
ManifestFile *pPrev = 0;
int nPrev = 0;
int c;
|
| ︙ | ︙ | |||
229 230 231 232 233 234 235 |
db_reset(&ins);
pPrev = pFile;
for(nPrev=0; (c=pPrev->zName[nD+nPrev]) && c!='/'; nPrev++){}
if( c=='/' ) nPrev++;
}
db_finalize(&ins);
}else if( zD ){
| > | | | | | | > > > > > > > > | 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 |
db_reset(&ins);
pPrev = pFile;
for(nPrev=0; (c=pPrev->zName[nD+nPrev]) && c!='/'; nPrev++){}
if( c=='/' ) nPrev++;
}
db_finalize(&ins);
}else if( zD ){
if( filenames_are_case_sensitive() ){
db_multi_exec(
"INSERT OR IGNORE INTO localfiles"
" SELECT pathelement(name,%d), NULL FROM filename"
" WHERE name GLOB '%q/*'",
nD, zD
);
}else{
db_multi_exec(
"INSERT OR IGNORE INTO localfiles"
" SELECT pathelement(name,%d), NULL FROM filename"
" WHERE name LIKE '%q/%%'",
nD, zD
);
}
}else{
db_multi_exec(
"INSERT OR IGNORE INTO localfiles"
" SELECT pathelement(name,0), NULL FROM filename"
);
}
|
| ︙ | ︙ |
Changes to src/finfo.c.
| ︙ | ︙ | |||
37 38 39 40 41 42 43 | ** a quick status and does not check for up-to-date-ness of the file. ** ** In the -p form, there's an optional flag "-r|--revision REVISION". ** The specified version (or the latest checked out version) is printed ** to stdout. ** ** Options: | | | | | | | | | > > > | > | | | 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
** a quick status and does not check for up-to-date-ness of the file.
**
** In the -p form, there's an optional flag "-r|--revision REVISION".
** The specified version (or the latest checked out version) is printed
** to stdout.
**
** Options:
** --brief|-b display a brief (one line / revision) summary
** --limit N display the first N changes
** --log|-l select log mode (the default)
** --offset P skip P changes
** -p select print mode
** --revision|-r R print the given revision (or ckout, if none is given)
** to stdout (only in print mode)
** -s select status mode (print a status indicator for FILE)
** --case-sensitive B Enable or disable case-sensitive filenames. B is a
** boolean: "yes", "no", "true", "false", etc.
**
** See also: descendants, info, leaves
*/
void finfo_cmd(void){
capture_case_sensitive_option();
db_must_be_within_tree();
if (find_option("status","s",0)) {
Stmt q;
Blob line;
Blob fname;
int vid;
if( g.argc!=3 ) usage("-s|--status FILENAME");
vid = db_lget_int("checkout", 0);
if( vid==0 ){
fossil_panic("no checkout to finfo files in");
}
vfile_check_signature(vid, 1, 0);
file_tree_name(g.argv[2], &fname, 1);
db_prepare(&q,
"SELECT pathname, deleted, rid, chnged, coalesce(origname!=pathname,0)"
" FROM vfile WHERE vfile.pathname=%B %s",
&fname, filename_collation());
blob_zero(&line);
if ( db_step(&q)==SQLITE_ROW ) {
Blob uuid;
int isDeleted = db_column_int(&q, 1);
int isNew = db_column_int(&q,2) == 0;
int chnged = db_column_int(&q,3);
int renamed = db_column_int(&q,4);
blob_zero(&uuid);
db_blob(&uuid,
"SELECT uuid FROM blob, mlink, vfile WHERE "
"blob.rid = mlink.mid AND mlink.fid = vfile.rid AND "
"vfile.pathname=%B %s",
&fname, filename_collation()
);
if( isNew ){
blob_appendf(&line, "new");
}else if( isDeleted ){
blob_appendf(&line, "deleted");
}else if( renamed ){
blob_appendf(&line, "renamed");
|
| ︙ | ︙ | |||
111 112 113 114 115 116 117 |
Blob fname;
const char *zRevision = find_option("revision", "r", 1);
file_tree_name(g.argv[2], &fname, 1);
if( zRevision ){
historical_version_of_file(zRevision, blob_str(&fname), &record, 0, 0, 0);
}else{
| | > | 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
Blob fname;
const char *zRevision = find_option("revision", "r", 1);
file_tree_name(g.argv[2], &fname, 1);
if( zRevision ){
historical_version_of_file(zRevision, blob_str(&fname), &record, 0, 0, 0);
}else{
int rid = db_int(0, "SELECT rid FROM vfile WHERE pathname=%B %s",
&fname, filename_collation());
if( rid==0 ){
fossil_fatal("no history for file: %b", &fname);
}
content_get(rid, &record);
}
blob_write_to_file(&record, "-");
blob_reset(&record);
|
| ︙ | ︙ | |||
142 143 144 145 146 147 148 |
zOffset = find_option("offset",0,1);
iOffset = zOffset ? atoi(zOffset) : 0;
iBrief = (find_option("brief","b",0) == 0);
if( g.argc!=3 ){
usage("?-l|--log? ?-b|--brief? FILENAME");
}
file_tree_name(g.argv[2], &fname, 1);
| | > | | | 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 |
zOffset = find_option("offset",0,1);
iOffset = zOffset ? atoi(zOffset) : 0;
iBrief = (find_option("brief","b",0) == 0);
if( g.argc!=3 ){
usage("?-l|--log? ?-b|--brief? FILENAME");
}
file_tree_name(g.argv[2], &fname, 1);
rid = db_int(0, "SELECT rid FROM vfile WHERE pathname=%B %s",
&fname, filename_collation());
if( rid==0 ){
fossil_fatal("no history for file: %b", &fname);
}
zFilename = blob_str(&fname);
db_prepare(&q,
"SELECT b.uuid, ci.uuid, date(event.mtime,'localtime'),"
" coalesce(event.ecomment, event.comment),"
" coalesce(event.euser, event.user)"
" FROM mlink, blob b, event, blob ci, filename"
" WHERE filename.name=%Q %s"
" AND mlink.fnid=filename.fnid"
" AND b.rid=mlink.fid"
" AND event.objid=mlink.mid"
" AND event.objid=ci.rid"
" ORDER BY event.mtime DESC LIMIT %d OFFSET %d",
zFilename, filename_collation(), iLimit, iOffset
);
blob_zero(&line);
if( iBrief ){
fossil_print("History of %s\n", blob_str(&fname));
}
while( db_step(&q)==SQLITE_ROW ){
const char *zFileUuid = db_column_text(&q, 0);
|
| ︙ | ︙ | |||
241 242 243 244 245 246 247 |
" (SELECT uuid FROM blob WHERE rid=mlink.pid)," /* Parent file uuid */
" (SELECT uuid FROM blob WHERE rid=mlink.fid)," /* Current file uuid */
" (SELECT uuid FROM blob WHERE rid=mlink.mid)," /* Check-in uuid */
" event.bgcolor," /* Background color */
" (SELECT value FROM tagxref WHERE tagid=%d AND tagtype>0"
" AND tagxref.rid=mlink.mid)" /* Tags */
" FROM mlink, event"
| | | | 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 |
" (SELECT uuid FROM blob WHERE rid=mlink.pid)," /* Parent file uuid */
" (SELECT uuid FROM blob WHERE rid=mlink.fid)," /* Current file uuid */
" (SELECT uuid FROM blob WHERE rid=mlink.mid)," /* Check-in uuid */
" event.bgcolor," /* Background color */
" (SELECT value FROM tagxref WHERE tagid=%d AND tagtype>0"
" AND tagxref.rid=mlink.mid)" /* Tags */
" FROM mlink, event"
" WHERE mlink.fnid IN (SELECT fnid FROM filename WHERE name=%Q %s)"
" AND event.objid=mlink.mid",
TAG_BRANCH,
zFilename, filename_collation()
);
if( (zA = P("a"))!=0 ){
blob_appendf(&sql, " AND event.mtime>=julianday('%q')", zA);
}
if( (zB = P("b"))!=0 ){
blob_appendf(&sql, " AND event.mtime<=julianday('%q')", zB);
}
|
| ︙ | ︙ |
Changes to src/manifest.c.
| ︙ | ︙ | |||
1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 |
if( pFile && pFile->zUuid==0 ) return 0;
if( pFile==0 && p->zBaseline ){
fetch_baseline(p, 1);
pFile = manifest_file_seek_base(p->pBaseline, zName);
}
return pFile;
}
/*
** Add mlink table entries associated with manifest cid, pChild. The
** parent manifest is pid, pParent. One of either pChild or pParent
** will be NULL and it will be computed based on cid/pid.
**
** A single mlink entry is added for every file that changed content,
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 |
if( pFile && pFile->zUuid==0 ) return 0;
if( pFile==0 && p->zBaseline ){
fetch_baseline(p, 1);
pFile = manifest_file_seek_base(p->pBaseline, zName);
}
return pFile;
}
/*
** Look for a file in a manifest, taking the case-sensitive option
** into account. If case-sensitive is off, then files in any case
** will match.
*/
ManifestFile *manifest_file_find(Manifest *p, const char *zName){
int i, n;
Manifest *pBase;
if( filenames_are_case_sensitive() ){
return manifest_file_seek(p, zName);
}
for(i=0; i<p->nFile; i++){
if( fossil_stricmp(zName, p->aFile[i].zName)==0 ){
return &p->aFile[i];
}
}
if( p->zBaseline==0 ) return 0;
fetch_baseline(p, 1);
pBase = p->pBaseline;
if( pBase==0 ) return 0;
for(i=0; i<pBase->nFile; i++){
if( fossil_stricmp(zName, p->aFile[i].zName)==0 ){
return &p->aFile[i];
}
}
return 0;
}
/*
** Add mlink table entries associated with manifest cid, pChild. The
** parent manifest is pid, pParent. One of either pChild or pParent
** will be NULL and it will be computed based on cid/pid.
**
** A single mlink entry is added for every file that changed content,
|
| ︙ | ︙ |
Changes to src/update.c.
| ︙ | ︙ | |||
573 574 575 576 577 578 579 |
if( !is_a_version(rid) ){
if( errCode>0 ) return errCode;
fossil_fatal("no such checkin: %s", revision);
}
pManifest = manifest_get(rid, CFTYPE_MANIFEST);
if( pManifest ){
| | | 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 |
if( !is_a_version(rid) ){
if( errCode>0 ) return errCode;
fossil_fatal("no such checkin: %s", revision);
}
pManifest = manifest_get(rid, CFTYPE_MANIFEST);
if( pManifest ){
pFile = manifest_file_find(pManifest, file);
if( pFile ){
rid = uuid_to_rid(pFile->zUuid, 0);
if( pIsExe ) *pIsExe = ( manifest_file_mperm(pFile)==PERM_EXE );
if( pIsLink ) *pIsLink = ( manifest_file_mperm(pFile)==PERM_LNK );
manifest_destroy(pManifest);
return content_get(rid, content);
}
|
| ︙ | ︙ |