127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
|
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
|
-
+
-
-
-
+
+
+
-
+
-
+
|
substr(b.uuid,0,8) uuid,
datetime(a.tm,'localtime') time
from blob b, ancestors a
WHERE b.rid=a.rid
</pre></nowiki>
Here's a more refined variant of the above, apply what i learned during
Here's a more refined variant of the above, applying what i learned during
an evening of tinkering with it...
<nowiki><pre>
-- All ancestors (direct or merged!) of the checkin
-- RID given in the first SELECT...
WITH RECURSIVE
-- Change this RID to the RID of the
-- origin for ancestry tracking
theRid(id) AS(
SELECT 3285 as rid -- origin RID
-- SELECT '8f89acc0f05df7bae1e7946efe5324f1e6905a9e' as uuid
theId(id) AS(
SELECT 3285 as id -- origin RID
-- SELECT '8f89acc0f05df7bae1e7946efe5324f1e6905a9e' as id
),
origin(rid, mtime, cutoffTime) AS(
-- origin RID
SELECT b.rid as rid,
e.mtime as mtime,
(e.mtime - 1.5) as cutoffTime -- Julian days
FROM blob b, event e, theRid
WHERE
b.rid=theRid.id
b.rid=theId.id
-- or use the UUID of the origin:
-- b.uuid=theRid.id
-- b.uuid=theId.id
AND e.objid=b.rid
),
ancestors(rid,uuid,tm,user,comment) AS (
SELECT b.rid, b.uuid, e.mtime, e.user,
coalesce(e.ecomment,e.comment)
FROM blob b, event e, origin
WHERE b.rid=origin.rid and e.objid=b.rid
|