Fossil SCM

Change the way branches are tagged: The value of the "branch" property is used to identify the branch name. Repository rebuild required. Also, branches must be retagged.

drh 2009-01-22 12:03 trunk
Commit 42c2a18e736b0cc75a93daa63a7afb6cec0d7856
+8 -7
--- src/branch.c
+++ src/branch.c
@@ -105,17 +105,17 @@
105105
zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rootid);
106106
blob_appendf(&branch, "P %s\n", zUuid);
107107
blob_appendf(&branch, "R %s\n", mParent.zRepoCksum);
108108
manifest_clear(&mParent);
109109
110
- /* Add the symbolic branch name and the "newbranch" tag to identify
110
+ /* Add the symbolic branch name and the "branch" tag to identify
111111
** this as a new branch */
112112
if( zColor!=0 ){
113113
blob_appendf(&branch, "T *bgcolor * %F\n", zColor);
114114
}
115
+ blob_appendf(&branch, "T *branch * %F\n", zBranch);
115116
blob_appendf(&branch, "T *sym-%F *\n", zBranch);
116
- blob_appendf(&branch, "T +newbranch *\n");
117117
118118
/* Cancel all other symbolic tags */
119119
db_prepare(&q,
120120
"SELECT tagname FROM tagxref, tag"
121121
" WHERE tagxref.rid=%d AND tagxref.tagid=tag.tagid"
@@ -201,13 +201,13 @@
201201
}else if( n>=2 && strncmp(g.argv[2],"list",n)==0 ){
202202
Stmt q;
203203
db_prepare(&q,
204204
"%s"
205205
" AND blob.rid IN (SELECT rid FROM tagxref"
206
- " WHERE tagid=%d AND tagtype==1)"
206
+ " WHERE tagid=%d AND tagtype==2 AND srcid!=0)"
207207
" ORDER BY event.mtime DESC",
208
- timeline_query_for_tty(), TAG_NEWBRANCH
208
+ timeline_query_for_tty(), TAG_BRANCH
209209
);
210210
print_timeline(&q, 2000);
211211
db_finalize(&q);
212212
}else{
213213
fossil_panic("branch subcommand should be one of: "
@@ -250,13 +250,14 @@
250250
251251
style_header("Branches");
252252
login_anonymous_available();
253253
@ <h2>The initial check-in for each branch:</h2>
254254
db_prepare(&q,
255
- "%s AND blob.rid IN (SELECT rid FROM tagxref WHERE tagtype>0 AND tagid=%d)"
255
+ "%s AND blob.rid IN (SELECT rid FROM tagxref"
256
+ " WHERE tagtype>0 AND tagid=%d AND srcid!=0)"
256257
" ORDER BY event.mtime DESC",
257
- timeline_query_for_www(), TAG_NEWBRANCH
258
+ timeline_query_for_www(), TAG_BRANCH
258259
);
259260
www_print_timeline(&q, 0, brlist_extra);
260261
db_finalize(&q);
261262
@ <br clear="both">
262263
@ <script>
@@ -286,11 +287,11 @@
286287
"%s AND blob.rid IN (SELECT rid FROM tagxref"
287288
" WHERE tagtype>1 AND srcid>0"
288289
" AND tagid IN (SELECT tagid FROM tag "
289290
" WHERE tagname GLOB 'sym-*'))"
290291
" ORDER BY event.mtime DESC",
291
- timeline_query_for_www(), TAG_NEWBRANCH
292
+ timeline_query_for_www()
292293
);
293294
www_print_timeline(&q, 0, 0);
294295
db_finalize(&q);
295296
@ <br clear="both">
296297
@ <script>
297298
--- src/branch.c
+++ src/branch.c
@@ -105,17 +105,17 @@
105 zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rootid);
106 blob_appendf(&branch, "P %s\n", zUuid);
107 blob_appendf(&branch, "R %s\n", mParent.zRepoCksum);
108 manifest_clear(&mParent);
109
110 /* Add the symbolic branch name and the "newbranch" tag to identify
111 ** this as a new branch */
112 if( zColor!=0 ){
113 blob_appendf(&branch, "T *bgcolor * %F\n", zColor);
114 }
 
115 blob_appendf(&branch, "T *sym-%F *\n", zBranch);
116 blob_appendf(&branch, "T +newbranch *\n");
117
118 /* Cancel all other symbolic tags */
119 db_prepare(&q,
120 "SELECT tagname FROM tagxref, tag"
121 " WHERE tagxref.rid=%d AND tagxref.tagid=tag.tagid"
@@ -201,13 +201,13 @@
201 }else if( n>=2 && strncmp(g.argv[2],"list",n)==0 ){
202 Stmt q;
203 db_prepare(&q,
204 "%s"
205 " AND blob.rid IN (SELECT rid FROM tagxref"
206 " WHERE tagid=%d AND tagtype==1)"
207 " ORDER BY event.mtime DESC",
208 timeline_query_for_tty(), TAG_NEWBRANCH
209 );
210 print_timeline(&q, 2000);
211 db_finalize(&q);
212 }else{
213 fossil_panic("branch subcommand should be one of: "
@@ -250,13 +250,14 @@
250
251 style_header("Branches");
252 login_anonymous_available();
253 @ <h2>The initial check-in for each branch:</h2>
254 db_prepare(&q,
255 "%s AND blob.rid IN (SELECT rid FROM tagxref WHERE tagtype>0 AND tagid=%d)"
 
256 " ORDER BY event.mtime DESC",
257 timeline_query_for_www(), TAG_NEWBRANCH
258 );
259 www_print_timeline(&q, 0, brlist_extra);
260 db_finalize(&q);
261 @ <br clear="both">
262 @ <script>
@@ -286,11 +287,11 @@
286 "%s AND blob.rid IN (SELECT rid FROM tagxref"
287 " WHERE tagtype>1 AND srcid>0"
288 " AND tagid IN (SELECT tagid FROM tag "
289 " WHERE tagname GLOB 'sym-*'))"
290 " ORDER BY event.mtime DESC",
291 timeline_query_for_www(), TAG_NEWBRANCH
292 );
293 www_print_timeline(&q, 0, 0);
294 db_finalize(&q);
295 @ <br clear="both">
296 @ <script>
297
--- src/branch.c
+++ src/branch.c
@@ -105,17 +105,17 @@
105 zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rootid);
106 blob_appendf(&branch, "P %s\n", zUuid);
107 blob_appendf(&branch, "R %s\n", mParent.zRepoCksum);
108 manifest_clear(&mParent);
109
110 /* Add the symbolic branch name and the "branch" tag to identify
111 ** this as a new branch */
112 if( zColor!=0 ){
113 blob_appendf(&branch, "T *bgcolor * %F\n", zColor);
114 }
115 blob_appendf(&branch, "T *branch * %F\n", zBranch);
116 blob_appendf(&branch, "T *sym-%F *\n", zBranch);
 
