Fossil SCM

Improved comments in the compute_ancestors() function. No code changes.

drh 2020-06-17 17:18 trunk
Commit c1abd612a9663e5550404acb86d8da925ad0c754d1dd7098bbb997515c08463d
1 file changed +9
--- src/descendants.c
+++ src/descendants.c
@@ -168,10 +168,11 @@
168168
N = -1;
169169
}else if( N<0 ){
170170
N = -N;
171171
}
172172
if( directOnly ){
173
+ /* Direct mode means to show primary parents only */
173174
db_multi_exec(
174175
"WITH RECURSIVE "
175176
" ancestor(rid, mtime) AS ("
176177
" SELECT %d, mtime FROM event WHERE objid=%d "
177178
" UNION "
@@ -185,10 +186,18 @@
185186
"INSERT INTO ok"
186187
" SELECT rid FROM ancestor;",
187188
rid, rid, N
188189
);
189190
}else{
191
+ /* If not in directMode, also include merge parents, including
192
+ ** cherrypick merges. Except, terminate searches at the cherrypick
193
+ ** merge parent itself. In other words, include:
194
+ ** (1) Primary parents
195
+ ** (2) Merge parents
196
+ ** (3) Cherrypick merge parents.
197
+ ** (4) All ancestores of 1 and 2 but not of 3.
198
+ */
190199
db_multi_exec(
191200
"WITH RECURSIVE "
192201
" parent(pid,cid,isCP) AS ("
193202
" SELECT plink.pid, plink.cid, 0 AS xisCP FROM plink"
194203
" UNION ALL"
195204
--- src/descendants.c
+++ src/descendants.c
@@ -168,10 +168,11 @@
168 N = -1;
169 }else if( N<0 ){
170 N = -N;
171 }
172 if( directOnly ){
 
173 db_multi_exec(
174 "WITH RECURSIVE "
175 " ancestor(rid, mtime) AS ("
176 " SELECT %d, mtime FROM event WHERE objid=%d "
177 " UNION "
@@ -185,10 +186,18 @@
185 "INSERT INTO ok"
186 " SELECT rid FROM ancestor;",
187 rid, rid, N
188 );
189 }else{
 
 
 
 
 
 
 
 
190 db_multi_exec(
191 "WITH RECURSIVE "
192 " parent(pid,cid,isCP) AS ("
193 " SELECT plink.pid, plink.cid, 0 AS xisCP FROM plink"
194 " UNION ALL"
195
--- src/descendants.c
+++ src/descendants.c
@@ -168,10 +168,11 @@
168 N = -1;
169 }else if( N<0 ){
170 N = -N;
171 }
172 if( directOnly ){
173 /* Direct mode means to show primary parents only */
174 db_multi_exec(
175 "WITH RECURSIVE "
176 " ancestor(rid, mtime) AS ("
177 " SELECT %d, mtime FROM event WHERE objid=%d "
178 " UNION "
@@ -185,10 +186,18 @@
186 "INSERT INTO ok"
187 " SELECT rid FROM ancestor;",
188 rid, rid, N
189 );
190 }else{
191 /* If not in directMode, also include merge parents, including
192 ** cherrypick merges. Except, terminate searches at the cherrypick
193 ** merge parent itself. In other words, include:
194 ** (1) Primary parents
195 ** (2) Merge parents
196 ** (3) Cherrypick merge parents.
197 ** (4) All ancestores of 1 and 2 but not of 3.
198 */
199 db_multi_exec(
200 "WITH RECURSIVE "
201 " parent(pid,cid,isCP) AS ("
202 " SELECT plink.pid, plink.cid, 0 AS xisCP FROM plink"
203 " UNION ALL"
204

Keyboard Shortcuts

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