Fossil SCM

Selectively revert a few changes made by the previous check-in

andygoth 2017-09-23 18:37 trunk
Commit b83ea94eb24ab110846ebc5850fff8dd7bb437565167902caa309aa55e5059b4
1 file changed +9 -5
+9 -5
--- src/diff.c
+++ src/diff.c
@@ -2500,10 +2500,11 @@
25002500
*/
25012501
void annotate_cmd(void){
25022502
int fnid; /* Filename ID */
25032503
int fid; /* File instance ID */
25042504
int mid; /* Manifest where file was checked in */
2505
+ int cid; /* Checkout or selected check-in ID */
25052506
Blob treename; /* FILENAME translated to canonical form */
25062507
const char *zRev; /* Revision name, or NULL for current check-in */
25072508
char *zFilename; /* Canonical filename */
25082509
Annotator ann; /* The annotation of the file */
25092510
int i; /* Loop counter */
@@ -2547,14 +2548,14 @@
25472548
}
25482549
25492550
/* Get artifact IDs of selected check-in and file */
25502551
if( zRev ){
25512552
/* Get artifact ID of selected check-in manifest */
2552
- mid = name_to_typed_rid(zRev, "ci");
2553
+ cid = name_to_typed_rid(zRev, "ci");
25532554
25542555
/* Get manifest structure for selected check-in */
2555
- pManifest = manifest_get(mid, CFTYPE_MANIFEST, 0);
2556
+ pManifest = manifest_get(cid, CFTYPE_MANIFEST, 0);
25562557
if( !pManifest ){
25572558
fossil_fatal("could not parse manifest for check-in: %s", zRev);
25582559
}
25592560
25602561
/* Get selected file in manifest */
@@ -2566,12 +2567,12 @@
25662567
25672568
/* Get file instance ID from manifest file record */
25682569
fid = fast_uuid_to_rid(pFile->zUuid);
25692570
}else{
25702571
/* Get artifact ID of current checkout manifest */
2571
- mid = db_lget_int("checkout", 0);
2572
- if( mid == 0 ){
2572
+ cid = db_lget_int("checkout", 0);
2573
+ if( cid == 0 ){
25732574
fossil_fatal("not in a checkout");
25742575
}
25752576
25762577
/* Get file instance ID from current checkout file table */
25772578
fid = db_int(0, "SELECT rid FROM vfile WHERE pathname=%Q", zFilename);
@@ -2579,15 +2580,18 @@
25792580
fossil_fatal("not part of current checkout: %s", zFilename);
25802581
}
25812582
}
25822583
25832584
/* Get ID of most recent manifest containing a change to the selected file */
2584
- compute_direct_ancestors(mid);
2585
+ compute_direct_ancestors(cid);
25852586
mid = db_int(0, "SELECT mlink.mid FROM mlink, ancestor "
25862587
" WHERE mlink.fid=%d AND mlink.fnid=%d AND mlink.mid=ancestor.rid"
25872588
" ORDER BY ancestor.generation ASC LIMIT 1",
25882589
fid, fnid);
2590
+ if( mid==0 ){
2591
+ fossil_fatal("unable to find manifest");
2592
+ }
25892593
25902594
if( iLimit<=0 ) iLimit = 1000000000;
25912595
annFlags |= (ANN_FILE_ANCEST|DIFF_STRIP_EOLCR);
25922596
annotate_file(&ann, fnid, mid, iLimit, annFlags);
25932597
if( showLog ){
25942598
--- src/diff.c
+++ src/diff.c
@@ -2500,10 +2500,11 @@
2500 */
2501 void annotate_cmd(void){
2502 int fnid; /* Filename ID */
2503 int fid; /* File instance ID */
2504 int mid; /* Manifest where file was checked in */
 
2505 Blob treename; /* FILENAME translated to canonical form */
2506 const char *zRev; /* Revision name, or NULL for current check-in */
2507 char *zFilename; /* Canonical filename */
2508 Annotator ann; /* The annotation of the file */
2509 int i; /* Loop counter */
@@ -2547,14 +2548,14 @@
2547 }
2548
2549 /* Get artifact IDs of selected check-in and file */
2550 if( zRev ){
2551 /* Get artifact ID of selected check-in manifest */
2552 mid = name_to_typed_rid(zRev, "ci");
2553
2554 /* Get manifest structure for selected check-in */
2555 pManifest = manifest_get(mid, CFTYPE_MANIFEST, 0);
2556 if( !pManifest ){
2557 fossil_fatal("could not parse manifest for check-in: %s", zRev);
2558 }
2559
2560 /* Get selected file in manifest */
@@ -2566,12 +2567,12 @@
2566
2567 /* Get file instance ID from manifest file record */
2568 fid = fast_uuid_to_rid(pFile->zUuid);
2569 }else{
2570 /* Get artifact ID of current checkout manifest */
2571 mid = db_lget_int("checkout", 0);
2572 if( mid == 0 ){
2573 fossil_fatal("not in a checkout");
2574 }
2575
2576 /* Get file instance ID from current checkout file table */
2577 fid = db_int(0, "SELECT rid FROM vfile WHERE pathname=%Q", zFilename);
@@ -2579,15 +2580,18 @@
2579 fossil_fatal("not part of current checkout: %s", zFilename);
2580 }
2581 }
2582
2583 /* Get ID of most recent manifest containing a change to the selected file */
2584 compute_direct_ancestors(mid);
2585 mid = db_int(0, "SELECT mlink.mid FROM mlink, ancestor "
2586 " WHERE mlink.fid=%d AND mlink.fnid=%d AND mlink.mid=ancestor.rid"
2587 " ORDER BY ancestor.generation ASC LIMIT 1",
2588 fid, fnid);
 
 
 
