Fossil SCM

Merge in the annotatecmd_fix branch.

drh 2011-10-19 19:54 trunk merge
Commit e161670939b93ec9610b00404b9b44569a2f1711
2 files changed +2 -1 +11 -1
--- src/descendants.c
+++ src/descendants.c
@@ -202,11 +202,12 @@
202202
void compute_direct_ancestors(int rid, int N){
203203
Stmt ins;
204204
Stmt q;
205205
int gen = 0;
206206
db_multi_exec(
207
- "CREATE TEMP TABLE ancestor(rid INTEGER, generation INTEGER PRIMARY KEY);"
207
+ "CREATE TEMP TABLE IF NOT EXISTS ancestor(rid INTEGER, generation INTEGER PRIMARY KEY);"
208
+ "DELETE FROM ancestor;"
208209
"INSERT INTO ancestor VALUES(%d, 0);", rid
209210
);
210211
db_prepare(&ins, "INSERT INTO ancestor VALUES(:rid, :gen)");
211212
db_prepare(&q,
212213
"SELECT pid FROM plink"
213214
--- src/descendants.c
+++ src/descendants.c
@@ -202,11 +202,12 @@
202 void compute_direct_ancestors(int rid, int N){
203 Stmt ins;
204 Stmt q;
205 int gen = 0;
206 db_multi_exec(
207 "CREATE TEMP TABLE ancestor(rid INTEGER, generation INTEGER PRIMARY KEY);"
 
208 "INSERT INTO ancestor VALUES(%d, 0);", rid
209 );
210 db_prepare(&ins, "INSERT INTO ancestor VALUES(:rid, :gen)");
211 db_prepare(&q,
212 "SELECT pid FROM plink"
213
--- src/descendants.c
+++ src/descendants.c
@@ -202,11 +202,12 @@
202 void compute_direct_ancestors(int rid, int N){
203 Stmt ins;
204 Stmt q;
205 int gen = 0;
206 db_multi_exec(
207 "CREATE TEMP TABLE IF NOT EXISTS ancestor(rid INTEGER, generation INTEGER PRIMARY KEY);"
208 "DELETE FROM ancestor;"
209 "INSERT INTO ancestor VALUES(%d, 0);", rid
210 );
211 db_prepare(&ins, "INSERT INTO ancestor VALUES(:rid, :gen)");
212 db_prepare(&q,
213 "SELECT pid FROM plink"
214
+11 -1
--- src/diff.c
+++ src/diff.c
@@ -1068,10 +1068,11 @@
10681068
*/
10691069
void annotate_cmd(void){
10701070
int fnid; /* Filename ID */
10711071
int fid; /* File instance ID */
10721072
int mid; /* Manifest where file was checked in */
1073
+ int cid; /* Checkout ID */
10731074
Blob treename; /* FILENAME translated to canonical form */
10741075
char *zFilename; /* Cannonical filename */
10751076
Annotator ann; /* The annotation of the file */
10761077
int i; /* Loop counter */
10771078
const char *zLimit; /* The value to the --limit option */
@@ -1097,11 +1098,20 @@
10971098
}
10981099
fid = db_int(0, "SELECT rid FROM vfile WHERE pathname=%Q", zFilename);
10991100
if( fid==0 ){
11001101
fossil_fatal("not part of current checkout: %s", zFilename);
11011102
}
1102
- mid = db_int(0, "SELECT mid FROM mlink WHERE fid=%d AND fnid=%d", fid, fnid);
1103
+ cid = db_lget_int("checkout", 0);
1104
+ if (cid == 0){
1105
+ fossil_fatal("Not in a checkout");
1106
+ }
1107
+ if( iLimit<=0 ) iLimit = 1000000000;
1108
+ compute_direct_ancestors(cid, iLimit);
1109
+ mid = db_int(0, "SELECT mlink.mid FROM mlink, ancestor "
1110
+ " WHERE mlink.fid=%d AND mlink.fnid=%d AND mlink.mid=ancestor.rid"
1111
+ " ORDER BY ancestor.generation ASC LIMIT 1",
1112
+ fid, fnid);
11031113
if( mid==0 ){
11041114
fossil_panic("unable to find manifest");
11051115
}
11061116
if( fileVers ) annFlags |= ANN_FILE_VERS;
11071117
annotate_file(&ann, fnid, mid, 0, iLimit, annFlags);
11081118
--- src/diff.c
+++ src/diff.c
@@ -1068,10 +1068,11 @@
1068 */
1069 void annotate_cmd(void){
1070 int fnid; /* Filename ID */
1071 int fid; /* File instance ID */
1072 int mid; /* Manifest where file was checked in */
 
1073 Blob treename; /* FILENAME translated to canonical form */
1074 char *zFilename; /* Cannonical filename */
1075 Annotator ann; /* The annotation of the file */
1076 int i; /* Loop counter */
1077 const char *zLimit; /* The value to the --limit option */
@@ -1097,11 +1098,20 @@
1097 }
1098 fid = db_int(0, "SELECT rid FROM vfile WHERE pathname=%Q", zFilename);
1099 if( fid==0 ){
1100 fossil_fatal("not part of current checkout: %s", zFilename);
1101 }
1102 mid = db_int(0, "SELECT mid FROM mlink WHERE fid=%d AND fnid=%d", fid, fnid);
 
 
 
 
 
 
 
 
 
1103 if( mid==0 ){
1104 fossil_panic("unable to find manifest");
1105 }
1106 if( fileVers ) annFlags |= ANN_FILE_VERS;
1107 annotate_file(&ann, fnid, mid, 0, iLimit, annFlags);
1108
--- src/diff.c
+++ src/diff.c
@@ -1068,10 +1068,11 @@
1068 */
1069 void annotate_cmd(void){
1070 int fnid; /* Filename ID */
1071 int fid; /* File instance ID */
1072 int mid; /* Manifest where file was checked in */
1073 int cid; /* Checkout ID */
1074 Blob treename; /* FILENAME translated to canonical form */
1075 char *zFilename; /* Cannonical filename */
1076 Annotator ann; /* The annotation of the file */
1077 int i; /* Loop counter */
1078 const char *zLimit; /* The value to the --limit option */
@@ -1097,11 +1098,20 @@
1098 }
1099 fid = db_int(0, "SELECT rid FROM vfile WHERE pathname=%Q", zFilename);
1100 if( fid==0 ){
1101 fossil_fatal("not part of current checkout: %s", zFilename);
1102 }
1103 cid = db_lget_int("checkout", 0);
1104 if (cid == 0){
1105 fossil_fatal("Not in a checkout");
1106 }
1107 if( iLimit<=0 ) iLimit = 1000000000;
1108 compute_direct_ancestors(cid, iLimit);
1109 mid = db_int(0, "SELECT mlink.mid FROM mlink, ancestor "
1110 " WHERE mlink.fid=%d AND mlink.fnid=%d AND mlink.mid=ancestor.rid"
1111 " ORDER BY ancestor.generation ASC LIMIT 1",
1112 fid, fnid);
1113 if( mid==0 ){
1114 fossil_panic("unable to find manifest");
1115 }
1116 if( fileVers ) annFlags |= ANN_FILE_VERS;
1117 annotate_file(&ann, fnid, mid, 0, iLimit, annFlags);
1118

Keyboard Shortcuts

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