Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Fix the revert command so that it works from subdirectories. Other minor comment and help-text changes. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
371dd6574c3aa26439bb597f9bd69f0a |
| User & Date: | drh 2007-12-04 01:26:21.000 |
Context
|
2007-12-04
| ||
| 01:55 | Fix typos in the "concepts.html" document. check-in: ec1fbd7f68 user: drh tags: trunk | |
| 01:26 | Fix the revert command so that it works from subdirectories. Other minor comment and help-text changes. check-in: 371dd6574c user: drh tags: trunk | |
|
2007-12-03
| ||
| 19:17 | Send native deltas when cloning. The reduces bandwidth and reduces server load. check-in: 18fbb9c52d user: drh tags: trunk | |
Changes
Changes to src/checkin.c.
| ︙ | ︙ | |||
42 43 44 45 46 47 48 49 |
"WHERE file_is_selected(id) AND (chnged OR deleted OR rid=0) ORDER BY 1"
);
while( db_step(&q)==SQLITE_ROW ){
const char *zPathname = db_column_text(&q,0);
int isDeleted = db_column_int(&q, 1);
int isChnged = db_column_int(&q,2);
int isNew = db_column_int(&q,3)==0;
blob_append(report, zPrefix, nPrefix);
| > > > | > | 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 |
"WHERE file_is_selected(id) AND (chnged OR deleted OR rid=0) ORDER BY 1"
);
while( db_step(&q)==SQLITE_ROW ){
const char *zPathname = db_column_text(&q,0);
int isDeleted = db_column_int(&q, 1);
int isChnged = db_column_int(&q,2);
int isNew = db_column_int(&q,3)==0;
char *zFullName = mprintf("%s/%s", g.zLocalRoot, zPathname);
blob_append(report, zPrefix, nPrefix);
if( access(zFullName, 0) ){
blob_appendf(report, "MISSING %s\n", zPathname);
}else if( isNew ){
blob_appendf(report, "ADDED %s\n", zPathname);
}else if( isDeleted ){
blob_appendf(report, "DELETED %s\n", zPathname);
}else if( isChnged==2 ){
blob_appendf(report, "UPDATED_BY_MERGE %s\n", zPathname);
}else if( isChnged==3 ){
blob_appendf(report, "ADDED_BY_MERGE %s\n", zPathname);
}else{
blob_appendf(report, "EDITED %s\n", zPathname);
}
free(zFullName);
}
db_finalize(&q);
db_prepare(&q, "SELECT uuid FROM vmerge JOIN blob ON merge=rid"
" WHERE id=0");
while( db_step(&q)==SQLITE_ROW ){
blob_append(report, zPrefix, nPrefix);
blob_appendf(report, "MERGED_WITH %s\n", db_column_text(&q, 0));
|
| ︙ | ︙ |
Changes to src/db.c.
| ︙ | ︙ | |||
321 322 323 324 325 326 327 |
const char *db_column_text(Stmt *pStmt, int N){
return (char*)sqlite3_column_text(pStmt->pStmt, N);
}
const char *db_column_name(Stmt *pStmt, int N){
return (char*)sqlite3_column_name(pStmt->pStmt, N);
}
int db_column_count(Stmt *pStmt){
| | | 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 |
const char *db_column_text(Stmt *pStmt, int N){
return (char*)sqlite3_column_text(pStmt->pStmt, N);
}
const char *db_column_name(Stmt *pStmt, int N){
return (char*)sqlite3_column_name(pStmt->pStmt, N);
}
int db_column_count(Stmt *pStmt){
return sqlite3_column_count(pStmt->pStmt);
}
char *db_column_malloc(Stmt *pStmt, int N){
return mprintf("%s", db_column_text(pStmt, N));
}
void db_column_blob(Stmt *pStmt, int N, Blob *pBlob){
blob_append(pBlob, sqlite3_column_blob(pStmt->pStmt, N),
sqlite3_column_bytes(pStmt->pStmt, N));
|
| ︙ | ︙ |
Changes to src/diffcmd.c.
| ︙ | ︙ | |||
42 43 44 45 46 47 48 | } } /* ** COMMAND: diff ** COMMAND: gdiff ** | | | | | | | | | | 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 |
}
}
/*
** COMMAND: diff
** COMMAND: gdiff
**
** Usage: %fossil diff|gdiff ?-i? ?-r REVISION? FILE...
**
** Show the difference between the current version of a file (as it
** exists on disk) and that same file as it was checked out.
**
** diff will show a textual diff while gdiff will attempt to run a
** graphical diff command that you have setup. If the choosen command
** is not yet configured, the internal textual diff command will be
** used.
**
** If -i is supplied for either diff or gdiff, the internal textual
** diff command will be executed.
**
** Here are a few external diff command settings, for example:
**
** %fossil setting diff-command diff
**
** %fossil setting gdiff-command tkdiff
** %fossil setting gdiff-command eskill22
** %fossil setting gdiff-command tortoisemerge
** %fossil setting gdiff-command meld
** %fossil setting gdiff-command xxdiff
** %fossil setting gdiff-command kdiff3
*/
void diff_cmd(void){
const char *zFile, *zRevision;
Blob cmd;
Blob fname;
Blob vname;
Blob record;
|
| ︙ | ︙ | |||
114 115 116 117 118 119 120 |
if( zRevision==0 ){
int rid = db_int(0, "SELECT rid FROM vfile WHERE pathname=%B", &fname);
if( rid==0 ){
fossil_panic("no history for file: %b", &fname);
}
content_get(rid, &record);
}else{
| | | 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
if( zRevision==0 ){
int rid = db_int(0, "SELECT rid FROM vfile WHERE pathname=%B", &fname);
if( rid==0 ){
fossil_panic("no history for file: %b", &fname);
}
content_get(rid, &record);
}else{
historical_version_of_file(zRevision, zFile, &record);
}
if( internalDiff==1 ){
Blob out;
Blob current;
blob_zero(¤t);
blob_read_from_file(¤t, zFile);
blob_zero(&out);
|
| ︙ | ︙ |
Changes to src/update.c.
| ︙ | ︙ | |||
240 241 242 243 244 245 246 247 248 249 250 251 252 |
** Clean up the mid and pid VFILE entries. Then commit the changes.
*/
db_multi_exec("DELETE FROM vfile WHERE vid!=%d", tid);
manifest_to_disk(tid);
db_lset_int("checkout", tid);
db_end_transaction(0);
}
/*
** COMMAND: revert
**
** Usage: %fossil revert ?--yes? ?-r REVISION? FILE
**
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > | | | | > | | | | 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 |
** Clean up the mid and pid VFILE entries. Then commit the changes.
*/
db_multi_exec("DELETE FROM vfile WHERE vid!=%d", tid);
manifest_to_disk(tid);
db_lset_int("checkout", tid);
db_end_transaction(0);
}
/*
** Get the contents of a file within a given revision.
*/
int historical_version_of_file(
const char *revision, /* The baseline name containing the file */
const char *file, /* Full treename of the file */
Blob *content /* Put the content here */
){
Blob mfile;
Manifest m;
int i, rid=0;
rid = name_to_rid(revision);
content_get(rid, &mfile);
if( manifest_parse(&m, &mfile) ){
for(i=0; i<m.nFile; i++){
if( strcmp(m.aFile[i].zName, file)==0 ){
rid = uuid_to_rid(m.aFile[i].zUuid, 0);
return content_get(rid, content);
}
}
fossil_fatal("file %s does not exist in baseline: %s", file, revision);
}else{
fossil_panic("could not parse manifest for baseline: %s", revision);
}
return 0;
}
/*
** COMMAND: revert
**
** Usage: %fossil revert ?--yes? ?-r REVISION? FILE
**
** Revert to the current repository version of FILE, or to
** the version associated with baseline REVISION if the -r flag
** appears. This command will confirm your operation unless the
** file is missing or the --yes option is used.
**/
void revert_cmd(void){
const char *zFile;
const char *zRevision;
Blob fname;
Blob record;
Blob ans;
int rid = 0, yesRevert;
yesRevert = find_option("yes", "y", 0)!=0;
zRevision = find_option("revision", "r", 1);
verify_all_options();
if( g.argc<3 ){
usage("?OPTIONS FILE");
}
db_must_be_within_tree();
zFile = mprintf("%/", g.argv[g.argc-1]);
if( !file_tree_name(zFile, &fname) ){
fossil_panic("unknown file: %s", zFile);
}
if( access(zFile, 0) ) yesRevert = 1;
if( yesRevert==0 ){
char *prompt = mprintf("revert file %B? this will"
" destroy local changes [y/N]? ",
&fname);
blob_zero(&ans);
prompt_user(prompt, &ans);
if( blob_str(&ans)[0]=='y' ){
yesRevert = 1;
}
}
if( yesRevert==1 && zRevision!=0 ){
historical_version_of_file(zRevision, zFile, &record);
}else if( yesRevert==1 ){
rid = db_int(0, "SELECT rid FROM vfile WHERE pathname=%B", &fname);
if( rid==0 ){
fossil_panic("no history for file: %b", &fname);
}
content_get(rid, &record);
}
if( yesRevert==1 ){
blob_write_to_file(&record, zFile);
printf("%s reverted\n", zFile);
blob_reset(&record);
blob_reset(&fname);
}else{
printf("revert canceled\n");
}
}
|
Changes to src/wikiformat.c.
| ︙ | ︙ | |||
772 773 774 775 776 777 778 |
/*
** If the input string corresponds to an existing baseline,
** return true.
*/
static int is_valid_uuid(const char *z){
int n = strlen(z);
| < | 772 773 774 775 776 777 778 779 780 781 782 783 784 785 |
/*
** If the input string corresponds to an existing baseline,
** return true.
*/
static int is_valid_uuid(const char *z){
int n = strlen(z);
if( n<4 || n>UUID_SIZE ) return 0;
if( !validate16(z, n) ) return 0;
return 1;
}
/*
** Resolve a hyperlink. The argument is the content of the [...]
|
| ︙ | ︙ |