2589
2590 if( iLimit<=0 ) iLimit = 1000000000;
2591 annFlags |= (ANN_FILE_ANCEST|DIFF_STRIP_EOLCR);
2592 annotate_file(&ann, fnid, mid, iLimit, annFlags);
2593 if( showLog ){
2594
--- src/diff.c
+++ src/diff.c
@@ -2500,10 +2500,11 @@
2500 */
2501 void annotate_cmd(void){
2502 int fnid; /* Filename ID */
2503 int fid; /* File instance ID */
2504 int mid; /* Manifest where file was checked in */
2505 int cid; /* Checkout or selected check-in ID */
2506 Blob treename; /* FILENAME translated to canonical form */
2507 const char *zRev; /* Revision name, or NULL for current check-in */
2508 char *zFilename; /* Canonical filename */
2509 Annotator ann; /* The annotation of the file */
2510 int i; /* Loop counter */
@@ -2547,14 +2548,14 @@
2548 }
2549
2550 /* Get artifact IDs of selected check-in and file */
2551 if( zRev ){
2552 /* Get artifact ID of selected check-in manifest */
2553 cid = name_to_typed_rid(zRev, "ci");
2554
2555 /* Get manifest structure for selected check-in */
2556 pManifest = manifest_get(cid, CFTYPE_MANIFEST, 0);
2557 if( !pManifest ){
2558 fossil_fatal("could not parse manifest for check-in: %s", zRev);
2559 }
2560
2561 /* Get selected file in manifest */
@@ -2566,12 +2567,12 @@
2567
2568 /* Get file instance ID from manifest file record */
2569 fid = fast_uuid_to_rid(pFile->zUuid);
2570 }else{
2571 /* Get artifact ID of current checkout manifest */
2572 cid = db_lget_int("checkout", 0);
2573 if( cid == 0 ){
2574 fossil_fatal("not in a checkout");
2575 }
2576
2577 /* Get file instance ID from current checkout file table */
2578 fid = db_int(0, "SELECT rid FROM vfile WHERE pathname=%Q", zFilename);
@@ -2579,15 +2580,18 @@
2580 fossil_fatal("not part of current checkout: %s", zFilename);
2581 }
2582 }
2583
2584 /* Get ID of most recent manifest containing a change to the selected file */
2585 compute_direct_ancestors(cid);
2586 mid = db_int(0, "SELECT mlink.mid FROM mlink, ancestor "
2587 " WHERE mlink.fid=%d AND mlink.fnid=%d AND mlink.mid=ancestor.rid"
2588 " ORDER BY ancestor.generation ASC LIMIT 1",
2589 fid, fnid);
2590 if( mid==0 ){
2591 fossil_fatal("unable to find manifest");
2592 }
2593
2594 if( iLimit<=0 ) iLimit = 1000000000;
2595 annFlags |= (ANN_FILE_ANCEST|DIFF_STRIP_EOLCR);
2596 annotate_file(&ann, fnid, mid, iLimit, annFlags);
2597 if( showLog ){
2598

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button