Fossil SCM
Selectively revert a few changes made by the previous check-in
Commit
b83ea94eb24ab110846ebc5850fff8dd7bb437565167902caa309aa55e5059b4
Parent
5a6b194bc900eb0…
1 file changed
+9
-5
+9
-5
| --- src/diff.c | ||
| +++ src/diff.c | ||
| @@ -2500,10 +2500,11 @@ | ||
| 2500 | 2500 | */ |
| 2501 | 2501 | void annotate_cmd(void){ |
| 2502 | 2502 | int fnid; /* Filename ID */ |
| 2503 | 2503 | int fid; /* File instance ID */ |
| 2504 | 2504 | int mid; /* Manifest where file was checked in */ |
| 2505 | + int cid; /* Checkout or selected check-in ID */ | |
| 2505 | 2506 | Blob treename; /* FILENAME translated to canonical form */ |
| 2506 | 2507 | const char *zRev; /* Revision name, or NULL for current check-in */ |
| 2507 | 2508 | char *zFilename; /* Canonical filename */ |
| 2508 | 2509 | Annotator ann; /* The annotation of the file */ |
| 2509 | 2510 | int i; /* Loop counter */ |
| @@ -2547,14 +2548,14 @@ | ||
| 2547 | 2548 | } |
| 2548 | 2549 | |
| 2549 | 2550 | /* Get artifact IDs of selected check-in and file */ |
| 2550 | 2551 | if( zRev ){ |
| 2551 | 2552 | /* Get artifact ID of selected check-in manifest */ |
| 2552 | - mid = name_to_typed_rid(zRev, "ci"); | |
| 2553 | + cid = name_to_typed_rid(zRev, "ci"); | |
| 2553 | 2554 | |
| 2554 | 2555 | /* Get manifest structure for selected check-in */ |
| 2555 | - pManifest = manifest_get(mid, CFTYPE_MANIFEST, 0); | |
| 2556 | + pManifest = manifest_get(cid, CFTYPE_MANIFEST, 0); | |
| 2556 | 2557 | if( !pManifest ){ |
| 2557 | 2558 | fossil_fatal("could not parse manifest for check-in: %s", zRev); |
| 2558 | 2559 | } |
| 2559 | 2560 | |
| 2560 | 2561 | /* Get selected file in manifest */ |
| @@ -2566,12 +2567,12 @@ | ||
| 2566 | 2567 | |
| 2567 | 2568 | /* Get file instance ID from manifest file record */ |
| 2568 | 2569 | fid = fast_uuid_to_rid(pFile->zUuid); |
| 2569 | 2570 | }else{ |
| 2570 | 2571 | /* 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 ){ | |
| 2573 | 2574 | fossil_fatal("not in a checkout"); |
| 2574 | 2575 | } |
| 2575 | 2576 | |
| 2576 | 2577 | /* Get file instance ID from current checkout file table */ |
| 2577 | 2578 | fid = db_int(0, "SELECT rid FROM vfile WHERE pathname=%Q", zFilename); |
| @@ -2579,15 +2580,18 @@ | ||
| 2579 | 2580 | fossil_fatal("not part of current checkout: %s", zFilename); |
| 2580 | 2581 | } |
| 2581 | 2582 | } |
| 2582 | 2583 | |
| 2583 | 2584 | /* Get ID of most recent manifest containing a change to the selected file */ |
| 2584 | - compute_direct_ancestors(mid); | |
| 2585 | + compute_direct_ancestors(cid); | |
| 2585 | 2586 | mid = db_int(0, "SELECT mlink.mid FROM mlink, ancestor " |
| 2586 | 2587 | " WHERE mlink.fid=%d AND mlink.fnid=%d AND mlink.mid=ancestor.rid" |
| 2587 | 2588 | " ORDER BY ancestor.generation ASC LIMIT 1", |
| 2588 | 2589 | fid, fnid); |
| 2590 | + if( mid==0 ){ | |
| 2591 | + fossil_fatal("unable to find manifest"); | |
| 2592 | + } | |
| 2589 | 2593 | |
| 2590 | 2594 | if( iLimit<=0 ) iLimit = 1000000000; |
| 2591 | 2595 | annFlags |= (ANN_FILE_ANCEST|DIFF_STRIP_EOLCR); |
| 2592 | 2596 | annotate_file(&ann, fnid, mid, iLimit, annFlags); |
| 2593 | 2597 | if( showLog ){ |
| 2594 | 2598 |
| --- 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 |