Fossil SCM

In contexts where only a check-out makes since, only resolve tags or branch names into check-outs, not events or other artifacts. Ticket [5f611295e3c2a8].

drh 2011-06-01 22:32 trunk
Commit 2a013f02282f36c9f53343534634d30b9f281dc4
+2 -2
--- src/bisect.c
+++ src/bisect.c
@@ -137,11 +137,11 @@
137137
if( memcmp(zCmd, "bad", n)==0 ){
138138
int ridBad;
139139
if( g.argc==3 ){
140140
ridBad = db_lget_int("checkout",0);
141141
}else{
142
- ridBad = name_to_rid(g.argv[3]);
142
+ ridBad = name_to_typed_rid(g.argv[3], "ci");
143143
}
144144
db_lset_int("bisect-bad", ridBad);
145145
if( ridBad>0
146146
&& bisect_option("auto-next")
147147
&& db_lget_int("bisect-good",0)>0
@@ -154,11 +154,11 @@
154154
}else if( memcmp(zCmd, "good", n)==0 ){
155155
int ridGood;
156156
if( g.argc==3 ){
157157
ridGood = db_lget_int("checkout",0);
158158
}else{
159
- ridGood = name_to_rid(g.argv[3]);
159
+ ridGood = name_to_typed_rid(g.argv[3], "ci");
160160
}
161161
db_lset_int("bisect-good", ridGood);
162162
if( ridGood>0
163163
&& bisect_option("auto-next")
164164
&& db_lget_int("bisect-bad",0)>0
165165
--- src/bisect.c
+++ src/bisect.c
@@ -137,11 +137,11 @@
137 if( memcmp(zCmd, "bad", n)==0 ){
138 int ridBad;
139 if( g.argc==3 ){
140 ridBad = db_lget_int("checkout",0);
141 }else{
142 ridBad = name_to_rid(g.argv[3]);
143 }
144 db_lset_int("bisect-bad", ridBad);
145 if( ridBad>0
146 && bisect_option("auto-next")
147 && db_lget_int("bisect-good",0)>0
@@ -154,11 +154,11 @@
154 }else if( memcmp(zCmd, "good", n)==0 ){
155 int ridGood;
156 if( g.argc==3 ){
157 ridGood = db_lget_int("checkout",0);
158 }else{
159 ridGood = name_to_rid(g.argv[3]);
160 }
161 db_lset_int("bisect-good", ridGood);
162 if( ridGood>0
163 && bisect_option("auto-next")
164 && db_lget_int("bisect-bad",0)>0
165
--- src/bisect.c
+++ src/bisect.c
@@ -137,11 +137,11 @@
137 if( memcmp(zCmd, "bad", n)==0 ){
138 int ridBad;
139 if( g.argc==3 ){
140 ridBad = db_lget_int("checkout",0);
141 }else{
142 ridBad = name_to_typed_rid(g.argv[3], "ci");
143 }
144 db_lset_int("bisect-bad", ridBad);
145 if( ridBad>0
146 && bisect_option("auto-next")
147 && db_lget_int("bisect-good",0)>0
@@ -154,11 +154,11 @@
154 }else if( memcmp(zCmd, "good", n)==0 ){
155 int ridGood;
156 if( g.argc==3 ){
157 ridGood = db_lget_int("checkout",0);
158 }else{
159 ridGood = name_to_typed_rid(g.argv[3], "ci");
160 }
161 db_lset_int("bisect-good", ridGood);
162 if( ridGood>0
163 && bisect_option("auto-next")
164 && db_lget_int("bisect-bad",0)>0
165
+1 -1
--- src/branch.c
+++ src/branch.c
@@ -68,11 +68,11 @@
6868
fossil_fatal("branch \"%s\" already exists", zBranch);
6969
}
7070
7171
user_select();
7272
db_begin_transaction();
73
- rootid = name_to_rid(g.argv[4]);
73
+ rootid = name_to_typed_rid(g.argv[4], "ci");
7474
if( rootid==0 ){
7575
fossil_fatal("unable to locate check-in off of which to branch");
7676
}
7777
7878
pParent = manifest_get(rootid, CFTYPE_MANIFEST);
7979
--- src/branch.c
+++ src/branch.c
@@ -68,11 +68,11 @@
68 fossil_fatal("branch \"%s\" already exists", zBranch);
69 }
70
71 user_select();
72 db_begin_transaction();
73 rootid = name_to_rid(g.argv[4]);
74 if( rootid==0 ){
75 fossil_fatal("unable to locate check-in off of which to branch");
76 }
77
78 pParent = manifest_get(rootid, CFTYPE_MANIFEST);
79
--- src/branch.c
+++ src/branch.c
@@ -68,11 +68,11 @@
68 fossil_fatal("branch \"%s\" already exists", zBranch);
69 }
70
71 user_select();
72 db_begin_transaction();
73 rootid = name_to_typed_rid(g.argv[4], "ci");
74 if( rootid==0 ){
75 fossil_fatal("unable to locate check-in off of which to branch");
76 }
77
78 pParent = manifest_get(rootid, CFTYPE_MANIFEST);
79
+1 -1
--- src/checkout.c
+++ src/checkout.c
@@ -60,11 +60,11 @@
6060
int load_vfile(const char *zName){
6161
Blob uuid;
6262
int vid;
6363
6464
blob_init(&uuid, zName, -1);
65
- if( name_to_uuid(&uuid, 1) ){
65
+ if( name_to_uuid(&uuid, 1, "ci") ){
6666
fossil_panic(g.zErrMsg);
6767
}
6868
vid = db_int(0, "SELECT rid FROM blob WHERE uuid=%B", &uuid);
6969
if( vid==0 ){
7070
fossil_fatal("no such check-in: %s", g.argv[2]);
7171
--- src/checkout.c
+++ src/checkout.c
@@ -60,11 +60,11 @@
60 int load_vfile(const char *zName){
61 Blob uuid;
62 int vid;
63
64 blob_init(&uuid, zName, -1);
65 if( name_to_uuid(&uuid, 1) ){
66 fossil_panic(g.zErrMsg);
67 }
68 vid = db_int(0, "SELECT rid FROM blob WHERE uuid=%B", &uuid);
69 if( vid==0 ){
70 fossil_fatal("no such check-in: %s", g.argv[2]);
71
--- src/checkout.c
+++ src/checkout.c
@@ -60,11 +60,11 @@
60 int load_vfile(const char *zName){
61 Blob uuid;
62 int vid;
63
64 blob_init(&uuid, zName, -1);
65 if( name_to_uuid(&uuid, 1, "ci") ){
66 fossil_panic(g.zErrMsg);
67 }
68 vid = db_int(0, "SELECT rid FROM blob WHERE uuid=%B", &uuid);
69 if( vid==0 ){
70 fossil_fatal("no such check-in: %s", g.argv[2]);
71
--- src/descendants.c
+++ src/descendants.c
@@ -242,11 +242,11 @@
242242
243243
db_must_be_within_tree();
244244
if( g.argc==2 ){
245245
base = db_lget_int("checkout", 0);
246246
}else{
247
- base = name_to_rid(g.argv[2]);
247
+ base = name_to_typed_rid(g.argv[2], "ci");
248248
}
249249
if( base==0 ) return;
250250
compute_leaves(base, 0);
251251
db_prepare(&q,
252252
"%s"
253253
--- src/descendants.c
+++ src/descendants.c
@@ -242,11 +242,11 @@
242
243 db_must_be_within_tree();
244 if( g.argc==2 ){
245 base = db_lget_int("checkout", 0);
246 }else{
247 base = name_to_rid(g.argv[2]);
248 }
249 if( base==0 ) return;
250 compute_leaves(base, 0);
251 db_prepare(&q,
252 "%s"
253
--- src/descendants.c
+++ src/descendants.c
@@ -242,11 +242,11 @@
242
243 db_must_be_within_tree();
244 if( g.argc==2 ){
245 base = db_lget_int("checkout", 0);
246 }else{
247 base = name_to_typed_rid(g.argv[2], "ci");
248 }
249 if( base==0 ) return;
250 compute_leaves(base, 0);
251 db_prepare(&q,
252 "%s"
253
+1 -1
--- src/diff.c
+++ src/diff.c
@@ -837,11 +837,11 @@
837837
int annFlags = 0;
838838
Annotator ann;
839839
840840
login_check_credentials();
841841
if( !g.okRead ){ login_needed(); return; }
842
- mid = name_to_rid(PD("checkin","0"));
842
+ mid = name_to_typed_rid(PD("checkin","0"),"ci");
843843
fnid = db_int(0, "SELECT fnid FROM filename WHERE name=%Q", P("filename"));
844844
if( mid==0 || fnid==0 ){ fossil_redirect_home(); }
845845
iLimit = atoi(PD("limit","-1"));
846846
if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d AND fnid=%d",mid,fnid) ){
847847
fossil_redirect_home();
848848
--- src/diff.c
+++ src/diff.c
@@ -837,11 +837,11 @@
837 int annFlags = 0;
838 Annotator ann;
839
840 login_check_credentials();
841 if( !g.okRead ){ login_needed(); return; }
842 mid = name_to_rid(PD("checkin","0"));
843 fnid = db_int(0, "SELECT fnid FROM filename WHERE name=%Q", P("filename"));
844 if( mid==0 || fnid==0 ){ fossil_redirect_home(); }
845 iLimit = atoi(PD("limit","-1"));
846 if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d AND fnid=%d",mid,fnid) ){
847 fossil_redirect_home();
848
--- src/diff.c
+++ src/diff.c
@@ -837,11 +837,11 @@
837 int annFlags = 0;
838 Annotator ann;
839
840 login_check_credentials();
841 if( !g.okRead ){ login_needed(); return; }
842 mid = name_to_typed_rid(PD("checkin","0"),"ci");
843 fnid = db_int(0, "SELECT fnid FROM filename WHERE name=%Q", P("filename"));
844 if( mid==0 || fnid==0 ){ fossil_redirect_home(); }
845 iLimit = atoi(PD("limit","-1"));
846 if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d AND fnid=%d",mid,fnid) ){
847 fossil_redirect_home();
848
+1 -1
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -215,11 +215,11 @@
215215
vid = db_lget_int("checkout", 0);
216216
vfile_check_signature(vid, 1, 0);
217217
blob_zero(&sql);
218218
db_begin_transaction();
219219
if( zFrom ){
220
- int rid = name_to_rid(zFrom);
220
+ int rid = name_to_typed_rid(zFrom, "ci");
221221
if( !is_a_version(rid) ){
222222
fossil_fatal("no such check-in: %s", zFrom);
223223
}
224224
load_vfile_from_rid(rid);
225225
blob_appendf(&sql,
226226
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -215,11 +215,11 @@
215 vid = db_lget_int("checkout", 0);
216 vfile_check_signature(vid, 1, 0);
217 blob_zero(&sql);
218 db_begin_transaction();
219 if( zFrom ){
220 int rid = name_to_rid(zFrom);
221 if( !is_a_version(rid) ){
222 fossil_fatal("no such check-in: %s", zFrom);
223 }
224 load_vfile_from_rid(rid);
225 blob_appendf(&sql,
226
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -215,11 +215,11 @@
215 vid = db_lget_int("checkout", 0);
216 vfile_check_signature(vid, 1, 0);
217 blob_zero(&sql);
218 db_begin_transaction();
219 if( zFrom ){
220 int rid = name_to_typed_rid(zFrom, "ci");
221 if( !is_a_version(rid) ){
222 fossil_fatal("no such check-in: %s", zFrom);
223 }
224 load_vfile_from_rid(rid);
225 blob_appendf(&sql,
226
+1 -1
--- src/doc.c
+++ src/doc.c
@@ -396,11 +396,11 @@
396396
db_begin_transaction();
397397
if( fossil_strcmp(zBaseline,"tip")==0 ){
398398
vid = db_int(0, "SELECT objid FROM event WHERE type='ci'"
399399
" ORDER BY mtime DESC LIMIT 1");
400400
}else{
401
- vid = name_to_rid(zBaseline);
401
+ vid = name_to_typed_rid(zBaseline, "ci");
402402
}
403403
404404
/* Create the baseline cache if it does not already exist */
405405
db_multi_exec(
406406
"CREATE TABLE IF NOT EXISTS vcache(\n"
407407
--- src/doc.c
+++ src/doc.c
@@ -396,11 +396,11 @@
396 db_begin_transaction();
397 if( fossil_strcmp(zBaseline,"tip")==0 ){
398 vid = db_int(0, "SELECT objid FROM event WHERE type='ci'"
399 " ORDER BY mtime DESC LIMIT 1");
400 }else{
401 vid = name_to_rid(zBaseline);
402 }
403
404 /* Create the baseline cache if it does not already exist */
405 db_multi_exec(
406 "CREATE TABLE IF NOT EXISTS vcache(\n"
407
--- src/doc.c
+++ src/doc.c
@@ -396,11 +396,11 @@
396 db_begin_transaction();
397 if( fossil_strcmp(zBaseline,"tip")==0 ){
398 vid = db_int(0, "SELECT objid FROM event WHERE type='ci'"
399 " ORDER BY mtime DESC LIMIT 1");
400 }else{
401 vid = name_to_typed_rid(zBaseline, "ci");
402 }
403
404 /* Create the baseline cache if it does not already exist */
405 db_multi_exec(
406 "CREATE TABLE IF NOT EXISTS vcache(\n"
407
+2 -2
--- src/info.c
+++ src/info.c
@@ -1386,11 +1386,11 @@
13861386
event_page();
13871387
return;
13881388
}
13891389
}
13901390
blob_set(&uuid, zName);
1391
- rc = name_to_uuid(&uuid, -1);
1391
+ rc = name_to_uuid(&uuid, -1, "*");
13921392
if( rc==1 ){
13931393
style_header("No Such Object");
13941394
@ <p>No such object: %h(zName)</p>
13951395
style_footer();
13961396
return;
@@ -1576,11 +1576,11 @@
15761576
Blob comment;
15771577
Stmt q;
15781578
15791579
login_check_credentials();
15801580
if( !g.okWrite ){ login_needed(); return; }
1581
- rid = name_to_rid(P("r"));
1581
+ rid = name_to_typed_rid(P("r"), "ci");
15821582
zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
15831583
zComment = db_text(0, "SELECT coalesce(ecomment,comment)"
15841584
" FROM event WHERE objid=%d", rid);
15851585
if( zComment==0 ) fossil_redirect_home();
15861586
if( P("cancel") ){
15871587
--- src/info.c
+++ src/info.c
@@ -1386,11 +1386,11 @@
1386 event_page();
1387 return;
1388 }
1389 }
1390 blob_set(&uuid, zName);
1391 rc = name_to_uuid(&uuid, -1);
1392 if( rc==1 ){
1393 style_header("No Such Object");
1394 @ <p>No such object: %h(zName)</p>
1395 style_footer();
1396 return;
@@ -1576,11 +1576,11 @@
1576 Blob comment;
1577 Stmt q;
1578
1579 login_check_credentials();
1580 if( !g.okWrite ){ login_needed(); return; }
1581 rid = name_to_rid(P("r"));
1582 zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
1583 zComment = db_text(0, "SELECT coalesce(ecomment,comment)"
1584 " FROM event WHERE objid=%d", rid);
1585 if( zComment==0 ) fossil_redirect_home();
1586 if( P("cancel") ){
1587
--- src/info.c
+++ src/info.c
@@ -1386,11 +1386,11 @@
1386 event_page();
1387 return;
1388 }
1389 }
1390 blob_set(&uuid, zName);
1391 rc = name_to_uuid(&uuid, -1, "*");
1392 if( rc==1 ){
1393 style_header("No Such Object");
1394 @ <p>No such object: %h(zName)</p>
1395 style_footer();
1396 return;
@@ -1576,11 +1576,11 @@
1576 Blob comment;
1577 Stmt q;
1578
1579 login_check_credentials();
1580 if( !g.okWrite ){ login_needed(); return; }
1581 rid = name_to_typed_rid(P("r"), "ci");
1582 zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
1583 zComment = db_text(0, "SELECT coalesce(ecomment,comment)"
1584 " FROM event WHERE objid=%d", rid);
1585 if( zComment==0 ) fossil_redirect_home();
1586 if( P("cancel") ){
1587
+1 -1
--- src/manifest.c
+++ src/manifest.c
@@ -920,11 +920,11 @@
920920
*/
921921
Manifest *manifest_get_by_name(const char *zName, int *pRid){
922922
int rid;
923923
Manifest *p;
924924
925
- rid = name_to_rid(zName);
925
+ rid = name_to_typed_rid(zName, "ci");
926926
if( !is_a_version(rid) ){
927927
fossil_fatal("no such checkin: %s", zName);
928928
}
929929
if( pRid ) *pRid = rid;
930930
p = manifest_get(rid, CFTYPE_MANIFEST);
931931
--- src/manifest.c
+++ src/manifest.c
@@ -920,11 +920,11 @@
920 */
921 Manifest *manifest_get_by_name(const char *zName, int *pRid){
922 int rid;
923 Manifest *p;
924
925 rid = name_to_rid(zName);
926 if( !is_a_version(rid) ){
927 fossil_fatal("no such checkin: %s", zName);
928 }
929 if( pRid ) *pRid = rid;
930 p = manifest_get(rid, CFTYPE_MANIFEST);
931
--- src/manifest.c
+++ src/manifest.c
@@ -920,11 +920,11 @@
920 */
921 Manifest *manifest_get_by_name(const char *zName, int *pRid){
922 int rid;
923 Manifest *p;
924
925 rid = name_to_typed_rid(zName, "ci");
926 if( !is_a_version(rid) ){
927 fossil_fatal("no such checkin: %s", zName);
928 }
929 if( pRid ) *pRid = rid;
930 p = manifest_get(rid, CFTYPE_MANIFEST);
931
+2 -2
--- src/merge.c
+++ src/merge.c
@@ -96,16 +96,16 @@
9696
if( zBinGlob==0 ) zBinGlob = db_get("binary-glob",0);
9797
vid = db_lget_int("checkout", 0);
9898
if( vid==0 ){
9999
fossil_fatal("nothing is checked out");
100100
}
101
- mid = name_to_rid(g.argv[2]);
101
+ mid = name_to_typed_rid(g.argv[2], "ci");
102102
if( mid==0 || !is_a_version(mid) ){
103103
fossil_fatal("not a version: %s", g.argv[2]);
104104
}
105105
if( zPivot ){
106
- pid = name_to_rid(zPivot);
106
+ pid = name_to_typed_rid(zPivot, "ci");
107107
if( pid==0 || !is_a_version(pid) ){
108108
fossil_fatal("not a version: %s", zPivot);
109109
}
110110
if( pickFlag ){
111111
fossil_fatal("incompatible options: --cherrypick & --baseline");
112112
--- src/merge.c
+++ src/merge.c
@@ -96,16 +96,16 @@
96 if( zBinGlob==0 ) zBinGlob = db_get("binary-glob",0);
97 vid = db_lget_int("checkout", 0);
98 if( vid==0 ){
99 fossil_fatal("nothing is checked out");
100 }
101 mid = name_to_rid(g.argv[2]);
102 if( mid==0 || !is_a_version(mid) ){
103 fossil_fatal("not a version: %s", g.argv[2]);
104 }
105 if( zPivot ){
106 pid = name_to_rid(zPivot);
107 if( pid==0 || !is_a_version(pid) ){
108 fossil_fatal("not a version: %s", zPivot);
109 }
110 if( pickFlag ){
111 fossil_fatal("incompatible options: --cherrypick & --baseline");
112
--- src/merge.c
+++ src/merge.c
@@ -96,16 +96,16 @@
96 if( zBinGlob==0 ) zBinGlob = db_get("binary-glob",0);
97 vid = db_lget_int("checkout", 0);
98 if( vid==0 ){
99 fossil_fatal("nothing is checked out");
100 }
101 mid = name_to_typed_rid(g.argv[2], "ci");
102 if( mid==0 || !is_a_version(mid) ){
103 fossil_fatal("not a version: %s", g.argv[2]);
104 }
105 if( zPivot ){
106 pid = name_to_typed_rid(zPivot, "ci");
107 if( pid==0 || !is_a_version(pid) ){
108 fossil_fatal("not a version: %s", zPivot);
109 }
110 if( pickFlag ){
111 fossil_fatal("incompatible options: --cherrypick & --baseline");
112
+25 -17
--- src/name.c
+++ src/name.c
@@ -40,24 +40,24 @@
4040
** always resolve the name as a date.
4141
**
4242
** Return 0 on success. Return 1 if the name cannot be resolved.
4343
** Return 2 name is ambiguous.
4444
*/
45
-int name_to_uuid(Blob *pName, int iErrPriority){
45
+int name_to_uuid(Blob *pName, int iErrPriority, const char *zType){
4646
int rc;
4747
int sz;
4848
sz = blob_size(pName);
4949
if( sz>UUID_SIZE || sz<4 || !validate16(blob_buffer(pName), sz) ){
5050
char *zUuid;
5151
const char *zName = blob_str(pName);
5252
if( memcmp(zName, "tag:", 4)==0 ){
5353
zName += 4;
54
- zUuid = tag_to_uuid(zName);
54
+ zUuid = tag_to_uuid(zName, zType);
5555
}else{
56
- zUuid = tag_to_uuid(zName);
56
+ zUuid = tag_to_uuid(zName, zType);
5757
if( zUuid==0 ){
58
- zUuid = date_to_uuid(zName);
58
+ zUuid = date_to_uuid(zName, zType);
5959
}
6060
}
6161
if( zUuid ){
6262
blob_reset(pName);
6363
blob_append(pName, zUuid, -1);
@@ -79,11 +79,11 @@
7979
Stmt q;
8080
db_prepare(&q, "SELECT uuid FROM blob WHERE uuid GLOB '%b*'", pName);
8181
if( db_step(&q)!=SQLITE_ROW ){
8282
char *zUuid;
8383
db_finalize(&q);
84
- zUuid = tag_to_uuid(blob_str(pName));
84
+ zUuid = tag_to_uuid(blob_str(pName), "*");
8585
if( zUuid ){
8686
blob_reset(pName);
8787
blob_append(pName, zUuid, -1);
8888
free(zUuid);
8989
return 0;
@@ -141,22 +141,25 @@
141141
** An input of "tip" returns the most recent check-in.
142142
**
143143
** Memory to hold the returned string comes from malloc() and needs to
144144
** be freed by the caller.
145145
*/
146
-char *tag_to_uuid(const char *zTag){
146
+char *tag_to_uuid(const char *zTag, const char *zType){
147147
int vid;
148
- char *zUuid =
149
- db_text(0,
148
+ char *zUuid;
149
+
150
+ if( zType==0 || zType[0]==0 ) zType = "*";
151
+ zUuid = db_text(0,
150152
"SELECT blob.uuid"
151153
" FROM tag, tagxref, event, blob"
152154
" WHERE tag.tagname='sym-%q' "
153155
" AND tagxref.tagid=tag.tagid AND tagxref.tagtype>0 "
154156
" AND event.objid=tagxref.rid "
155157
" AND blob.rid=event.objid "
158
+ " AND event.type GLOB '%q'"
156159
" ORDER BY event.mtime DESC ",
157
- zTag
160
+ zTag, zType
158161
);
159162
if( zUuid==0 ){
160163
int nTag = strlen(zTag);
161164
int i;
162165
for(i=0; i<nTag-10; i++){
@@ -176,12 +179,13 @@
176179
" WHERE tag.tagname='sym-%q' "
177180
" AND tagxref.tagid=tag.tagid AND tagxref.tagtype>0 "
178181
" AND event.objid=tagxref.rid "
179182
" AND blob.rid=event.objid "
180183
" AND event.mtime<=julianday(%Q %s)"
184
+ " AND event.type GLOB '%q'"
181185
" ORDER BY event.mtime DESC ",
182
- zTagBase, zDate, (useUtc ? "" : ",'utc'")
186
+ zTagBase, zDate, (useUtc ? "" : ",'utc'"), zType
183187
);
184188
break;
185189
}
186190
}
187191
if( zUuid==0 && fossil_strcmp(zTag, "tip")==0 ){
@@ -222,11 +226,11 @@
222226
** utc:DATE
223227
**
224228
** The DATE is interpreted as localtime unless the "utc:" prefix is used
225229
** or a "utc" string appears at the end of the DATE string.
226230
*/
227
-char *date_to_uuid(const char *zDate){
231
+char *date_to_uuid(const char *zDate, const char *zType){
228232
int useUtc = 0;
229233
int n;
230234
char *zCopy = 0;
231235
char *zUuid;
232236
@@ -245,16 +249,17 @@
245249
zCopy[n-3] = 0;
246250
zDate = zCopy;
247251
n -= 3;
248252
useUtc = 1;
249253
}
254
+ if( zType==0 || zType[0]==0 ) zType = "*";
250255
zUuid = db_text(0,
251256
"SELECT (SELECT uuid FROM blob WHERE rid=event.objid)"
252257
" FROM event"
253
- " WHERE mtime<=julianday(%Q %s) AND type='ci'"
258
+ " WHERE mtime<=julianday(%Q %s) AND type GLOB '%q'"
254259
" ORDER BY mtime DESC LIMIT 1",
255
- zDate, useUtc ? "" : ",'utc'"
260
+ zDate, useUtc ? "" : ",'utc'", zType
256261
);
257262
free(zCopy);
258263
return zUuid;
259264
}
260265
@@ -268,11 +273,11 @@
268273
Blob name;
269274
db_must_be_within_tree();
270275
for(i=2; i<g.argc; i++){
271276
blob_init(&name, g.argv[i], -1);
272277
fossil_print("%s -> ", g.argv[i]);
273
- if( name_to_uuid(&name, 1) ){
278
+ if( name_to_uuid(&name, 1, "*") ){
274279
fossil_print("ERROR: %s\n", g.zErrMsg);
275280
fossil_error_reset();
276281
}else{
277282
fossil_print("%s\n", blob_buffer(&name));
278283
}
@@ -287,18 +292,18 @@
287292
** convert the uuid to a rid.
288293
**
289294
** This routine is used by command-line routines to resolve command-line inputs
290295
** into a rid.
291296
*/
292
-int name_to_rid(const char *zName){
297
+int name_to_typed_rid(const char *zName, const char *zType){
293298
int i;
294299
int rid;
295300
Blob name;
296301
297302
if( zName==0 || zName[0]==0 ) return 0;
298303
blob_init(&name, zName, -1);
299
- if( name_to_uuid(&name, -1) ){
304
+ if( name_to_uuid(&name, -1, zType) ){
300305
blob_reset(&name);
301306
for(i=0; zName[i] && fossil_isdigit(zName[i]); i++){}
302307
if( zName[i]==0 ){
303308
rid = atoi(zName);
304309
if( db_exists("SELECT 1 FROM blob WHERE rid=%d", rid) ){
@@ -311,10 +316,13 @@
311316
rid = db_int(0, "SELECT rid FROM blob WHERE uuid=%B", &name);
312317
blob_reset(&name);
313318
}
314319
return rid;
315320
}
321
+int name_to_rid(const char *zName){
322
+ return name_to_typed_rid(zName, "*");
323
+}
316324
317325
/*
318326
** WEBPAGE: ambiguous
319327
** URL: /ambiguous?name=UUID&src=WEBPAGE
320328
**
@@ -361,11 +369,11 @@
361369
const char *zName = P(zParamName);
362370
Blob name;
363371
364372
if( zName==0 || zName[0]==0 ) return 0;
365373
blob_init(&name, zName, -1);
366
- rc = name_to_uuid(&name, -1);
374
+ rc = name_to_uuid(&name, -1, "*");
367375
if( rc==1 ){
368376
blob_reset(&name);
369377
for(i=0; zName[i] && fossil_isdigit(zName[i]); i++){}
370378
if( zName[i]==0 ){
371379
rid = atoi(zName);
372380
--- src/name.c
+++ src/name.c
@@ -40,24 +40,24 @@
40 ** always resolve the name as a date.
41 **
42 ** Return 0 on success. Return 1 if the name cannot be resolved.
43 ** Return 2 name is ambiguous.
44 */
45 int name_to_uuid(Blob *pName, int iErrPriority){
46 int rc;
47 int sz;
48 sz = blob_size(pName);
49 if( sz>UUID_SIZE || sz<4 || !validate16(blob_buffer(pName), sz) ){
50 char *zUuid;
51 const char *zName = blob_str(pName);
52 if( memcmp(zName, "tag:", 4)==0 ){
53 zName += 4;
54 zUuid = tag_to_uuid(zName);
55 }else{
56 zUuid = tag_to_uuid(zName);
57 if( zUuid==0 ){
58 zUuid = date_to_uuid(zName);
59 }
60 }
61 if( zUuid ){
62 blob_reset(pName);
63 blob_append(pName, zUuid, -1);
@@ -79,11 +79,11 @@
79 Stmt q;
80 db_prepare(&q, "SELECT uuid FROM blob WHERE uuid GLOB '%b*'", pName);
81 if( db_step(&q)!=SQLITE_ROW ){
82 char *zUuid;
83 db_finalize(&q);
84 zUuid = tag_to_uuid(blob_str(pName));
85 if( zUuid ){
86 blob_reset(pName);
87 blob_append(pName, zUuid, -1);
88 free(zUuid);
89 return 0;
@@ -141,22 +141,25 @@
141 ** An input of "tip" returns the most recent check-in.
142 **
143 ** Memory to hold the returned string comes from malloc() and needs to
144 ** be freed by the caller.
145 */
146 char *tag_to_uuid(const char *zTag){
147 int vid;
148 char *zUuid =
149 db_text(0,
 
 
150 "SELECT blob.uuid"
151 " FROM tag, tagxref, event, blob"
152 " WHERE tag.tagname='sym-%q' "
153 " AND tagxref.tagid=tag.tagid AND tagxref.tagtype>0 "
154 " AND event.objid=tagxref.rid "
155 " AND blob.rid=event.objid "
 
156 " ORDER BY event.mtime DESC ",
157 zTag
158 );
159 if( zUuid==0 ){
160 int nTag = strlen(zTag);
161 int i;
162 for(i=0; i<nTag-10; i++){
@@ -176,12 +179,13 @@
176 " WHERE tag.tagname='sym-%q' "
177 " AND tagxref.tagid=tag.tagid AND tagxref.tagtype>0 "
178 " AND event.objid=tagxref.rid "
179 " AND blob.rid=event.objid "
180 " AND event.mtime<=julianday(%Q %s)"
 
181 " ORDER BY event.mtime DESC ",
182 zTagBase, zDate, (useUtc ? "" : ",'utc'")
183 );
184 break;
185 }
186 }
187 if( zUuid==0 && fossil_strcmp(zTag, "tip")==0 ){
@@ -222,11 +226,11 @@
222 ** utc:DATE
223 **
224 ** The DATE is interpreted as localtime unless the "utc:" prefix is used
225 ** or a "utc" string appears at the end of the DATE string.
226 */
227 char *date_to_uuid(const char *zDate){
228 int useUtc = 0;
229 int n;
230 char *zCopy = 0;
231 char *zUuid;
232
@@ -245,16 +249,17 @@
245 zCopy[n-3] = 0;
246 zDate = zCopy;
247 n -= 3;
248 useUtc = 1;
249 }
 
250 zUuid = db_text(0,
251 "SELECT (SELECT uuid FROM blob WHERE rid=event.objid)"
252 " FROM event"
253 " WHERE mtime<=julianday(%Q %s) AND type='ci'"
254 " ORDER BY mtime DESC LIMIT 1",
255 zDate, useUtc ? "" : ",'utc'"
256 );
257 free(zCopy);
258 return zUuid;
259 }
260
@@ -268,11 +273,11 @@
268 Blob name;
269 db_must_be_within_tree();
270 for(i=2; i<g.argc; i++){
271 blob_init(&name, g.argv[i], -1);
272 fossil_print("%s -> ", g.argv[i]);
273 if( name_to_uuid(&name, 1) ){
274 fossil_print("ERROR: %s\n", g.zErrMsg);
275 fossil_error_reset();
276 }else{
277 fossil_print("%s\n", blob_buffer(&name));
278 }
@@ -287,18 +292,18 @@
287 ** convert the uuid to a rid.
288 **
289 ** This routine is used by command-line routines to resolve command-line inputs
290 ** into a rid.
291 */
292 int name_to_rid(const char *zName){
293 int i;
294 int rid;
295 Blob name;
296
297 if( zName==0 || zName[0]==0 ) return 0;
298 blob_init(&name, zName, -1);
299 if( name_to_uuid(&name, -1) ){
300 blob_reset(&name);
301 for(i=0; zName[i] && fossil_isdigit(zName[i]); i++){}
302 if( zName[i]==0 ){
303 rid = atoi(zName);
304 if( db_exists("SELECT 1 FROM blob WHERE rid=%d", rid) ){
@@ -311,10 +316,13 @@
311 rid = db_int(0, "SELECT rid FROM blob WHERE uuid=%B", &name);
312 blob_reset(&name);
313 }
314 return rid;
315 }
 
 
 
316
317 /*
318 ** WEBPAGE: ambiguous
319 ** URL: /ambiguous?name=UUID&src=WEBPAGE
320 **
@@ -361,11 +369,11 @@
361 const char *zName = P(zParamName);
362 Blob name;
363
364 if( zName==0 || zName[0]==0 ) return 0;
365 blob_init(&name, zName, -1);
366 rc = name_to_uuid(&name, -1);
367 if( rc==1 ){
368 blob_reset(&name);
369 for(i=0; zName[i] && fossil_isdigit(zName[i]); i++){}
370 if( zName[i]==0 ){
371 rid = atoi(zName);
372
--- src/name.c
+++ src/name.c
@@ -40,24 +40,24 @@
40 ** always resolve the name as a date.
41 **
42 ** Return 0 on success. Return 1 if the name cannot be resolved.
43 ** Return 2 name is ambiguous.
44 */
45 int name_to_uuid(Blob *pName, int iErrPriority, const char *zType){
46 int rc;
47 int sz;
48 sz = blob_size(pName);
49 if( sz>UUID_SIZE || sz<4 || !validate16(blob_buffer(pName), sz) ){
50 char *zUuid;
51 const char *zName = blob_str(pName);
52 if( memcmp(zName, "tag:", 4)==0 ){
53 zName += 4;
54 zUuid = tag_to_uuid(zName, zType);
55 }else{
56 zUuid = tag_to_uuid(zName, zType);
57 if( zUuid==0 ){
58 zUuid = date_to_uuid(zName, zType);
59 }
60 }
61 if( zUuid ){
62 blob_reset(pName);
63 blob_append(pName, zUuid, -1);
@@ -79,11 +79,11 @@
79 Stmt q;
80 db_prepare(&q, "SELECT uuid FROM blob WHERE uuid GLOB '%b*'", pName);
81 if( db_step(&q)!=SQLITE_ROW ){
82 char *zUuid;
83 db_finalize(&q);
84 zUuid = tag_to_uuid(blob_str(pName), "*");
85 if( zUuid ){
86 blob_reset(pName);
87 blob_append(pName, zUuid, -1);
88 free(zUuid);
89 return 0;
@@ -141,22 +141,25 @@
141 ** An input of "tip" returns the most recent check-in.
142 **
143 ** Memory to hold the returned string comes from malloc() and needs to
144 ** be freed by the caller.
145 */
146 char *tag_to_uuid(const char *zTag, const char *zType){
147 int vid;
148 char *zUuid;
149
150 if( zType==0 || zType[0]==0 ) zType = "*";
151 zUuid = db_text(0,
152 "SELECT blob.uuid"
153 " FROM tag, tagxref, event, blob"
154 " WHERE tag.tagname='sym-%q' "
155 " AND tagxref.tagid=tag.tagid AND tagxref.tagtype>0 "
156 " AND event.objid=tagxref.rid "
157 " AND blob.rid=event.objid "
158 " AND event.type GLOB '%q'"
159 " ORDER BY event.mtime DESC ",
160 zTag, zType
161 );
162 if( zUuid==0 ){
163 int nTag = strlen(zTag);
164 int i;
165 for(i=0; i<nTag-10; i++){
@@ -176,12 +179,13 @@
179 " WHERE tag.tagname='sym-%q' "
180 " AND tagxref.tagid=tag.tagid AND tagxref.tagtype>0 "
181 " AND event.objid=tagxref.rid "
182 " AND blob.rid=event.objid "
183 " AND event.mtime<=julianday(%Q %s)"
184 " AND event.type GLOB '%q'"
185 " ORDER BY event.mtime DESC ",
186 zTagBase, zDate, (useUtc ? "" : ",'utc'"), zType
187 );
188 break;
189 }
190 }
191 if( zUuid==0 && fossil_strcmp(zTag, "tip")==0 ){
@@ -222,11 +226,11 @@
226 ** utc:DATE
227 **
228 ** The DATE is interpreted as localtime unless the "utc:" prefix is used
229 ** or a "utc" string appears at the end of the DATE string.
230 */
231 char *date_to_uuid(const char *zDate, const char *zType){
232 int useUtc = 0;
233 int n;
234 char *zCopy = 0;
235 char *zUuid;
236
@@ -245,16 +249,17 @@
249 zCopy[n-3] = 0;
250 zDate = zCopy;
251 n -= 3;
252 useUtc = 1;
253 }
254 if( zType==0 || zType[0]==0 ) zType = "*";
255 zUuid = db_text(0,
256 "SELECT (SELECT uuid FROM blob WHERE rid=event.objid)"
257 " FROM event"
258 " WHERE mtime<=julianday(%Q %s) AND type GLOB '%q'"
259 " ORDER BY mtime DESC LIMIT 1",
260 zDate, useUtc ? "" : ",'utc'", zType
261 );
262 free(zCopy);
263 return zUuid;
264 }
265
@@ -268,11 +273,11 @@
273 Blob name;
274 db_must_be_within_tree();
275 for(i=2; i<g.argc; i++){
276 blob_init(&name, g.argv[i], -1);
277 fossil_print("%s -> ", g.argv[i]);
278 if( name_to_uuid(&name, 1, "*") ){
279 fossil_print("ERROR: %s\n", g.zErrMsg);
280 fossil_error_reset();
281 }else{
282 fossil_print("%s\n", blob_buffer(&name));
283 }
@@ -287,18 +292,18 @@
292 ** convert the uuid to a rid.
293 **
294 ** This routine is used by command-line routines to resolve command-line inputs
295 ** into a rid.
296 */
297 int name_to_typed_rid(const char *zName, const char *zType){
298 int i;
299 int rid;
300 Blob name;
301
302 if( zName==0 || zName[0]==0 ) return 0;
303 blob_init(&name, zName, -1);
304 if( name_to_uuid(&name, -1, zType) ){
305 blob_reset(&name);
306 for(i=0; zName[i] && fossil_isdigit(zName[i]); i++){}
307 if( zName[i]==0 ){
308 rid = atoi(zName);
309 if( db_exists("SELECT 1 FROM blob WHERE rid=%d", rid) ){
@@ -311,10 +316,13 @@
316 rid = db_int(0, "SELECT rid FROM blob WHERE uuid=%B", &name);
317 blob_reset(&name);
318 }
319 return rid;
320 }
321 int name_to_rid(const char *zName){
322 return name_to_typed_rid(zName, "*");
323 }
324
325 /*
326 ** WEBPAGE: ambiguous
327 ** URL: /ambiguous?name=UUID&src=WEBPAGE
328 **
@@ -361,11 +369,11 @@
369 const char *zName = P(zParamName);
370 Blob name;
371
372 if( zName==0 || zName[0]==0 ) return 0;
373 blob_init(&name, zName, -1);
374 rc = name_to_uuid(&name, -1, "*");
375 if( rc==1 ){
376 blob_reset(&name);
377 for(i=0; zName[i] && fossil_isdigit(zName[i]); i++){}
378 if( zName[i]==0 ){
379 rid = atoi(zName);
380
+1 -1
--- src/tag.c
+++ src/tag.c
@@ -296,11 +296,11 @@
296296
297297
assert( tagtype>=0 && tagtype<=2 );
298298
user_select();
299299
blob_zero(&uuid);
300300
blob_append(&uuid, zObjName, -1);
301
- if( name_to_uuid(&uuid, 9) ){
301
+ if( name_to_uuid(&uuid, 9, "*") ){
302302
fossil_fatal("%s", g.zErrMsg);
303303
return;
304304
}
305305
rid = name_to_rid(blob_str(&uuid));
306306
g.markPrivate = content_is_private(rid);
307307
--- src/tag.c
+++ src/tag.c
@@ -296,11 +296,11 @@
296
297 assert( tagtype>=0 && tagtype<=2 );
298 user_select();
299 blob_zero(&uuid);
300 blob_append(&uuid, zObjName, -1);
301 if( name_to_uuid(&uuid, 9) ){
302 fossil_fatal("%s", g.zErrMsg);
303 return;
304 }
305 rid = name_to_rid(blob_str(&uuid));
306 g.markPrivate = content_is_private(rid);
307
--- src/tag.c
+++ src/tag.c
@@ -296,11 +296,11 @@
296
297 assert( tagtype>=0 && tagtype<=2 );
298 user_select();
299 blob_zero(&uuid);
300 blob_append(&uuid, zObjName, -1);
301 if( name_to_uuid(&uuid, 9, "*") ){
302 fossil_fatal("%s", g.zErrMsg);
303 return;
304 }
305 rid = name_to_rid(blob_str(&uuid));
306 g.markPrivate = content_is_private(rid);
307
+1 -1
--- src/tar.c
+++ src/tar.c
@@ -273,11 +273,11 @@
273273
zName = find_option("name", 0, 1);
274274
db_find_and_open_repository(0, 0);
275275
if( g.argc!=4 ){
276276
usage("VERSION OUTPUTFILE");
277277
}
278
- rid = name_to_rid(g.argv[2]);
278
+ rid = name_to_typed_rid(g.argv[2], "ci");
279279
if( zName==0 ){
280280
zName = db_text("default-name",
281281
"SELECT replace(%Q,' ','_') "
282282
" || strftime('_%%Y-%%m-%%d_%%H%%M%%S_', event.mtime) "
283283
" || substr(blob.uuid, 1, 10)"
284284
--- src/tar.c
+++ src/tar.c
@@ -273,11 +273,11 @@
273 zName = find_option("name", 0, 1);
274 db_find_and_open_repository(0, 0);
275 if( g.argc!=4 ){
276 usage("VERSION OUTPUTFILE");
277 }
278 rid = name_to_rid(g.argv[2]);
279 if( zName==0 ){
280 zName = db_text("default-name",
281 "SELECT replace(%Q,' ','_') "
282 " || strftime('_%%Y-%%m-%%d_%%H%%M%%S_', event.mtime) "
283 " || substr(blob.uuid, 1, 10)"
284
--- src/tar.c
+++ src/tar.c
@@ -273,11 +273,11 @@
273 zName = find_option("name", 0, 1);
274 db_find_and_open_repository(0, 0);
275 if( g.argc!=4 ){
276 usage("VERSION OUTPUTFILE");
277 }
278 rid = name_to_typed_rid(g.argv[2], "ci");
279 if( zName==0 ){
280 zName = db_text("default-name",
281 "SELECT replace(%Q,' ','_') "
282 " || strftime('_%%Y-%%m-%%d_%%H%%M%%S_', event.mtime) "
283 " || substr(blob.uuid, 1, 10)"
284
+8 -8
--- src/timeline.c
+++ src/timeline.c
@@ -782,13 +782,13 @@
782782
void page_timeline(void){
783783
Stmt q; /* Query used to generate the timeline */
784784
Blob sql; /* text of SQL used to generate timeline */
785785
Blob desc; /* Description of the timeline */
786786
int nEntry = atoi(PD("n","20")); /* Max number of entries on timeline */
787
- int p_rid = name_to_rid(P("p")); /* artifact p and its parents */
788
- int d_rid = name_to_rid(P("d")); /* artifact d and its descendants */
789
- int f_rid = name_to_rid(P("f")); /* artifact f and immediate family */
787
+ int p_rid = name_to_typed_rid(P("p"),"ci"); /* artifact p and its parents */
788
+ int d_rid = name_to_typed_rid(P("d"),"ci"); /* artifact d and descendants */
789
+ int f_rid = name_to_typed_rid(P("f"),"ci"); /* artifact f and close family */
790790
const char *zUser = P("u"); /* All entries by this user if not NULL */
791791
const char *zType = PD("y","all"); /* Type of events. All if NULL */
792792
const char *zAfter = P("a"); /* Events after this time */
793793
const char *zBefore = P("b"); /* Events before this time */
794794
const char *zCirca = P("c"); /* Events near this time */
@@ -799,15 +799,15 @@
799799
int tagid; /* Tag ID */
800800
int tmFlags; /* Timeline flags */
801801
const char *zThisTag = 0; /* Suppress links to this tag */
802802
const char *zThisUser = 0; /* Suppress links to this user */
803803
HQuery url; /* URL for various branch links */
804
- int from_rid = name_to_rid(P("from")); /* from= for path timelines */
805
- int to_rid = name_to_rid(P("to")); /* to= for path timelines */
804
+ int from_rid = name_to_typed_rid(P("from"),"ci"); /* from= for paths */
805
+ int to_rid = name_to_typed_rid(P("to"),"ci"); /* to= for path timelines */
806806
int noMerge = P("nomerge")!=0; /* Do not follow merge links */
807
- int me_rid = name_to_rid(P("me")); /* me= for common ancestory path */
808
- int you_rid = name_to_rid(P("you"));/* you= for common ancst path */
807
+ int me_rid = name_to_typed_rid(P("me"),"ci"); /* me= for common ancestory */
808
+ int you_rid = name_to_typed_rid(P("you"),"ci");/* you= for common ancst */
809809
810810
/* To view the timeline, must have permission to read project data.
811811
*/
812812
login_check_credentials();
813813
if( !g.okRead && !g.okRdTkt && !g.okRdWiki ){ login_needed(); return; }
@@ -1361,11 +1361,11 @@
13611361
if( !g.localOpen ){
13621362
fossil_fatal("must be within a local checkout to use 'current'");
13631363
}
13641364
objid = db_lget_int("checkout",0);
13651365
zDate = mprintf("(SELECT mtime FROM plink WHERE cid=%d)", objid);
1366
- }else if( name_to_uuid(&uuid, 0)==0 ){
1366
+ }else if( name_to_uuid(&uuid, 0, "*")==0 ){
13671367
objid = db_int(0, "SELECT rid FROM blob WHERE uuid=%B", &uuid);
13681368
zDate = mprintf("(SELECT mtime FROM plink WHERE cid=%d)", objid);
13691369
}else{
13701370
const char *zShift = "";
13711371
if( mode==3 || mode==4 ){
13721372
--- src/timeline.c
+++ src/timeline.c
@@ -782,13 +782,13 @@
782 void page_timeline(void){
783 Stmt q; /* Query used to generate the timeline */
784 Blob sql; /* text of SQL used to generate timeline */
785 Blob desc; /* Description of the timeline */
786 int nEntry = atoi(PD("n","20")); /* Max number of entries on timeline */
787 int p_rid = name_to_rid(P("p")); /* artifact p and its parents */
788 int d_rid = name_to_rid(P("d")); /* artifact d and its descendants */
789 int f_rid = name_to_rid(P("f")); /* artifact f and immediate family */
790 const char *zUser = P("u"); /* All entries by this user if not NULL */
791 const char *zType = PD("y","all"); /* Type of events. All if NULL */
792 const char *zAfter = P("a"); /* Events after this time */
793 const char *zBefore = P("b"); /* Events before this time */
794 const char *zCirca = P("c"); /* Events near this time */
@@ -799,15 +799,15 @@
799 int tagid; /* Tag ID */
800 int tmFlags; /* Timeline flags */
801 const char *zThisTag = 0; /* Suppress links to this tag */
802 const char *zThisUser = 0; /* Suppress links to this user */
803 HQuery url; /* URL for various branch links */
804 int from_rid = name_to_rid(P("from")); /* from= for path timelines */
805 int to_rid = name_to_rid(P("to")); /* to= for path timelines */
806 int noMerge = P("nomerge")!=0; /* Do not follow merge links */
807 int me_rid = name_to_rid(P("me")); /* me= for common ancestory path */
808 int you_rid = name_to_rid(P("you"));/* you= for common ancst path */
809
810 /* To view the timeline, must have permission to read project data.
811 */
812 login_check_credentials();
813 if( !g.okRead && !g.okRdTkt && !g.okRdWiki ){ login_needed(); return; }
@@ -1361,11 +1361,11 @@
1361 if( !g.localOpen ){
1362 fossil_fatal("must be within a local checkout to use 'current'");
1363 }
1364 objid = db_lget_int("checkout",0);
1365 zDate = mprintf("(SELECT mtime FROM plink WHERE cid=%d)", objid);
1366 }else if( name_to_uuid(&uuid, 0)==0 ){
1367 objid = db_int(0, "SELECT rid FROM blob WHERE uuid=%B", &uuid);
1368 zDate = mprintf("(SELECT mtime FROM plink WHERE cid=%d)", objid);
1369 }else{
1370 const char *zShift = "";
1371 if( mode==3 || mode==4 ){
1372
--- src/timeline.c
+++ src/timeline.c
@@ -782,13 +782,13 @@
782 void page_timeline(void){
783 Stmt q; /* Query used to generate the timeline */
784 Blob sql; /* text of SQL used to generate timeline */
785 Blob desc; /* Description of the timeline */
786 int nEntry = atoi(PD("n","20")); /* Max number of entries on timeline */
787 int p_rid = name_to_typed_rid(P("p"),"ci"); /* artifact p and its parents */
788 int d_rid = name_to_typed_rid(P("d"),"ci"); /* artifact d and descendants */
789 int f_rid = name_to_typed_rid(P("f"),"ci"); /* artifact f and close family */
790 const char *zUser = P("u"); /* All entries by this user if not NULL */
791 const char *zType = PD("y","all"); /* Type of events. All if NULL */
792 const char *zAfter = P("a"); /* Events after this time */
793 const char *zBefore = P("b"); /* Events before this time */
794 const char *zCirca = P("c"); /* Events near this time */
@@ -799,15 +799,15 @@
799 int tagid; /* Tag ID */
800 int tmFlags; /* Timeline flags */
801 const char *zThisTag = 0; /* Suppress links to this tag */
802 const char *zThisUser = 0; /* Suppress links to this user */
803 HQuery url; /* URL for various branch links */
804 int from_rid = name_to_typed_rid(P("from"),"ci"); /* from= for paths */
805 int to_rid = name_to_typed_rid(P("to"),"ci"); /* to= for path timelines */
806 int noMerge = P("nomerge")!=0; /* Do not follow merge links */
807 int me_rid = name_to_typed_rid(P("me"),"ci"); /* me= for common ancestory */
808 int you_rid = name_to_typed_rid(P("you"),"ci");/* you= for common ancst */
809
810 /* To view the timeline, must have permission to read project data.
811 */
812 login_check_credentials();
813 if( !g.okRead && !g.okRdTkt && !g.okRdWiki ){ login_needed(); return; }
@@ -1361,11 +1361,11 @@
1361 if( !g.localOpen ){
1362 fossil_fatal("must be within a local checkout to use 'current'");
1363 }
1364 objid = db_lget_int("checkout",0);
1365 zDate = mprintf("(SELECT mtime FROM plink WHERE cid=%d)", objid);
1366 }else if( name_to_uuid(&uuid, 0, "*")==0 ){
1367 objid = db_int(0, "SELECT rid FROM blob WHERE uuid=%B", &uuid);
1368 zDate = mprintf("(SELECT mtime FROM plink WHERE cid=%d)", objid);
1369 }else{
1370 const char *zShift = "";
1371 if( mode==3 || mode==4 ){
1372
+2 -2
--- src/update.c
+++ src/update.c
@@ -128,11 +128,11 @@
128128
/* If VERSION is "latest", then use the same algorithm to find the
129129
** target as if VERSION were omitted and the --latest flag is present.
130130
*/
131131
latestFlag = 1;
132132
}else{
133
- tid = name_to_rid(g.argv[2]);
133
+ tid = name_to_typed_rid(g.argv[2],"ci");
134134
if( tid==0 ){
135135
fossil_fatal("no such version: %s", g.argv[2]);
136136
}else if( !is_a_version(tid) ){
137137
fossil_fatal("no such version: %s", g.argv[2]);
138138
}
@@ -473,11 +473,11 @@
473473
Manifest *pManifest;
474474
ManifestFile *pFile;
475475
int rid=0;
476476
477477
if( revision ){
478
- rid = name_to_rid(revision);
478
+ rid = name_to_typed_rid(revision,"ci");
479479
}else{
480480
rid = db_lget_int("checkout", 0);
481481
}
482482
if( !is_a_version(rid) ){
483483
if( errCode>0 ) return errCode;
484484
--- src/update.c
+++ src/update.c
@@ -128,11 +128,11 @@
128 /* If VERSION is "latest", then use the same algorithm to find the
129 ** target as if VERSION were omitted and the --latest flag is present.
130 */
131 latestFlag = 1;
132 }else{
133 tid = name_to_rid(g.argv[2]);
134 if( tid==0 ){
135 fossil_fatal("no such version: %s", g.argv[2]);
136 }else if( !is_a_version(tid) ){
137 fossil_fatal("no such version: %s", g.argv[2]);
138 }
@@ -473,11 +473,11 @@
473 Manifest *pManifest;
474 ManifestFile *pFile;
475 int rid=0;
476
477 if( revision ){
478 rid = name_to_rid(revision);
479 }else{
480 rid = db_lget_int("checkout", 0);
481 }
482 if( !is_a_version(rid) ){
483 if( errCode>0 ) return errCode;
484
--- src/update.c
+++ src/update.c
@@ -128,11 +128,11 @@
128 /* If VERSION is "latest", then use the same algorithm to find the
129 ** target as if VERSION were omitted and the --latest flag is present.
130 */
131 latestFlag = 1;
132 }else{
133 tid = name_to_typed_rid(g.argv[2],"ci");
134 if( tid==0 ){
135 fossil_fatal("no such version: %s", g.argv[2]);
136 }else if( !is_a_version(tid) ){
137 fossil_fatal("no such version: %s", g.argv[2]);
138 }
@@ -473,11 +473,11 @@
473 Manifest *pManifest;
474 ManifestFile *pFile;
475 int rid=0;
476
477 if( revision ){
478 rid = name_to_typed_rid(revision,"ci");
479 }else{
480 rid = db_lget_int("checkout", 0);
481 }
482 if( !is_a_version(rid) ){
483 if( errCode>0 ) return errCode;
484
+2 -2
--- src/zip.c
+++ src/zip.c
@@ -392,11 +392,11 @@
392392
zName = find_option("name", 0, 1);
393393
db_find_and_open_repository(0, 0);
394394
if( g.argc!=4 ){
395395
usage("VERSION OUTPUTFILE");
396396
}
397
- rid = name_to_rid(g.argv[2]);
397
+ rid = name_to_typed_rid(g.argv[2],"ci");
398398
if( zName==0 ){
399399
zName = db_text("default-name",
400400
"SELECT replace(%Q,' ','_') "
401401
" || strftime('_%%Y-%%m-%%d_%%H%%M%%S_', event.mtime) "
402402
" || substr(blob.uuid, 1, 10)"
@@ -433,11 +433,11 @@
433433
if( zName[nName]=='.' ){
434434
zName[nName] = 0;
435435
break;
436436
}
437437
}
438
- rid = name_to_rid(nRid?zRid:zName);
438
+ rid = name_to_typed_rid(nRid?zRid:zName,"ci");
439439
if( rid==0 ){
440440
@ Not found
441441
return;
442442
}
443443
if( nRid==0 && nName>10 ) zName[10] = 0;
444444
--- src/zip.c
+++ src/zip.c
@@ -392,11 +392,11 @@
392 zName = find_option("name", 0, 1);
393 db_find_and_open_repository(0, 0);
394 if( g.argc!=4 ){
395 usage("VERSION OUTPUTFILE");
396 }
397 rid = name_to_rid(g.argv[2]);
398 if( zName==0 ){
399 zName = db_text("default-name",
400 "SELECT replace(%Q,' ','_') "
401 " || strftime('_%%Y-%%m-%%d_%%H%%M%%S_', event.mtime) "
402 " || substr(blob.uuid, 1, 10)"
@@ -433,11 +433,11 @@
433 if( zName[nName]=='.' ){
434 zName[nName] = 0;
435 break;
436 }
437 }
438 rid = name_to_rid(nRid?zRid:zName);
439 if( rid==0 ){
440 @ Not found
441 return;
442 }
443 if( nRid==0 && nName>10 ) zName[10] = 0;
444
--- src/zip.c
+++ src/zip.c
@@ -392,11 +392,11 @@
392 zName = find_option("name", 0, 1);
393 db_find_and_open_repository(0, 0);
394 if( g.argc!=4 ){
395 usage("VERSION OUTPUTFILE");
396 }
397 rid = name_to_typed_rid(g.argv[2],"ci");
398 if( zName==0 ){
399 zName = db_text("default-name",
400 "SELECT replace(%Q,' ','_') "
401 " || strftime('_%%Y-%%m-%%d_%%H%%M%%S_', event.mtime) "
402 " || substr(blob.uuid, 1, 10)"
@@ -433,11 +433,11 @@
433 if( zName[nName]=='.' ){
434 zName[nName] = 0;
435 break;
436 }
437 }
438 rid = name_to_typed_rid(nRid?zRid:zName,"ci");
439 if( rid==0 ){
440 @ Not found
441 return;
442 }
443 if( nRid==0 && nName>10 ) zName[10] = 0;
444

Keyboard Shortcuts

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