1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
--- src/diff.c.orig 2013-02-16 01:13:55.000000000 +0100
+++ src/diff.c 2013-03-18 11:16:10.684776601 +0100
@@ -2202,6 +2202,7 @@
int rid; /* Artifact ID of the file being annotated */
char *zLabel; /* Label to apply to a line */
Stmt q; /* Query returning all ancestor versions */
+ Stmt ins; /* Inserts into the temporary VSEEN table */
int cnt = 0; /* Number of versions examined */
/* Initialize the annotation */
@@ -2214,7 +2215,13 @@
}
if( iLimit<=0 ) iLimit = 1000000000;
annotation_start(p, &toAnnotate);
-
+ db_begin_transaction();
+ db_multi_exec(
+ "CREATE TABLE IF NOT EXISTS vseen(rid INTEGER PRIMARY KEY);"
+ "DELETE FROM vseen;"
+ );
+
+ db_prepare(&ins, "INSERT OR IGNORE INTO vseen(rid) VALUES(:rid)");
db_prepare(&q,
"SELECT (SELECT uuid FROM blob WHERE rid=mlink.%s),"
" date(event.mtime),"
@@ -2223,10 +2230,11 @@
" FROM mlink, event"
" WHERE mlink.fid=:rid"
" AND event.objid=mlink.mid"
+ " AND mlink.pid NOT IN vseen"
" ORDER BY event.mtime",
(annFlags & ANN_FILE_VERS)!=0 ? "fid" : "mid"
);
-
+
db_bind_int(&q, ":rid", rid);
if( iLimit==0 ) iLimit = 1000000000;
while( rid && iLimit>cnt && db_step(&q)==SQLITE_ROW ){
@@ -2247,6 +2255,9 @@
p->azVers[p->nVers-1] = zLabel;
content_get(rid, &step);
annotation_step(p, &step, zLabel);
+ db_bind_int(&ins, ":rid", rid);
+ db_step(&ins);
+ db_reset(&ins);
blob_reset(&step);
db_reset(&q);
rid = prevId;
@@ -2254,6 +2265,8 @@
cnt++;
}
db_finalize(&q);
+ db_finalize(&ins);
+ db_end_transaction(0);
}
/*
|