Check-in [e161670939]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Merge in the annotatecmd_fix branch.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: e161670939b93ec9610b00404b9b44569a2f1711
User & Date: drh 2011-10-19 19:54:35.629
References
2011-10-19
22:31
merged in trunk [e161670939b93ec]. check-in: 1d0a7103a3 user: stephan tags: json-multitag-test, json
20:16 Closed ticket [f0f9aff371]: 'annotate' misses changes. plus 2 other changes artifact: 9ff0f33c2a user: viriketo
Context
2011-10-20
00:57
Update the built-in SQLite to the latest 3.7.9 beta. check-in: ccf43e1882 user: drh tags: trunk
2011-10-19
22:31
merged in trunk [e161670939b93ec]. check-in: 1d0a7103a3 user: stephan tags: json-multitag-test, json
20:28
Bringing back the fixes for the 'make test' from [bf480a29a6], [e46be99ff4], [129605856a], for an eventual merge to trunk. check-in: 5692702d50 user: viriketo tags: maketest_fixes
19:54
Merge in the annotatecmd_fix branch. check-in: e161670939 user: drh tags: trunk
18:59
Fix for ticket [e5999e25eedeb]. Code style fix. check-in: 4a296c0b1c user: jan tags: trunk
2011-10-18
19:45
Should fix ticket [f0f9aff371f2].

Until now, the annotate_cmd was taking the last (or any?) checkin that had the artifact to be annotated, totally unrelated to what version is checked out.

I made annotate_cmd respect the checkout, and annotate only from the past until the checked out version. This makes the command slower, but at least does... Closed-Leaf check-in: c7c4279f13 user: viriketo tags: annotatecmd_fix

Changes
Unified Diff Ignore Whitespace Patch
Changes to src/descendants.c.
200
201
202
203
204
205
206
207

208
209
210
211
212
213
214
** direct ancestor as the largest generation number.
*/
void compute_direct_ancestors(int rid, int N){
  Stmt ins;
  Stmt q;
  int gen = 0;
  db_multi_exec(
    "CREATE TEMP TABLE ancestor(rid INTEGER, generation INTEGER PRIMARY KEY);"

    "INSERT INTO ancestor VALUES(%d, 0);", rid
  );
  db_prepare(&ins, "INSERT INTO ancestor VALUES(:rid, :gen)");
  db_prepare(&q, 
    "SELECT pid FROM plink"
    " WHERE cid=:rid AND isprim"
  );







|
>







200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
** direct ancestor as the largest generation number.
*/
void compute_direct_ancestors(int rid, int N){
  Stmt ins;
  Stmt q;
  int gen = 0;
  db_multi_exec(
    "CREATE TEMP TABLE IF NOT EXISTS ancestor(rid INTEGER, generation INTEGER PRIMARY KEY);"
    "DELETE FROM ancestor;"
    "INSERT INTO ancestor VALUES(%d, 0);", rid
  );
  db_prepare(&ins, "INSERT INTO ancestor VALUES(:rid, :gen)");
  db_prepare(&q, 
    "SELECT pid FROM plink"
    " WHERE cid=:rid AND isprim"
  );
Changes to src/diff.c.
1066
1067
1068
1069
1070
1071
1072

1073
1074
1075
1076
1077
1078
1079
**   --log           List all versions analyzed
**   --filevers      Show file version numbers rather than check-in versions
*/
void annotate_cmd(void){
  int fnid;         /* Filename ID */
  int fid;          /* File instance ID */
  int mid;          /* Manifest where file was checked in */

  Blob treename;    /* FILENAME translated to canonical form */
  char *zFilename;  /* Cannonical filename */
  Annotator ann;    /* The annotation of the file */
  int i;            /* Loop counter */
  const char *zLimit; /* The value to the --limit option */
  int iLimit;       /* How far back in time to look */
  int showLog;      /* True to show the log */







>







1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
**   --log           List all versions analyzed
**   --filevers      Show file version numbers rather than check-in versions
*/
void annotate_cmd(void){
  int fnid;         /* Filename ID */
  int fid;          /* File instance ID */
  int mid;          /* Manifest where file was checked in */
  int cid;          /* Checkout ID */
  Blob treename;    /* FILENAME translated to canonical form */
  char *zFilename;  /* Cannonical filename */
  Annotator ann;    /* The annotation of the file */
  int i;            /* Loop counter */
  const char *zLimit; /* The value to the --limit option */
  int iLimit;       /* How far back in time to look */
  int showLog;      /* True to show the log */
1095
1096
1097
1098
1099
1100
1101






1102



1103
1104
1105
1106
1107
1108
1109
  if( fnid==0 ){
    fossil_fatal("no such file: %s", zFilename);
  }
  fid = db_int(0, "SELECT rid FROM vfile WHERE pathname=%Q", zFilename);
  if( fid==0 ){
    fossil_fatal("not part of current checkout: %s", zFilename);
  }






  mid = db_int(0, "SELECT mid FROM mlink WHERE fid=%d AND fnid=%d", fid, fnid);



  if( mid==0 ){
    fossil_panic("unable to find manifest");
  }
  if( fileVers ) annFlags |= ANN_FILE_VERS;
  annotate_file(&ann, fnid, mid, 0, iLimit, annFlags);
  if( showLog ){
    for(i=0; i<ann.nVers; i++){







>
>
>
>
>
>
|
>
>
>







1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
  if( fnid==0 ){
    fossil_fatal("no such file: %s", zFilename);
  }
  fid = db_int(0, "SELECT rid FROM vfile WHERE pathname=%Q", zFilename);
  if( fid==0 ){
    fossil_fatal("not part of current checkout: %s", zFilename);
  }
  cid = db_lget_int("checkout", 0);
  if (cid == 0){
    fossil_fatal("Not in a checkout");
  }
  if( iLimit<=0 ) iLimit = 1000000000;
  compute_direct_ancestors(cid, iLimit);
  mid = db_int(0, "SELECT mlink.mid FROM mlink, ancestor "
          " WHERE mlink.fid=%d AND mlink.fnid=%d AND mlink.mid=ancestor.rid"
          " ORDER BY ancestor.generation ASC LIMIT 1",
          fid, fnid);
  if( mid==0 ){
    fossil_panic("unable to find manifest");
  }
  if( fileVers ) annFlags |= ANN_FILE_VERS;
  annotate_file(&ann, fnid, mid, 0, iLimit, annFlags);
  if( showLog ){
    for(i=0; i<ann.nVers; i++){