Fossil SCM

Changes to file browser to be more direct and describing what is seen in the union of all files from all versions. Add hyperlinks to tip and trunk.

drh 2010-03-08 14:12 trunk
Commit 4db129c9250ead78387dd4b760213149e75321ed
2 files changed +22 -10 +11
+22 -10
--- src/browse.c
+++ src/browse.c
@@ -113,10 +113,11 @@
113113
char *zPrefix;
114114
Stmt q;
115115
const char *zCI = P("ci");
116116
int rid = 0;
117117
Blob content;
118
+ Blob dirname;
118119
Manifest m;
119120
const char *zSubdirLink;
120121
121122
login_check_credentials();
122123
if( !g.okHistory ){ login_needed(); return; }
@@ -133,36 +134,47 @@
133134
zCI = 0;
134135
}
135136
}
136137
137138
/* Compute the title of the page */
139
+ blob_zero(&dirname);
138140
if( zD ){
139
- Blob title;
140
-
141
- blob_zero(&title);
142
- blob_appendf(&title, "Files in directory ");
143
- hyperlinked_path(zD, &title);
144
- @ <h2>%s(blob_str(&title))
145
- blob_reset(&title);
141
+ blob_append(&dirname, "in directory ", -1);
142
+ hyperlinked_path(zD, &dirname);
146143
zPrefix = mprintf("%h/", zD);
147144
}else{
148
- @ <h2>Files in the top-level directory
145
+ blob_append(&dirname, "in the top-level directory", -1);
149146
zPrefix = "";
150147
}
151148
if( zCI ){
152149
char *zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
153150
char zShort[20];
154151
memcpy(zShort, zUuid, 10);
155152
zShort[10] = 0;
156
- @ of check-in [<a href="vinfo?name=%T(zUuid)">%s(zShort)</a>]</h2>
153
+ @ <h2>Files of check-in [<a href="vinfo?name=%T(zUuid)">%s(zShort)</a>]
154
+ @ %s(blob_str(&dirname))</h2>
157155
zSubdirLink = mprintf("%s/dir?ci=%s&name=%T", g.zBaseURL, zUuid, zPrefix);
158156
if( zD ){
159157
style_submenu_element("Top", "Top", "%s/dir?ci=%s", g.zBaseURL, zUuid);
158
+ style_submenu_element("All", "All", "%s/dir?name=%t", g.zBaseURL, zD);
159
+ }else{
160
+ style_submenu_element("All", "All", "%s/dir", g.zBaseURL);
160161
}
161162
}else{
162
- @ </h2>
163
+ @ <h2>The union of all files from all check-ins
164
+ @ %s(blob_str(&dirname))</h2>
163165
zSubdirLink = mprintf("%s/dir?name=%T", g.zBaseURL, zPrefix);
166
+ if( zD ){
167
+ style_submenu_element("Top", "Top", "%s/dir", g.zBaseURL);
168
+ style_submenu_element("Tip", "Tip", "%s/dir?name=%t&ci=tip",
169
+ g.zBaseURL, zD);
170
+ style_submenu_element("Trunk", "Trunk", "%s/dir?name=%t&ci=trunk",
171
+ g.zBaseURL,zD);
172
+ }else{
173
+ style_submenu_element("Tip", "Tip", "%s/dir?ci=tip", g.zBaseURL);
174
+ style_submenu_element("Trunk", "Trunk", "%s/dir?ci=trunk", g.zBaseURL);
175
+ }
164176
}
165177
166178
/* Compute the temporary table "localfiles" containing the names
167179
** of all files and subdirectories in the zD[] directory.
168180
**
169181
--- src/browse.c
+++ src/browse.c
@@ -113,10 +113,11 @@
113 char *zPrefix;
114 Stmt q;
115 const char *zCI = P("ci");
116 int rid = 0;
117 Blob content;
 
118 Manifest m;
119 const char *zSubdirLink;
120
121 login_check_credentials();
122 if( !g.okHistory ){ login_needed(); return; }
@@ -133,36 +134,47 @@
133 zCI = 0;
134 }
135 }
136
137 /* Compute the title of the page */
 