117
118 /* Cancel all other symbolic tags */
119 db_prepare(&q,
120 "SELECT tagname FROM tagxref, tag"
121 " WHERE tagxref.rid=%d AND tagxref.tagid=tag.tagid"
@@ -201,13 +201,13 @@
201 }else if( n>=2 && strncmp(g.argv[2],"list",n)==0 ){
202 Stmt q;
203 db_prepare(&q,
204 "%s"
205 " AND blob.rid IN (SELECT rid FROM tagxref"
206 " WHERE tagid=%d AND tagtype==2 AND srcid!=0)"
207 " ORDER BY event.mtime DESC",
208 timeline_query_for_tty(), TAG_BRANCH
209 );
210 print_timeline(&q, 2000);
211 db_finalize(&q);
212 }else{
213 fossil_panic("branch subcommand should be one of: "
@@ -250,13 +250,14 @@
250
251 style_header("Branches");
252 login_anonymous_available();
253 @ <h2>The initial check-in for each branch:</h2>
254 db_prepare(&q,
255 "%s AND blob.rid IN (SELECT rid FROM tagxref"
256 " WHERE tagtype>0 AND tagid=%d AND srcid!=0)"
257 " ORDER BY event.mtime DESC",
258 timeline_query_for_www(), TAG_BRANCH
259 );
260 www_print_timeline(&q, 0, brlist_extra);
261 db_finalize(&q);
262 @ <br clear="both">
263 @ <script>
@@ -286,11 +287,11 @@
287 "%s AND blob.rid IN (SELECT rid FROM tagxref"
288 " WHERE tagtype>1 AND srcid>0"
289 " AND tagid IN (SELECT tagid FROM tag "
290 " WHERE tagname GLOB 'sym-*'))"
291 " ORDER BY event.mtime DESC",
292 timeline_query_for_www()
293 );
294 www_print_timeline(&q, 0, 0);
295 db_finalize(&q);
296 @ <br clear="both">
297 @ <script>
298
+11 -31
--- src/checkin.c
+++ src/checkin.c
@@ -347,44 +347,24 @@
347347
}
348348
}
349349
350350
/*
351351
** Return true if the check-in with RID=rid is a leaf.
352
-**
353
-** A leaf has no children in the same branch. For the purposes of
354
-** this definition, a two check-ins are in same branch they have the
355
-** same set of propagated symbolic tags.
352
+** A leaf has no children in the same branch.
356353
*/
357354
int is_a_leaf(int rid){
358
-
359
- /* This query selects all children in the same branch as rid */
355
+ int rc;
360356
static const char zSql[] =
361
- @ SELECT cid FROM plink
362
- @ WHERE pid=:rid
363
- @ AND (SELECT group_concat(x) FROM (
364
- @ SELECT tag.tagid AS x FROM tagxref, tag
365
- @ WHERE tagxref.rid=:rid AND tagxref.tagtype=2
366
- @ AND tag.tagid=tagxref.tagid AND tagxref.srcid=0
367
- @ AND tag.tagname GLOB 'sym-*'
368
- @ ORDER BY 1)
369
- @ ) ==
370
- @ (SELECT group_concat(x) FROM (
371
- @ SELECT tag.tagid AS x FROM tagxref, tag
372
- @ WHERE tagxref.rid=plink.cid AND tagxref.tagtype=2
373
- @ AND tag.tagid=tagxref.tagid
374
- @ AND tag.tagname GLOB 'sym-*'
375
- @ ORDER BY 1)
376
- @ )
377
- ;
378
- Stmt q; /* The prepared statement */
379
- int rc; /* Return code from stepping the prepared statement */
380
-
381
- db_prepare(&q, zSql);
382
- db_bind_int(&q, ":rid", rid);
383
- rc = db_step(&q);
384
- db_finalize(&q);
385
- return rc==SQLITE_DONE;
357
+ @ SELECT 1 FROM plink
358
+ @ WHERE pid=%d
359
+ @ AND coalesce((SELECT value FROM tagxref
360
+ @ WHERE tagid=%d AND rid=plink.pid), 'trunk')
361
+ @ =coalesce((SELECT value FROM tagxref
362
+ @ WHERE tagid=%d AND rid=plink.cid), 'trunk')
363
+ ;
364
+ rc = db_int(0, zSql, rid, TAG_BRANCH, TAG_BRANCH);
365
+ return rc==0;
386366
}
387367
388368
/*
389369
** COMMAND: ci
390370
** COMMAND: commit
391371
--- src/checkin.c
+++ src/checkin.c
@@ -347,44 +347,24 @@
347 }
348 }
349
350 /*
351 ** Return true if the check-in with RID=rid is a leaf.
352 **
353 ** A leaf has no children in the same branch. For the purposes of
354 ** this definition, a two check-ins are in same branch they have the
355 ** same set of propagated symbolic tags.
356 */
357 int is_a_leaf(int rid){
358
359 /* This query selects all children in the same branch as rid */
360 static const char zSql[] =
361 @ SELECT cid FROM plink
362 @ WHERE pid=:rid
363 @ AND (SELECT group_concat(x) FROM (
364 @ SELECT tag.tagid AS x FROM tagxref, tag
365 @ WHERE tagxref.rid=:rid AND tagxref.tagtype=2
366 @ AND tag.tagid=tagxref.tagid AND tagxref.srcid=0
367 @ AND tag.tagname GLOB 'sym-*'
368 @ ORDER BY 1)
369 @ ) ==
370 @ (SELECT group_concat(x) FROM (
371 @ SELECT tag.tagid AS x FROM tagxref, tag
372 @ WHERE tagxref.rid=plink.cid AND tagxref.tagtype=2
373 @ AND tag.tagid=tagxref.tagid
374 @ AND tag.tagname GLOB 'sym-*'
375 @ ORDER BY 1)
376 @ )
377 ;
378 Stmt q; /* The prepared statement */
379 int rc; /* Return code from stepping the prepared statement */
380
381 db_prepare(&q, zSql);
382 db_bind_int(&q, ":rid", rid);
383 rc = db_step(&q);
384 db_finalize(&q);
385 return rc==SQLITE_DONE;
386 }
387
388 /*
389 ** COMMAND: ci
390 ** COMMAND: commit
391
--- src/checkin.c
+++ src/checkin.c
@@ -347,44 +347,24 @@
347 }
348 }
349
350 /*
351 ** Return true if the check-in with RID=rid is a leaf.
352 ** A leaf has no children in the same branch.
 
 
 
353 */
354 int is_a_leaf(int rid){
355 int rc;
 
356 static const char zSql[] =
357 @ SELECT 1 FROM plink
358 @ WHERE pid=%d
359 @ AND coalesce((SELECT value FROM tagxref
360 @ WHERE tagid=%d AND rid=plink.pid), 'trunk')
361 @ =coalesce((SELECT value FROM tagxref
362 @ WHERE tagid=%d AND rid=plink.cid), 'trunk')
363 ;
364 rc = db_int(0, zSql, rid, TAG_BRANCH, TAG_BRANCH);
365 return rc==0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
366 }
367
368 /*
369 ** COMMAND: ci
370 ** COMMAND: commit
371
+1 -1
--- src/db.c
+++ src/db.c
@@ -940,12 +940,12 @@
940940
zDate[10]='T';
941941
blob_appendf(&manifest, "D %s\n", zDate);
942942
blob_appendf(&manifest, "P\n");
943943
md5sum_init();
944944
blob_appendf(&manifest, "R %s\n", md5sum_finish(0));
945
+ blob_appendf(&manifest, "T *branch * trunk\n");
945946
blob_appendf(&manifest, "T *sym-trunk *\n");
946
- blob_appendf(&manifest, "T +newbranch *\n");
947947
blob_appendf(&manifest, "U %F\n", g.zLogin);
948948
md5sum_blob(&manifest, &hash);
949949
blob_appendf(&manifest, "Z %b\n", &hash);
950950
blob_reset(&hash);
951951
rid = content_put(&manifest, 0, 0);
952952
--- src/db.c
+++ src/db.c
@@ -940,12 +940,12 @@
940 zDate[10]='T';
941 blob_appendf(&manifest, "D %s\n", zDate);
942 blob_appendf(&manifest, "P\n");
943 md5sum_init();
944 blob_appendf(&manifest, "R %s\n", md5sum_finish(0));
 
945 blob_appendf(&manifest, "T *sym-trunk *\n");
946 blob_appendf(&manifest, "T +newbranch *\n");
947 blob_appendf(&manifest, "U %F\n", g.zLogin);
948 md5sum_blob(&manifest, &hash);
949 blob_appendf(&manifest, "Z %b\n", &hash);
950 blob_reset(&hash);
951 rid = content_put(&manifest, 0, 0);
952
--- src/db.c
+++ src/db.c
@@ -940,12 +940,12 @@
940 zDate[10]='T';
941 blob_appendf(&manifest, "D %s\n", zDate);
942 blob_appendf(&manifest, "P\n");
943 md5sum_init();
944 blob_appendf(&manifest, "R %s\n", md5sum_finish(0));
945 blob_appendf(&manifest, "T *branch * trunk\n");
946 blob_appendf(&manifest, "T *sym-trunk *\n");
 
947 blob_appendf(&manifest, "U %F\n", g.zLogin);
948 md5sum_blob(&manifest, &hash);
949 blob_appendf(&manifest, "Z %b\n", &hash);
950 blob_reset(&hash);
951 rid = content_put(&manifest, 0, 0);
952
--- src/descendants.c
+++ src/descendants.c
@@ -33,21 +33,11 @@
3333
** Create a temporary table named "leaves" if it does not
3434
** already exist. Load this table with the RID of all
3535
** check-ins that are leaves which are decended from
3636
** check-in iBase.
3737
**
38
-** A "leaf" is a check-in that has no children. For the purpose
39
-** of finding leaves, children marked with the "newbranch" tag are
40
-** not counted as children. For example:
41
-**
42
-**
43
-** A -> B -> C -> D
44
-** `-> E
45
-**
46
-** D and E are clearly leaves since they have no children. If
47
-** D has the "newbranch" tag, then C is also a leaf since its only
48
-** child is marked as a newbranch.
38
+** A "leaf" is a check-in that has no children in the same branch.
4939
**
5040
** The closeMode flag determines behavior associated with the "closed"
5141
** tag:
5242
**
5343
** closeMode==0 Show all leaves regardless of the "closed" tag.
@@ -93,16 +83,17 @@
9383
9484
/* This query returns all non-merge children of check-in :rid */
9585
db_prepare(&q1, "SELECT cid FROM plink WHERE pid=:rid AND isprim");
9686
9787
/* This query returns a single row if check-in :rid is the first
98
- ** check-in of a new branch. In other words, it returns a row if
99
- ** check-in :rid has the 'newbranch' tag.
88
+ ** check-in of a new branch.
10089
*/
10190
db_prepare(&isBr,
102
- "SELECT 1 FROM tagxref WHERE rid=:rid AND tagid=%d AND tagtype=1",
103
- TAG_NEWBRANCH
91
+ "SELECT 1 FROM tagxref"
92
+ " WHERE rid=:rid AND tagid=%d AND tagtype=2"
93
+ " AND srcid>0",
94
+ TAG_BRANCH
10495
);
10596
10697
/* This statement inserts check-in :rid into the LEAVES table.
10798
*/
10899
db_prepare(&ins, "INSERT OR IGNORE INTO leaves VALUES(:rid)");
109100
--- src/descendants.c
+++ src/descendants.c
@@ -33,21 +33,11 @@
33 ** Create a temporary table named "leaves" if it does not
34 ** already exist. Load this table with the RID of all
35 ** check-ins that are leaves which are decended from
36 ** check-in iBase.
37 **
38 ** A "leaf" is a check-in that has no children. For the purpose
39 ** of finding leaves, children marked with the "newbranch" tag are
40 ** not counted as children. For example:
41 **
42 **
43 ** A -> B -> C -> D
44 ** `-> E
45 **
46 ** D and E are clearly leaves since they have no children. If
47 ** D has the "newbranch" tag, then C is also a leaf since its only
48 ** child is marked as a newbranch.
49 **
50 ** The closeMode flag determines behavior associated with the "closed"
51 ** tag:
52 **
53 ** closeMode==0 Show all leaves regardless of the "closed" tag.
@@ -93,16 +83,17 @@
93
94 /* This query returns all non-merge children of check-in :rid */
95 db_prepare(&q1, "SELECT cid FROM plink WHERE pid=:rid AND isprim");
96
97 /* This query returns a single row if check-in :rid is the first
98 ** check-in of a new branch. In other words, it returns a row if
99 ** check-in :rid has the 'newbranch' tag.
100 */
101 db_prepare(&isBr,
102 "SELECT 1 FROM tagxref WHERE rid=:rid AND tagid=%d AND tagtype=1",
103 TAG_NEWBRANCH
 
 
104 );
105
106 /* This statement inserts check-in :rid into the LEAVES table.
107 */
108 db_prepare(&ins, "INSERT OR IGNORE INTO leaves VALUES(:rid)");
109
--- src/descendants.c
+++ src/descendants.c
@@ -33,21 +33,11 @@
33 ** Create a temporary table named "leaves" if it does not
34 ** already exist. Load this table with the RID of all
35 ** check-ins that are leaves which are decended from
36 ** check-in iBase.
37 **
38 ** A "leaf" is a check-in that has no children in the same branch.
 
 
 
 
 
 
 
 
 
 
39 **
40 ** The closeMode flag determines behavior associated with the "closed"
41 ** tag:
42 **
43 ** closeMode==0 Show all leaves regardless of the "closed" tag.
@@ -93,16 +83,17 @@
83
84 /* This query returns all non-merge children of check-in :rid */
85 db_prepare(&q1, "SELECT cid FROM plink WHERE pid=:rid AND isprim");
86
87 /* This query returns a single row if check-in :rid is the first
88 ** check-in of a new branch.
 
89 */
90 db_prepare(&isBr,
91 "SELECT 1 FROM tagxref"
92 " WHERE rid=:rid AND tagid=%d AND tagtype=2"
93 " AND srcid>0",
94 TAG_BRANCH
95 );
96
97 /* This statement inserts check-in :rid into the LEAVES table.
98 */
99 db_prepare(&ins, "INSERT OR IGNORE INTO leaves VALUES(:rid)");
100
+103 -19
--- src/info.c
+++ src/info.c
@@ -230,21 +230,22 @@
230230
231231
232232
/*
233233
** Show information about baselines mentioned in the "leaves" table.
234234
*/
235
-static void showLeaves(void){
235
+static void showLeaves(int rid){
236236
Stmt q;
237237
int cnt = 0;
238238
db_prepare(&q,
239239
"SELECT blob.uuid, datetime(event.mtime, 'localtime'),"
240240
" coalesce(event.euser, event.user),"
241241
" coalesce(event.ecomment,event.comment)"
242242
" FROM leaves, blob, event"
243
- " WHERE blob.rid=leaves.rid"
243
+ " WHERE blob.rid=leaves.rid AND blob.rid!=%d"
244244
" AND event.objid=leaves.rid"
245
- " ORDER BY event.mtime DESC"
245
+ " ORDER BY event.mtime DESC",
246
+ rid
246247
);
247248
while( db_step(&q)==SQLITE_ROW ){
248249
const char *zUuid = db_column_text(&q, 0);
249250
const char *zDate = db_column_text(&q, 1);
250251
const char *zUser = db_column_text(&q, 2);
@@ -477,11 +478,11 @@
477478
}
478479
}
479480
@ </ul>
480481
compute_leaves(rid, 0);
481482
showDescendants(rid, 2, "Descendants");
482
- showLeaves();
483
+ showLeaves(rid);
483484
showAncestors(rid, 2, "Ancestors");
484485
style_footer();
485486
}
486487
487488
/*
@@ -1165,13 +1166,16 @@
11651166
const char *zNewComment;
11661167
const char *zUser;
11671168
const char *zNewUser;
11681169
const char *zColor;
11691170
const char *zNewColor;
1171
+ const char *zNewTag;
1172
+ const char *zNewBranch;
11701173
int fPropagateColor;
11711174
char *zUuid;
11721175
Blob comment;
1176
+ Stmt q;
11731177
static const struct SampleColors {
11741178
const char *zCName;
11751179
const char *zColor;
11761180
} aColor[] = {
11771181
{ "(none)", "" },
@@ -1190,26 +1194,30 @@
11901194
int i;
11911195
11921196
login_check_credentials();
11931197
if( !g.okWrite ){ login_needed(); return; }
11941198
rid = atoi(PD("r","0"));
1199
+ zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
11951200
zComment = db_text(0, "SELECT coalesce(ecomment,comment)"
11961201
" FROM event WHERE objid=%d", rid);
11971202
if( zComment==0 ) fossil_redirect_home();
1203
+ if( P("cancel") ){
1204
+ cgi_redirectf("vinfo?name=%d", rid);
1205
+ }
11981206
zNewComment = PD("c",zComment);
11991207
zUser = db_text(0, "SELECT coalesce(euser,user)"
12001208
" FROM event WHERE objid=%d", rid);
12011209
if( zUser==0 ) fossil_redirect_home();
12021210
zNewUser = PD("u",zUser);
12031211
zColor = db_text("", "SELECT bgcolor"
12041212
" FROM event WHERE objid=%d", rid);
12051213
zNewColor = PD("clr",zColor);
12061214
fPropagateColor = P("pclr")!=0;
1207
- zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
1208
- if( P("cancel") ){
1209
- cgi_redirectf("vinfo?name=%d", rid);
1210
- }
1215
+ zNewTag = P("newtag")!=0 ? P("tagname") : 0;
1216
+ if( zNewTag && zNewTag[0]==0 ) zNewTag = 0;
1217
+ zNewBranch = P("newbr")!=0 ? P("brname") : 0;
1218
+ if( zNewBranch && zNewBranch[0]==0 ) zNewBranch = 0;
12111219
if( P("apply") ){
12121220
Blob ctrl;
12131221
char *zDate;
12141222
int nChng = 0;
12151223
@@ -1216,30 +1224,59 @@
12161224
login_verify_csrf_secret();
12171225
blob_zero(&ctrl);
12181226
zDate = db_text(0, "SELECT datetime('now')");
12191227
zDate[10] = 'T';
12201228
blob_appendf(&ctrl, "D %s\n", zDate);
1229
+ db_multi_exec("CREATE TEMP TABLE newtags(tag UNIQUE, prefix, value)");
12211230
if( zNewColor[0] && strcmp(zColor,zNewColor)!=0 ){
1222
- nChng++;
1231
+ char *zPrefix = "+";
12231232
if( fPropagateColor ){
1224
- blob_appendf(&ctrl, "T *bgcolor %s %F\n", zUuid, zNewColor);
1225
- }else{
1226
- blob_appendf(&ctrl, "T +bgcolor %s %F\n", zUuid, zNewColor);
1233
+ zPrefix = "*";
12271234
}
1235
+ db_multi_exec("REPLACE INTO newtags VALUES('bgcolor',%Q,%Q)",
1236
+ zPrefix, zNewColor);
1237
+ }
1238
+ if( zNewColor[0]==0 && zColor[0]!=0 ){
1239
+ db_multi_exec("REPLACE INTO newtags VALUES('bgcolor','-',NULL)");
12281240
}
12291241
if( strcmp(zComment,zNewComment)!=0 ){
1230
- nChng++;
1231
- blob_appendf(&ctrl, "T +comment %s %F\n", zUuid, zNewComment);
1242
+ db_multi_exec("REPLACE INTO newtags VALUES('comment','+',%Q)",
1243
+ zNewComment);
12321244
}
12331245
if( strcmp(zUser,zNewUser)!=0 ){
1234
- nChng++;
1235
- blob_appendf(&ctrl, "T +user %s %F\n", zUuid, zNewUser);
1246
+ db_multi_exec("REPLACE INTO newtags VALUES('user','+',%Q)", zNewUser);
1247
+ }
1248
+ if( zNewTag ){
1249
+ db_multi_exec("REPLACE INTO newtags VALUES('sym-%q','+',NULL)", zNewTag);
1250
+ }
1251
+ if( zNewBranch ){
1252
+ db_multi_exec(
1253
+ "REPLACE INTO newtags "
1254
+ " SELECT tagname, '-', NULL FROM tagxref, tag"
1255
+ " WHERE tagxref.rid=%d AND tagtype==2"
1256
+ " AND tagname GLOB 'sym-*'"
1257
+ " AND tag.tagid=tagxref.tagid",
1258
+ rid
1259
+ );
1260
+ db_multi_exec("REPLACE INTO newtags VALUES('branch','*',%Q)", zNewBranch);
1261
+ db_multi_exec("REPLACE INTO newtags VALUES('sym-%q','*',NULL)",
1262
+ zNewBranch);
12361263
}
1237
- if( zNewColor[0]==0 && zColor[0]!=0 ){
1264
+ db_prepare(&q, "SELECT tag, prefix, value FROM newtags"
1265
+ " ORDER BY prefix || tag");
1266
+ while( db_step(&q)==SQLITE_ROW ){
1267
+ const char *zTag = db_column_text(&q, 0);
1268
+ const char *zPrefix = db_column_text(&q, 1);
1269
+ const char *zValue = db_column_text(&q, 2);
12381270
nChng++;
1239
- blob_appendf(&ctrl, "T -bgcolor %s\n", zUuid);
1271
+ if( zValue ){
1272
+ blob_appendf(&ctrl, "T %s%F %s %F\n", zPrefix, zTag, zUuid, zValue);
1273
+ }else{
1274
+ blob_appendf(&ctrl, "T %s%F %s\n", zPrefix, zTag, zUuid);
1275
+ }
12401276
}
1277
+ db_finalize(&q);
12411278
if( nChng>0 ){
12421279
int nrid;
12431280
Blob cksum;
12441281
blob_appendf(&ctrl, "U %F\n", g.zLogin);
12451282
md5sum_blob(&ctrl, &cksum);
@@ -1254,23 +1291,43 @@
12541291
blob_zero(&comment);
12551292
blob_append(&comment, zNewComment, -1);
12561293
zUuid[10] = 0;
12571294
style_header("Edit Baseline [%s]", zUuid);
12581295
if( P("preview") ){
1296
+ Blob suffix;
1297
+ int nTag = 0;
12591298
@ <b>Preview:</b>
12601299
@ <blockquote>
12611300
@ <table border=0>
12621301
if( zNewColor && zNewColor[0] ){
12631302
@ <tr><td bgcolor="%h(zNewColor)">
12641303
}else{
12651304
@ <tr><td>
12661305
}
12671306
wiki_convert(&comment, 0, WIKI_INLINE);
1268
- @ (user: %h(zNewUser))
1307
+ blob_zero(&suffix);
1308
+ blob_appendf(&suffix, "(user: %h", zNewUser);
1309
+ db_prepare(&q, "SELECT substr(tagname,5) FROM tagxref, tag"
1310
+ " WHERE tagname GLOB 'sym-*' AND tagxref.rid=%d"
1311
+ " AND tagtype>1 AND tag.tagid=tagxref.tagid",
1312
+ rid);
1313
+ while( db_step(&q)==SQLITE_ROW ){
1314
+ const char *zTag = db_column_text(&q, 0);
1315
+ if( nTag==0 ){
1316
+ blob_appendf(&suffix, ", tags: %h", zTag);
1317
+ }else{
1318
+ blob_appendf(&suffix, ", %h", zTag);
1319
+ }
1320
+ nTag++;
1321
+ }
1322
+ db_finalize(&q);
1323
+ blob_appendf(&suffix, ")");
1324
+ @ %s(blob_str(&suffix))
12691325
@ </td></tr></table>
12701326
@ </blockquote>
12711327
@ <hr>
1328
+ blob_reset(&suffix);
12721329
}
12731330
@ <p>Make changes to attributes of check-in
12741331
@ [<a href="vinfo?name=%d(rid)">%s(zUuid)</a>]:</p>
12751332
@ <form action="%s(g.zBaseURL)/vedit" method="POST">
12761333
login_insert_csrf_secret();
@@ -1311,10 +1368,37 @@
13111368
@ <input type="checkbox" name="pclr">
13121369
}
13131370
@ Propagate color to descendants</input></td></tr>
13141371
@ </table>
13151372
@ </td></tr>
1373
+
1374
+ @ <tr><td align="right" valign="top"><b>Tags:</b></td>
1375
+ @ <td valign="top">
1376
+ @ <input type="checkbox" name="newtag">
1377
+ @ Add the following new tag name to this check-in:
1378
+ @ <input type="text" width="15" name="tagname">
1379
+ @ </td></tr>
1380
+
1381
+ if( db_exists("SELECT 1 FROM tagxref WHERE rid=%d AND tagid=%d AND srcid>0",
1382
+ rid, TAG_BRANCH)==0 ){
1383
+ @ <tr><td align="right" valign="top"><b>Branching:</b></td>
1384
+ @ <td valign="top">
1385
+ @ <input type="checkbox" name="newbr">
1386
+ @ Make this check-in the start of a new branch named:
1387
+ @ <input type="text" width="15" name="brname">
1388
+ @ </td></tr>
1389
+ }
1390
+
1391
+ if( is_a_leaf(rid) ){
1392
+ @ <tr><td align="right" valign="top"><b>Leaf Closure:</b></td>
1393
+ @ <td valign="top">
1394
+ @ <input type="checkbox" name="close">
1395
+ @ Mark this leaf as "closed" so that it no longer appears on the
1396
+ @ "leaves" page and is no longer labeled as a "<b>Leaf</b>".
1397
+ @ </td></tr>
1398
+ }
1399
+
13161400
13171401
@ <tr><td colspan="2">
13181402
@ <input type="submit" name="preview" value="Preview">
13191403
@ <input type="submit" name="apply" value="Apply Changes">
13201404
@ <input type="submit" name="cancel" value="Cancel">
13211405
--- src/info.c
+++ src/info.c
@@ -230,21 +230,22 @@
230
231
232 /*
233 ** Show information about baselines mentioned in the "leaves" table.
234 */
235 static void showLeaves(void){
236 Stmt q;
237 int cnt = 0;
238 db_prepare(&q,
239 "SELECT blob.uuid, datetime(event.mtime, 'localtime'),"
240 " coalesce(event.euser, event.user),"
241 " coalesce(event.ecomment,event.comment)"
242 " FROM leaves, blob, event"
243 " WHERE blob.rid=leaves.rid"
244 " AND event.objid=leaves.rid"
245 " ORDER BY event.mtime DESC"
 
246 );
247 while( db_step(&q)==SQLITE_ROW ){
248 const char *zUuid = db_column_text(&q, 0);
249 const char *zDate = db_column_text(&q, 1);
250 const char *zUser = db_column_text(&q, 2);
@@ -477,11 +478,11 @@
477 }
478 }
479 @ </ul>
480 compute_leaves(rid, 0);
481 showDescendants(rid, 2, "Descendants");
482 showLeaves();
483 showAncestors(rid, 2, "Ancestors");
484 style_footer();
485 }
486
487 /*
@@ -1165,13 +1166,16 @@
1165 const char *zNewComment;
1166 const char *zUser;
1167 const char *zNewUser;
1168 const char *zColor;
1169 const char *zNewColor;
 
 
1170 int fPropagateColor;
1171 char *zUuid;
1172 Blob comment;
 
1173 static const struct SampleColors {
1174 const char *zCName;
1175 const char *zColor;
1176 } aColor[] = {
1177 { "(none)", "" },
@@ -1190,26 +1194,30 @@
1190 int i;
1191
1192 login_check_credentials();
1193 if( !g.okWrite ){ login_needed(); return; }
1194 rid = atoi(PD("r","0"));
 
1195 zComment = db_text(0, "SELECT coalesce(ecomment,comment)"
1196 " FROM event WHERE objid=%d", rid);
1197 if( zComment==0 ) fossil_redirect_home();
 
 
 
1198 zNewComment = PD("c",zComment);
1199 zUser = db_text(0, "SELECT coalesce(euser,user)"
1200 " FROM event WHERE objid=%d", rid);
1201 if( zUser==0 ) fossil_redirect_home();
1202 zNewUser = PD("u",zUser);
1203 zColor = db_text("", "SELECT bgcolor"
1204 " FROM event WHERE objid=%d", rid);
1205 zNewColor = PD("clr",zColor);
1206 fPropagateColor = P("pclr")!=0;
1207 zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
1208 if( P("cancel") ){
1209 cgi_redirectf("vinfo?name=%d", rid);
1210 }
1211 if( P("apply") ){
1212 Blob ctrl;
1213 char *zDate;
1214 int nChng = 0;
1215
@@ -1216,30 +1224,59 @@
1216 login_verify_csrf_secret();
1217 blob_zero(&ctrl);
1218 zDate = db_text(0, "SELECT datetime('now')");
1219 zDate[10] = 'T';
1220 blob_appendf(&ctrl, "D %s\n", zDate);
 
1221 if( zNewColor[0] && strcmp(zColor,zNewColor)!=0 ){
1222 nChng++;
1223 if( fPropagateColor ){
1224 blob_appendf(&ctrl, "T *bgcolor %s %F\n", zUuid, zNewColor);
1225 }else{
1226 blob_appendf(&ctrl, "T +bgcolor %s %F\n", zUuid, zNewColor);
1227 }
 
 
 
 
 
1228 }
1229 if( strcmp(zComment,zNewComment)!=0 ){
1230 nChng++;
1231 blob_appendf(&ctrl, "T +comment %s %F\n", zUuid, zNewComment);
1232 }
1233 if( strcmp(zUser,zNewUser)!=0 ){
1234 nChng++;
1235 blob_appendf(&ctrl, "T +user %s %F\n", zUuid, zNewUser);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1236 }
1237 if( zNewColor[0]==0 && zColor[0]!=0 ){
 
 
 
 
 
1238 nChng++;
1239 blob_appendf(&ctrl, "T -bgcolor %s\n", zUuid);
 
 
 
 
1240 }
 
1241 if( nChng>0 ){
1242 int nrid;
1243 Blob cksum;
1244 blob_appendf(&ctrl, "U %F\n", g.zLogin);
1245 md5sum_blob(&ctrl, &cksum);
@@ -1254,23 +1291,43 @@
1254 blob_zero(&comment);
1255 blob_append(&comment, zNewComment, -1);
1256 zUuid[10] = 0;
1257 style_header("Edit Baseline [%s]", zUuid);
1258 if( P("preview") ){
 
 
1259 @ <b>Preview:</b>
1260 @ <blockquote>
1261 @ <table border=0>
1262 if( zNewColor && zNewColor[0] ){
1263 @ <tr><td bgcolor="%h(zNewColor)">
1264 }else{
1265 @ <tr><td>
1266 }
1267 wiki_convert(&comment, 0, WIKI_INLINE);
1268 @ (user: %h(zNewUser))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1269 @ </td></tr></table>
1270 @ </blockquote>
1271 @ <hr>
 
1272 }
1273 @ <p>Make changes to attributes of check-in
1274 @ [<a href="vinfo?name=%d(rid)">%s(zUuid)</a>]:</p>
1275 @ <form action="%s(g.zBaseURL)/vedit" method="POST">
1276 login_insert_csrf_secret();
@@ -1311,10 +1368,37 @@
1311 @ <input type="checkbox" name="pclr">
1312 }
1313 @ Propagate color to descendants</input></td></tr>
1314 @ </table>
1315 @ </td></tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1316
1317 @ <tr><td colspan="2">
1318 @ <input type="submit" name="preview" value="Preview">
1319 @ <input type="submit" name="apply" value="Apply Changes">
1320 @ <input type="submit" name="cancel" value="Cancel">
1321
--- src/info.c
+++ src/info.c
@@ -230,21 +230,22 @@
230
231
232 /*
233 ** Show information about baselines mentioned in the "leaves" table.
234 */
235 static void showLeaves(int rid){
236 Stmt q;
237 int cnt = 0;
238 db_prepare(&q,
239 "SELECT blob.uuid, datetime(event.mtime, 'localtime'),"
240 " coalesce(event.euser, event.user),"
241 " coalesce(event.ecomment,event.comment)"
242 " FROM leaves, blob, event"
243 " WHERE blob.rid=leaves.rid AND blob.rid!=%d"
244 " AND event.objid=leaves.rid"
245 " ORDER BY event.mtime DESC",
246 rid
247 );
248 while( db_step(&q)==SQLITE_ROW ){
249 const char *zUuid = db_column_text(&q, 0);
250 const char *zDate = db_column_text(&q, 1);
251 const char *zUser = db_column_text(&q, 2);
@@ -477,11 +478,11 @@
478 }
479 }
480 @ </ul>
481 compute_leaves(rid, 0);
482 showDescendants(rid, 2, "Descendants");
483 showLeaves(rid);
484 showAncestors(rid, 2, "Ancestors");
485 style_footer();
486 }
487
488 /*
@@ -1165,13 +1166,16 @@
1166 const char *zNewComment;
1167 const char *zUser;
1168 const char *zNewUser;
1169 const char *zColor;
1170 const char *zNewColor;
1171 const char *zNewTag;
1172 const char *zNewBranch;
1173 int fPropagateColor;
1174 char *zUuid;
1175 Blob comment;
1176 Stmt q;
1177 static const struct SampleColors {
1178 const char *zCName;
1179 const char *zColor;
1180 } aColor[] = {
1181 { "(none)", "" },
@@ -1190,26 +1194,30 @@
1194 int i;
1195
1196 login_check_credentials();
1197 if( !g.okWrite ){ login_needed(); return; }
1198 rid = atoi(PD("r","0"));
1199 zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
1200 zComment = db_text(0, "SELECT coalesce(ecomment,comment)"
1201 " FROM event WHERE objid=%d", rid);
1202 if( zComment==0 ) fossil_redirect_home();
1203 if( P("cancel") ){
1204 cgi_redirectf("vinfo?name=%d", rid);
1205 }
1206 zNewComment = PD("c",zComment);
1207 zUser = db_text(0, "SELECT coalesce(euser,user)"
1208 " FROM event WHERE objid=%d", rid);
1209 if( zUser==0 ) fossil_redirect_home();
1210 zNewUser = PD("u",zUser);
1211 zColor = db_text("", "SELECT bgcolor"
1212 " FROM event WHERE objid=%d", rid);
1213 zNewColor = PD("clr",zColor);
1214 fPropagateColor = P("pclr")!=0;
1215 zNewTag = P("newtag")!=0 ? P("tagname") : 0;
1216 if( zNewTag && zNewTag[0]==0 ) zNewTag = 0;
1217 zNewBranch = P("newbr")!=0 ? P("brname") : 0;
1218 if( zNewBranch && zNewBranch[0]==0 ) zNewBranch = 0;
1219 if( P("apply") ){
1220 Blob ctrl;
1221 char *zDate;
1222 int nChng = 0;
1223
@@ -1216,30 +1224,59 @@
1224 login_verify_csrf_secret();
1225 blob_zero(&ctrl);
1226 zDate = db_text(0, "SELECT datetime('now')");
1227 zDate[10] = 'T';
1228 blob_appendf(&ctrl, "D %s\n", zDate);
1229 db_multi_exec("CREATE TEMP TABLE newtags(tag UNIQUE, prefix, value)");
1230 if( zNewColor[0] && strcmp(zColor,zNewColor)!=0 ){
1231 char *zPrefix = "+";
1232 if( fPropagateColor ){
1233 zPrefix = "*";
 
 
1234 }
1235 db_multi_exec("REPLACE INTO newtags VALUES('bgcolor',%Q,%Q)",
1236 zPrefix, zNewColor);
1237 }
1238 if( zNewColor[0]==0 && zColor[0]!=0 ){
1239 db_multi_exec("REPLACE INTO newtags VALUES('bgcolor','-',NULL)");
1240 }
1241 if( strcmp(zComment,zNewComment)!=0 ){
1242 db_multi_exec("REPLACE INTO newtags VALUES('comment','+',%Q)",
1243 zNewComment);
1244 }
1245 if( strcmp(zUser,zNewUser)!=0 ){
1246 db_multi_exec("REPLACE INTO newtags VALUES('user','+',%Q)", zNewUser);
1247 }
1248 if( zNewTag ){
1249 db_multi_exec("REPLACE INTO newtags VALUES('sym-%q','+',NULL)", zNewTag);
1250 }
1251 if( zNewBranch ){
1252 db_multi_exec(
1253 "REPLACE INTO newtags "
1254 " SELECT tagname, '-', NULL FROM tagxref, tag"
1255 " WHERE tagxref.rid=%d AND tagtype==2"
1256 " AND tagname GLOB 'sym-*'"
1257 " AND tag.tagid=tagxref.tagid",
1258 rid
1259 );
1260 db_multi_exec("REPLACE INTO newtags VALUES('branch','*',%Q)", zNewBranch);
1261 db_multi_exec("REPLACE INTO newtags VALUES('sym-%q','*',NULL)",
1262 zNewBranch);
1263 }
1264 db_prepare(&q, "SELECT tag, prefix, value FROM newtags"
1265 " ORDER BY prefix || tag");
1266 while( db_step(&q)==SQLITE_ROW ){
1267 const char *zTag = db_column_text(&q, 0);
1268 const char *zPrefix = db_column_text(&q, 1);
1269 const char *zValue = db_column_text(&q, 2);
1270 nChng++;
1271 if( zValue ){
1272 blob_appendf(&ctrl, "T %s%F %s %F\n", zPrefix, zTag, zUuid, zValue);
1273 }else{
1274 blob_appendf(&ctrl, "T %s%F %s\n", zPrefix, zTag, zUuid);
1275 }
1276 }
1277 db_finalize(&q);
1278 if( nChng>0 ){
1279 int nrid;
1280 Blob cksum;
1281 blob_appendf(&ctrl, "U %F\n", g.zLogin);
1282 md5sum_blob(&ctrl, &cksum);
@@ -1254,23 +1291,43 @@
1291 blob_zero(&comment);
1292 blob_append(&comment, zNewComment, -1);
1293 zUuid[10] = 0;
1294 style_header("Edit Baseline [%s]", zUuid);
1295 if( P("preview") ){
1296 Blob suffix;
1297 int nTag = 0;
1298 @ <b>Preview:</b>
1299 @ <blockquote>
1300 @ <table border=0>
1301 if( zNewColor && zNewColor[0] ){
1302 @ <tr><td bgcolor="%h(zNewColor)">
1303 }else{
1304 @ <tr><td>
1305 }
1306 wiki_convert(&comment, 0, WIKI_INLINE);
1307 blob_zero(&suffix);
1308 blob_appendf(&suffix, "(user: %h", zNewUser);
1309 db_prepare(&q, "SELECT substr(tagname,5) FROM tagxref, tag"
1310 " WHERE tagname GLOB 'sym-*' AND tagxref.rid=%d"
1311 " AND tagtype>1 AND tag.tagid=tagxref.tagid",
1312 rid);
1313 while( db_step(&q)==SQLITE_ROW ){
1314 const char *zTag = db_column_text(&q, 0);
1315 if( nTag==0 ){
1316 blob_appendf(&suffix, ", tags: %h", zTag);
1317 }else{
1318 blob_appendf(&suffix, ", %h", zTag);
1319 }
1320 nTag++;
1321 }
1322 db_finalize(&q);
1323 blob_appendf(&suffix, ")");
1324 @ %s(blob_str(&suffix))
1325 @ </td></tr></table>
1326 @ </blockquote>
1327 @ <hr>
1328 blob_reset(&suffix);
1329 }
1330 @ <p>Make changes to attributes of check-in
1331 @ [<a href="vinfo?name=%d(rid)">%s(zUuid)</a>]:</p>
1332 @ <form action="%s(g.zBaseURL)/vedit" method="POST">
1333 login_insert_csrf_secret();
@@ -1311,10 +1368,37 @@
1368 @ <input type="checkbox" name="pclr">
1369 }
1370 @ Propagate color to descendants</input></td></tr>
1371 @ </table>
1372 @ </td></tr>
1373
1374 @ <tr><td align="right" valign="top"><b>Tags:</b></td>
1375 @ <td valign="top">
1376 @ <input type="checkbox" name="newtag">
1377 @ Add the following new tag name to this check-in:
1378 @ <input type="text" width="15" name="tagname">
1379 @ </td></tr>
1380
1381 if( db_exists("SELECT 1 FROM tagxref WHERE rid=%d AND tagid=%d AND srcid>0",
1382 rid, TAG_BRANCH)==0 ){
1383 @ <tr><td align="right" valign="top"><b>Branching:</b></td>
1384 @ <td valign="top">
1385 @ <input type="checkbox" name="newbr">
1386 @ Make this check-in the start of a new branch named:
1387 @ <input type="text" width="15" name="brname">
1388 @ </td></tr>
1389 }
1390
1391 if( is_a_leaf(rid) ){
1392 @ <tr><td align="right" valign="top"><b>Leaf Closure:</b></td>
1393 @ <td valign="top">
1394 @ <input type="checkbox" name="close">
1395 @ Mark this leaf as "closed" so that it no longer appears on the
1396 @ "leaves" page and is no longer labeled as a "<b>Leaf</b>".
1397 @ </td></tr>
1398 }
1399
1400
1401 @ <tr><td colspan="2">
1402 @ <input type="submit" name="preview" value="Preview">
1403 @ <input type="submit" name="apply" value="Apply Changes">
1404 @ <input type="submit" name="cancel" value="Cancel">
1405
+1 -12
--- src/rebuild.c
+++ src/rebuild.c
@@ -173,32 +173,21 @@
173173
*/
174174
static void rebuild_tag_trunk(void){
175175
int tagid = db_int(0, "SELECT 1 FROM tag WHERE tagname='sym-trunk'");
176176
int rid;
177177
char *zUuid;
178
- Stmt q;
179178
180179
if( tagid>0 ) return;
181180
rid = db_int(0, "SELECT pid FROM plink AS x WHERE NOT EXISTS("
182181
" SELECT 1 FROM plink WHERE cid=x.pid)");
183182
if( rid==0 ) return;
184
- db_prepare(&q, "SELECT uuid FROM tagxref, blob"
185
- " WHERE tagid=%d AND tagtype>0 AND blob.rid=tagxref.rid",
186
- TAG_NEWBRANCH);
187
-
188
- /* Block the trunk tag at all branches */
189
- while( db_step(&q)==SQLITE_ROW ){
190
- const char *z = db_column_text(&q, 0);
191
- tag_add_artifact("sym-", "trunk", z, 0, 0);
192
- }
193
- db_finalize(&q);
194183
195184
/* Add the trunk tag to the root of the whole tree */
196185
zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
197186
if( zUuid==0 ) return;
198187
tag_add_artifact("sym-", "trunk", zUuid, 0, 2);
199
- tag_add_artifact("", "newbranch", zUuid, 0, 1);
188
+ tag_add_artifact("", "branch", zUuid, "trunk", 2);
200189
}
201190
202191
/*
203192
** Core function to rebuild the infomration in the derived tables of a
204193
** fossil repository from the blobs. This function is shared between
205194
--- src/rebuild.c
+++ src/rebuild.c
@@ -173,32 +173,21 @@
173 */
174 static void rebuild_tag_trunk(void){
175 int tagid = db_int(0, "SELECT 1 FROM tag WHERE tagname='sym-trunk'");
176 int rid;
177 char *zUuid;
178 Stmt q;
179
180 if( tagid>0 ) return;
181 rid = db_int(0, "SELECT pid FROM plink AS x WHERE NOT EXISTS("
182 " SELECT 1 FROM plink WHERE cid=x.pid)");
183 if( rid==0 ) return;
184 db_prepare(&q, "SELECT uuid FROM tagxref, blob"
185 " WHERE tagid=%d AND tagtype>0 AND blob.rid=tagxref.rid",
186 TAG_NEWBRANCH);
187
188 /* Block the trunk tag at all branches */
189 while( db_step(&q)==SQLITE_ROW ){
190 const char *z = db_column_text(&q, 0);
191 tag_add_artifact("sym-", "trunk", z, 0, 0);
192 }
193 db_finalize(&q);
194
195 /* Add the trunk tag to the root of the whole tree */
196 zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
197 if( zUuid==0 ) return;
198 tag_add_artifact("sym-", "trunk", zUuid, 0, 2);
199 tag_add_artifact("", "newbranch", zUuid, 0, 1);
200 }
201
202 /*
203 ** Core function to rebuild the infomration in the derived tables of a
204 ** fossil repository from the blobs. This function is shared between
205
--- src/rebuild.c
+++ src/rebuild.c
@@ -173,32 +173,21 @@
173 */
174 static void rebuild_tag_trunk(void){
175 int tagid = db_int(0, "SELECT 1 FROM tag WHERE tagname='sym-trunk'");
176 int rid;
177 char *zUuid;
 
178
179 if( tagid>0 ) return;
180 rid = db_int(0, "SELECT pid FROM plink AS x WHERE NOT EXISTS("
181 " SELECT 1 FROM plink WHERE cid=x.pid)");
182 if( rid==0 ) return;
 
 
 
 
 
 
 
 
 
 
183
184 /* Add the trunk tag to the root of the whole tree */
185 zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
186 if( zUuid==0 ) return;
187 tag_add_artifact("sym-", "trunk", zUuid, 0, 2);
188 tag_add_artifact("", "branch", zUuid, "trunk", 2);
189 }
190
191 /*
192 ** Core function to rebuild the infomration in the derived tables of a
193 ** fossil repository from the blobs. This function is shared between
194
+2 -2
--- src/schema.c
+++ src/schema.c
@@ -279,11 +279,11 @@
279279
@ INSERT INTO tag VALUES(2, 'comment'); -- TAG_COMMENT
280280
@ INSERT INTO tag VALUES(3, 'user'); -- TAG_USER
281281
@ INSERT INTO tag VALUES(4, 'hidden'); -- TAG_HIDDEN
282282
@ INSERT INTO tag VALUES(5, 'private'); -- TAG_PRIVATE
283283
@ INSERT INTO tag VALUES(6, 'cluster'); -- TAG_CLUSTER
284
-@ INSERT INTO tag VALUES(7, 'newbranch'); -- TAG_NEWBRANCH
284
+@ INSERT INTO tag VALUES(7, 'branch'); -- TAG_BRANCH
285285
@ INSERT INTO tag VALUES(8, 'closed'); -- TAG_CLOSED
286286
@
287287
@ -- Assignments of tags to baselines. Note that we allow tags to
288288
@ -- have values assigned to them. So we are not really dealing with
289289
@ -- tags here. These are really properties. But we are going to
@@ -333,11 +333,11 @@
333333
# define TAG_COMMENT 2 /* The check-in comment */
334334
# define TAG_USER 3 /* User who made a checking */
335335
# define TAG_HIDDEN 4 /* Do not display or sync */
336336
# define TAG_PRIVATE 5 /* Display but do not sync */
337337
# define TAG_CLUSTER 6 /* A cluster */
338
-# define TAG_NEWBRANCH 7 /* First check-in of a new named branch */
338
+# define TAG_BRANCH 7 /* Value is name of the current branch */
339339
# define TAG_CLOSED 8 /* Do not display this check-in as a leaf */
340340
#endif
341341
#if EXPORT_INTERFACE
342342
# define MAX_INT_TAG 8 /* The largest pre-assigned tag id */
343343
#endif
344344
--- src/schema.c
+++ src/schema.c
@@ -279,11 +279,11 @@
279 @ INSERT INTO tag VALUES(2, 'comment'); -- TAG_COMMENT
280 @ INSERT INTO tag VALUES(3, 'user'); -- TAG_USER
281 @ INSERT INTO tag VALUES(4, 'hidden'); -- TAG_HIDDEN
282 @ INSERT INTO tag VALUES(5, 'private'); -- TAG_PRIVATE
283 @ INSERT INTO tag VALUES(6, 'cluster'); -- TAG_CLUSTER
284 @ INSERT INTO tag VALUES(7, 'newbranch'); -- TAG_NEWBRANCH
285 @ INSERT INTO tag VALUES(8, 'closed'); -- TAG_CLOSED
286 @
287 @ -- Assignments of tags to baselines. Note that we allow tags to
288 @ -- have values assigned to them. So we are not really dealing with
289 @ -- tags here. These are really properties. But we are going to
@@ -333,11 +333,11 @@
333 # define TAG_COMMENT 2 /* The check-in comment */
334 # define TAG_USER 3 /* User who made a checking */
335 # define TAG_HIDDEN 4 /* Do not display or sync */
336 # define TAG_PRIVATE 5 /* Display but do not sync */
337 # define TAG_CLUSTER 6 /* A cluster */
338 # define TAG_NEWBRANCH 7 /* First check-in of a new named branch */
339 # define TAG_CLOSED 8 /* Do not display this check-in as a leaf */
340 #endif
341 #if EXPORT_INTERFACE
342 # define MAX_INT_TAG 8 /* The largest pre-assigned tag id */
343 #endif
344
--- src/schema.c
+++ src/schema.c
@@ -279,11 +279,11 @@
279 @ INSERT INTO tag VALUES(2, 'comment'); -- TAG_COMMENT
280 @ INSERT INTO tag VALUES(3, 'user'); -- TAG_USER
281 @ INSERT INTO tag VALUES(4, 'hidden'); -- TAG_HIDDEN
282 @ INSERT INTO tag VALUES(5, 'private'); -- TAG_PRIVATE
283 @ INSERT INTO tag VALUES(6, 'cluster'); -- TAG_CLUSTER
284 @ INSERT INTO tag VALUES(7, 'branch'); -- TAG_BRANCH
285 @ INSERT INTO tag VALUES(8, 'closed'); -- TAG_CLOSED
286 @
287 @ -- Assignments of tags to baselines. Note that we allow tags to
288 @ -- have values assigned to them. So we are not really dealing with
289 @ -- tags here. These are really properties. But we are going to
@@ -333,11 +333,11 @@
333 # define TAG_COMMENT 2 /* The check-in comment */
334 # define TAG_USER 3 /* User who made a checking */
335 # define TAG_HIDDEN 4 /* Do not display or sync */
336 # define TAG_PRIVATE 5 /* Display but do not sync */
337 # define TAG_CLUSTER 6 /* A cluster */
338 # define TAG_BRANCH 7 /* Value is name of the current branch */
339 # define TAG_CLOSED 8 /* Do not display this check-in as a leaf */
340 #endif
341 #if EXPORT_INTERFACE
342 # define MAX_INT_TAG 8 /* The largest pre-assigned tag id */
343 #endif
344
+26 -19
--- src/timeline.c
+++ src/timeline.c
@@ -75,26 +75,28 @@
7575
}
7676
}
7777
}
7878
7979
/*
80
-** Count the number of non-branch children for the given check-in.
81
-** A non-branch child is a child that omits the "newbranch" tag.
80
+** Count the number of primary non-branch children for the given check-in.
81
+**
82
+** A primary child is one where the parent is the primary parent, not
83
+** a merge parent.
84
+**
85
+** A non-branch child is one which is on the same branch as the parent.
8286
*/
8387
int count_nonbranch_children(int pid){
8488
int nNonBranch;
85
-
86
- nNonBranch = db_int(0,
87
- "SELECT count(*) FROM plink"
88
- " WHERE pid=%d AND isprim"
89
- " AND NOT EXISTS(SELECT 1 FROM tagxref"
90
- " WHERE tagid=%d"
91
- " AND rid=cid"
92
- " AND tagtype>0"
93
- " )",
94
- pid, TAG_NEWBRANCH
95
- );
89
+ static const char zSql[] =
90
+ @ SELECT count(*) FROM plink
91
+ @ WHERE pid=%d AND isprim
92
+ @ AND coalesce((SELECT value FROM tagxref
93
+ @ WHERE tagid=%d AND rid=plink.pid), 'trunk')
94
+ @ =coalesce((SELECT value FROM tagxref
95
+ @ WHERE tagid=%d AND rid=plink.cid), 'trunk')
96
+ ;
97
+ nNonBranch = db_int(0, zSql, pid, TAG_BRANCH, TAG_BRANCH);
9698
return nNonBranch;
9799
}
98100
99101
/*
100102
** Allowed flags for the tmFlags argument to www_print_timeline
@@ -241,33 +243,38 @@
241243
/*
242244
** Return a pointer to a constant string that forms the basis
243245
** for a timeline query for the WWW interface.
244246
*/
245247
const char *timeline_query_for_www(void){
248
+ static char *zBase = 0;
246249
static const char zBaseSql[] =
247250
@ SELECT
248251
@ blob.rid,
249252
@ uuid,
250253
@ datetime(event.mtime,'localtime') AS timestamp,
251254
@ coalesce(ecomment, comment),
252255
@ coalesce(euser, user),
253256
@ (SELECT count(*) FROM plink WHERE pid=blob.rid AND isprim=1),
254257
@ (SELECT count(*) FROM plink WHERE cid=blob.rid),
255
- @ 0==(SELECT count(*) FROM plink
256
- @ WHERE pid=blob.rid AND isprim AND NOT EXISTS(
257
- @ SELECT 1 FROM tagxref
258
- @ WHERE tagid=(SELECT tagid FROM tag WHERE tagname='newbranch')
259
- @ AND rid=plink.cid AND tagtype>0)),
258
+ @ NOT EXISTS(SELECT 1 FROM plink
259
+ @ WHERE pid=blob.rid
260
+ @ AND coalesce((SELECT value FROM tagxref
261
+ @ WHERE tagid=%d AND rid=plink.pid), 'trunk')
262
+ @ = coalesce((SELECT value FROM tagxref
263
+ @ WHERE tagid=%d AND rid=plink.cid), 'trunk')),
260264
@ bgcolor,
261265
@ event.type,
262266
@ (SELECT group_concat(substr(tagname,5), ', ') FROM tag, tagxref
263267
@ WHERE tagname GLOB 'sym-*' AND tag.tagid=tagxref.tagid
264268
@ AND tagxref.rid=blob.rid AND tagxref.tagtype>0)
265269
@ FROM event JOIN blob
266270
@ WHERE blob.rid=event.objid
267271
;
268
- return zBaseSql;
272
+ if( zBase==0 ){
273
+ zBase = mprintf(zBaseSql, TAG_BRANCH, TAG_BRANCH);
274
+ }
275
+ return zBase;
269276
}
270277
271278
/*
272279
** Generate a submenu element with a single parameter change.
273280
*/
274281
--- src/timeline.c
+++ src/timeline.c
@@ -75,26 +75,28 @@
75 }
76 }
77 }
78
79 /*
80 ** Count the number of non-branch children for the given check-in.
81 ** A non-branch child is a child that omits the "newbranch" tag.
 
 
 
 
82 */
83 int count_nonbranch_children(int pid){
84 int nNonBranch;
85
86 nNonBranch = db_int(0,
87 "SELECT count(*) FROM plink"
88 " WHERE pid=%d AND isprim"
89 " AND NOT EXISTS(SELECT 1 FROM tagxref"
90 " WHERE tagid=%d"
91 " AND rid=cid"
92 " AND tagtype>0"
93 " )",
94 pid, TAG_NEWBRANCH
95 );
96 return nNonBranch;
97 }
98
99 /*
100 ** Allowed flags for the tmFlags argument to www_print_timeline
@@ -241,33 +243,38 @@
241 /*
242 ** Return a pointer to a constant string that forms the basis
243 ** for a timeline query for the WWW interface.
244 */
245 const char *timeline_query_for_www(void){
 
246 static const char zBaseSql[] =
247 @ SELECT
248 @ blob.rid,
249 @ uuid,
250 @ datetime(event.mtime,'localtime') AS timestamp,
251 @ coalesce(ecomment, comment),
252 @ coalesce(euser, user),
253 @ (SELECT count(*) FROM plink WHERE pid=blob.rid AND isprim=1),
254 @ (SELECT count(*) FROM plink WHERE cid=blob.rid),
255 @ 0==(SELECT count(*) FROM plink
256 @ WHERE pid=blob.rid AND isprim AND NOT EXISTS(
257 @ SELECT 1 FROM tagxref
258 @ WHERE tagid=(SELECT tagid FROM tag WHERE tagname='newbranch')
259 @ AND rid=plink.cid AND tagtype>0)),
 
260 @ bgcolor,
261 @ event.type,
262 @ (SELECT group_concat(substr(tagname,5), ', ') FROM tag, tagxref
263 @ WHERE tagname GLOB 'sym-*' AND tag.tagid=tagxref.tagid
264 @ AND tagxref.rid=blob.rid AND tagxref.tagtype>0)
265 @ FROM event JOIN blob
266 @ WHERE blob.rid=event.objid
267 ;
268 return zBaseSql;
 
 
 
269 }
270
271 /*
272 ** Generate a submenu element with a single parameter change.
273 */
274
--- src/timeline.c
+++ src/timeline.c
@@ -75,26 +75,28 @@
75 }
76 }
77 }
78
79 /*
80 ** Count the number of primary non-branch children for the given check-in.
81 **
82 ** A primary child is one where the parent is the primary parent, not
83 ** a merge parent.
84 **
85 ** A non-branch child is one which is on the same branch as the parent.
86 */
87 int count_nonbranch_children(int pid){
88 int nNonBranch;
89 static const char zSql[] =
90 @ SELECT count(*) FROM plink
91 @ WHERE pid=%d AND isprim
92 @ AND coalesce((SELECT value FROM tagxref
93 @ WHERE tagid=%d AND rid=plink.pid), 'trunk')
94 @ =coalesce((SELECT value FROM tagxref
95 @ WHERE tagid=%d AND rid=plink.cid), 'trunk')
96 ;
97 nNonBranch = db_int(0, zSql, pid, TAG_BRANCH, TAG_BRANCH);
 
 
98 return nNonBranch;
99 }
100
101 /*
102 ** Allowed flags for the tmFlags argument to www_print_timeline
@@ -241,33 +243,38 @@
243 /*
244 ** Return a pointer to a constant string that forms the basis
245 ** for a timeline query for the WWW interface.
246 */
247 const char *timeline_query_for_www(void){
248 static char *zBase = 0;
249 static const char zBaseSql[] =
250 @ SELECT
251 @ blob.rid,
252 @ uuid,
253 @ datetime(event.mtime,'localtime') AS timestamp,
254 @ coalesce(ecomment, comment),
255 @ coalesce(euser, user),
256 @ (SELECT count(*) FROM plink WHERE pid=blob.rid AND isprim=1),
257 @ (SELECT count(*) FROM plink WHERE cid=blob.rid),
258 @ NOT EXISTS(SELECT 1 FROM plink
259 @ WHERE pid=blob.rid
260 @ AND coalesce((SELECT value FROM tagxref
261 @ WHERE tagid=%d AND rid=plink.pid), 'trunk')
262 @ = coalesce((SELECT value FROM tagxref
263 @ WHERE tagid=%d AND rid=plink.cid), 'trunk')),
264 @ bgcolor,
265 @ event.type,
266 @ (SELECT group_concat(substr(tagname,5), ', ') FROM tag, tagxref
267 @ WHERE tagname GLOB 'sym-*' AND tag.tagid=tagxref.tagid
268 @ AND tagxref.rid=blob.rid AND tagxref.tagtype>0)
269 @ FROM event JOIN blob
270 @ WHERE blob.rid=event.objid
271 ;
272 if( zBase==0 ){
273 zBase = mprintf(zBaseSql, TAG_BRANCH, TAG_BRANCH);
274 }
275 return zBase;
276 }
277
278 /*
279 ** Generate a submenu element with a single parameter change.
280 */
281

Keyboard Shortcuts

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