Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | The "fossil diff" command now accepts options --from and --to in order to do a diff between two arbitrary check-ins. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
296b90a25bfbd3fc93bc9e6125284559 |
| User & Date: | drh 2010-08-07 16:10:29.000 |
Context
|
2010-08-07
| ||
| 18:09 | Enhance the "vdiff" web method so that it shows the differences between to arbitrary check-ins identified by the "from" and "to" query parameters. check-in: 1d713f3f4d user: drh tags: trunk | |
| 16:10 | The "fossil diff" command now accepts options --from and --to in order to do a diff between two arbitrary check-ins. check-in: 296b90a25b user: drh tags: trunk | |
|
2010-08-05
| ||
| 10:09 | Update SQLite to the latest 3.7.1 development snapshot. check-in: d090292800 user: drh tags: trunk, release | |
Changes
Changes to src/diffcmd.c.
| ︙ | ︙ | |||
269 270 271 272 273 274 275 |
);
diff_file(&content, zFullName, zPathname, zDiffCmd);
blob_reset(&content);
}
free(zFullName);
}
db_finalize(&q);
| | | 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 |
);
diff_file(&content, zFullName, zPathname, zDiffCmd);
blob_reset(&content);
}
free(zFullName);
}
db_finalize(&q);
db_end_transaction(1); /* ROLLBACK */
}
/*
** Output the differences between two versions of a single file.
** zFrom and zTo are the check-ins containing the two file versions.
** The filename is contained in g.argv[2].
*/
|
| ︙ | ︙ | |||
303 304 305 306 307 308 309 310 311 312 313 314 315 316 |
** Output the differences between two check-ins.
*/
static void diff_all_two_versions(
const char *zFrom,
const char *zTo,
const char *zDiffCmd
){
}
/*
** COMMAND: diff
** COMMAND: gdiff
**
** Usage: %fossil diff|gdiff ?options? ?FILE?
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 |
** Output the differences between two check-ins.
*/
static void diff_all_two_versions(
const char *zFrom,
const char *zTo,
const char *zDiffCmd
){
Manifest mFrom, mTo;
int iFrom, iTo;
manifest_from_name(zFrom, &mFrom);
manifest_from_name(zTo, &mTo);
iFrom = iTo = 0;
while( iFrom<mFrom.nFile && iTo<mTo.nFile ){
int cmp;
if( iFrom>=mFrom.nFile ){
cmp = +1;
}else if( iTo>=mTo.nFile ){
cmp = -1;
}else{
cmp = strcmp(mFrom.aFile[iFrom].zName, mTo.aFile[iTo].zName);
}
if( cmp<0 ){
printf("DELETED %s\n", mFrom.aFile[iFrom].zName);
iFrom++;
}else if( cmp>0 ){
printf("ADDED %s\n", mTo.aFile[iTo].zName);
iTo++;
}else if( strcmp(mFrom.aFile[iFrom].zUuid, mTo.aFile[iTo].zUuid)==0 ){
/* No changes */
iFrom++;
iTo++;
}else{
Blob f1, f2;
int rid;
printf("CHANGED %s\n", mFrom.aFile[iFrom].zName);
rid = uuid_to_rid(mFrom.aFile[iFrom].zUuid, 0);
content_get(rid, &f1);
rid = uuid_to_rid(mTo.aFile[iTo].zUuid, 0);
content_get(rid, &f2);
diff_file_mem(&f1, &f2, mFrom.aFile[iFrom].zName, zDiffCmd);
blob_reset(&f1);
blob_reset(&f2);
iFrom++;
iTo++;
}
}
manifest_clear(&mFrom);
manifest_clear(&mTo);
}
/*
** COMMAND: diff
** COMMAND: gdiff
**
** Usage: %fossil diff|gdiff ?options? ?FILE?
|
| ︙ | ︙ | |||
364 365 366 367 368 369 370 |
verify_all_options();
if( !isInternDiff && g.argc==3 ){
zDiffCmd = db_get(isGDiff ? "gdiff-command" : "diff-command", 0);
}
if( g.argc==3 ){
diff_one_two_versions(zFrom, zTo, zDiffCmd);
}else{
| < | 406 407 408 409 410 411 412 413 414 415 416 |
verify_all_options();
if( !isInternDiff && g.argc==3 ){
zDiffCmd = db_get(isGDiff ? "gdiff-command" : "diff-command", 0);
}
if( g.argc==3 ){
diff_one_two_versions(zFrom, zTo, zDiffCmd);
}else{
diff_all_two_versions(zFrom, zTo, zDiffCmd);
}
}
}
|
Changes to src/manifest.c.
| ︙ | ︙ | |||
1172 1173 1174 1175 1176 1177 1178 |
free(zComment);
}
}
db_end_transaction(0);
manifest_clear(&m);
return 1;
}
| > > > > > > > > > > > > > > > > > > > > > | 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 |
free(zComment);
}
}
db_end_transaction(0);
manifest_clear(&m);
return 1;
}
/*
** Given a checkin name, load and parse the manifest for that checkin.
** Throw a fatal error if anything goes wrong.
*/
void manifest_from_name(
const char *zName,
Manifest *pM
){
int rid;
Blob content;
rid = name_to_rid(zName);
if( !is_a_version(rid) ){
fossil_fatal("no such checkin: %s", zName);
}
content_get(rid, &content);
if( !manifest_parse(pM, &content) ){
fossil_fatal("cannot parse manifest for checkin: %s", zName);
}
}
|
Changes to src/update.c.
| ︙ | ︙ | |||
290 291 292 293 294 295 296 |
undo_finish();
db_end_transaction(0);
}
}
/*
| | > | | > > | | | 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 |
undo_finish();
db_end_transaction(0);
}
}
/*
** Get the contents of a file within the checking "revision". If
** revision==NULL then get the file content for the current checkout.
*/
int historical_version_of_file(
const char *revision, /* The checkin containing the file */
const char *file, /* Full treename of the file */
Blob *content, /* Put the content here */
int errCode /* Error code if file not found. Panic if 0. */
){
Blob mfile;
Manifest m;
int i, rid=0;
if( revision ){
rid = name_to_rid(revision);
}else{
rid = db_lget_int("checkout", 0);
}
if( !is_a_version(rid) ){
if( errCode>0 ) return errCode;
fossil_fatal("no such checkin: %s", 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);
manifest_clear(&m);
return content_get(rid, content);
}
}
manifest_clear(&m);
if( errCode<=0 ){
fossil_fatal("file %s does not exist in checkin: %s", file, revision);
}
}else if( errCode<=0 ){
fossil_panic("could not parse manifest for checkin: %s", revision);
}
return errCode;
}
/*
** COMMAND: revert
|
| ︙ | ︙ |