138 if( zD ){
139 Blob title;
140
141 blob_zero(&title);
142 blob_appendf(&title, "Files in directory ");
143 hyperlinked_path(zD, &title);
144 @ <h2>%s(blob_str(&title))
145 blob_reset(&title);
146 zPrefix = mprintf("%h/", zD);
147 }else{
148 @ <h2>Files in the top-level directory
149 zPrefix = "";
150 }
151 if( zCI ){
152 char *zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
153 char zShort[20];
154 memcpy(zShort, zUuid, 10);
155 zShort[10] = 0;
156 @ of check-in [<a href="vinfo?name=%T(zUuid)">%s(zShort)</a>]</h2>
 
157 zSubdirLink = mprintf("%s/dir?ci=%s&name=%T", g.zBaseURL, zUuid, zPrefix);
158 if( zD ){
159 style_submenu_element("Top", "Top", "%s/dir?ci=%s", g.zBaseURL, zUuid);
 
 
 
160 }
161 }else{
162 @ </h2>
 
163 zSubdirLink = mprintf("%s/dir?name=%T", g.zBaseURL, zPrefix);
 
 
 
 
 
 
 
 
 
 
164 }
165
166 /* Compute the temporary table "localfiles" containing the names
167 ** of all files and subdirectories in the zD[] directory.
168 **
169
--- src/browse.c
+++ src/browse.c
@@ -113,10 +113,11 @@
113 char *zPrefix;
114 Stmt q;
115 const char *zCI = P("ci");
116 int rid = 0;
117 Blob content;
118 Blob dirname;
119 Manifest m;
120 const char *zSubdirLink;
121
122 login_check_credentials();
123 if( !g.okHistory ){ login_needed(); return; }
@@ -133,36 +134,47 @@
134 zCI = 0;
135 }
136 }
137
138 /* Compute the title of the page */
139 blob_zero(&dirname);
140 if( zD ){
141 blob_append(&dirname, "in directory ", -1);
142 hyperlinked_path(zD, &dirname);
 
 
 
 
 
143 zPrefix = mprintf("%h/", zD);
144 }else{
145 blob_append(&dirname, "in the top-level directory", -1);
146 zPrefix = "";
147 }
148 if( zCI ){
149 char *zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
150 char zShort[20];
151 memcpy(zShort, zUuid, 10);
152 zShort[10] = 0;
153 @ <h2>Files of check-in [<a href="vinfo?name=%T(zUuid)">%s(zShort)</a>]
154 @ %s(blob_str(&dirname))</h2>
155 zSubdirLink = mprintf("%s/dir?ci=%s&name=%T", g.zBaseURL, zUuid, zPrefix);
156 if( zD ){
157 style_submenu_element("Top", "Top", "%s/dir?ci=%s", g.zBaseURL, zUuid);
158 style_submenu_element("All", "All", "%s/dir?name=%t", g.zBaseURL, zD);
159 }else{
160 style_submenu_element("All", "All", "%s/dir", g.zBaseURL);
161 }
162 }else{
163 @ <h2>The union of all files from all check-ins
164 @ %s(blob_str(&dirname))</h2>
165 zSubdirLink = mprintf("%s/dir?name=%T", g.zBaseURL, zPrefix);
166 if( zD ){
167 style_submenu_element("Top", "Top", "%s/dir", g.zBaseURL);
168 style_submenu_element("Tip", "Tip", "%s/dir?name=%t&ci=tip",
169 g.zBaseURL, zD);
170 style_submenu_element("Trunk", "Trunk", "%s/dir?name=%t&ci=trunk",
171 g.zBaseURL,zD);
172 }else{
173 style_submenu_element("Tip", "Tip", "%s/dir?ci=tip", g.zBaseURL);
174 style_submenu_element("Trunk", "Trunk", "%s/dir?ci=trunk", g.zBaseURL);
175 }
176 }
177
178 /* Compute the temporary table "localfiles" containing the names
179 ** of all files and subdirectories in the zD[] directory.
180 **
181
+11
--- src/name.c
+++ src/name.c
@@ -140,10 +140,12 @@
140140
**
141141
** tag:date
142142
**
143143
** Then return the UUID of the oldest check-in with that tag that is
144144
** not older than 'date'.
145
+**
146
+** An input of "tip" returns the most recent check-in.
145147
**
146148
** Memory to hold the returned string comes from malloc() and needs to
147149
** be freed by the caller.
148150
*/
149151
char *tag_to_uuid(const char *zTag){
@@ -183,10 +185,19 @@
183185
" ORDER BY event.mtime DESC ",
184186
zTagBase, zDate, (useUtc ? "" : ",'utc'")
185187
);
186188
break;
187189
}
190
+ }
191
+ if( zUuid==0 && strcmp(zTag, "tip")==0 ){
192
+ zUuid = db_text(0,
193
+ "SELECT blob.uuid"
194
+ " FROM event, blob"
195
+ " WHERE event.type='ci'"
196
+ " AND blob.rid=event.objid"
197
+ " ORDER BY event.mtime DESC"
198
+ );
188199
}
189200
}
190201
return zUuid;
191202
}
192203
193204
--- src/name.c
+++ src/name.c
@@ -140,10 +140,12 @@
140 **
141 ** tag:date
142 **
143 ** Then return the UUID of the oldest check-in with that tag that is
144 ** not older than 'date'.
 
 
145 **
146 ** Memory to hold the returned string comes from malloc() and needs to
147 ** be freed by the caller.
148 */
149 char *tag_to_uuid(const char *zTag){
@@ -183,10 +185,19 @@
183 " ORDER BY event.mtime DESC ",
184 zTagBase, zDate, (useUtc ? "" : ",'utc'")
185 );
186 break;
187 }
 
 
 
 
 
 
 
 
 
188 }
189 }
190 return zUuid;
191 }
192
193
--- src/name.c
+++ src/name.c
@@ -140,10 +140,12 @@
140 **
141 ** tag:date
142 **
143 ** Then return the UUID of the oldest check-in with that tag that is
144 ** not older than 'date'.
145 **
146 ** An input of "tip" returns the most recent check-in.
147 **
148 ** Memory to hold the returned string comes from malloc() and needs to
149 ** be freed by the caller.
150 */
151 char *tag_to_uuid(const char *zTag){
@@ -183,10 +185,19 @@
185 " ORDER BY event.mtime DESC ",
186 zTagBase, zDate, (useUtc ? "" : ",'utc'")
187 );
188 break;
189 }
190 }
191 if( zUuid==0 && strcmp(zTag, "tip")==0 ){
192 zUuid = db_text(0,
193 "SELECT blob.uuid"
194 " FROM event, blob"
195 " WHERE event.type='ci'"
196 " AND blob.rid=event.objid"
197 " ORDER BY event.mtime DESC"
198 );
199 }
200 }
201 return zUuid;
202 }
203
204

Keyboard Shortcuts

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