28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
static struct tarball_t {
unsigned char *aHdr; /* Space for building headers */
char *zSpaces; /* Spaces for padding */
char *zPrevDir; /* Name of directory for previous entry */
int nPrevDirAlloc; /* size of zPrevDir */
Blob pax; /* PAX data */
} tball;
/*
** Compute a sensible base-name for an archive file (tarball, ZIP, or SQLAR)
** based on the rid of the check-in contained in that file.
**
** PROJECTNAME-DATETIME-HASHPREFIX
**
** So that the name will be safe to use as a URL or a filename on any system,
** the name is only allowed to contain lower-case ASCII alphabetics,
** digits, '_' and '-'. Upper-case ASCII is converted to lower-case. All
** other bytes are mapped into a lower-case alphabetic.
**
** The value returned is obtained from mprintf() or fossil_strdup() and should
** be released by the caller using fossil_free().
*/
char *archive_base_name(int rid){
char *zName;
int i;
char c;
zName = db_text(0,
"SELECT coalesce(config.value,'unnamed')||"
" strftime('-%%Y%%m%%d%%H%%M%%S-',event.mtime)||"
" substr(blob.uuid,1,10)"
" FROM blob, event LEFT JOIN config"
" WHERE blob.rid=%d"
" AND event.objid=%d"
" AND config.name='project-name'",
rid, rid);
for(i=0; (c = zName[i])!=0; i++){
if( fossil_isupper(c) ){
zName[i] = fossil_tolower(c);
}else if( !fossil_isalnum(c) && c!='_' && c!='-' ){
/* 123456789 123456789 123456 */
zName[i] = "abcdefghijklmnopqrstuvwxyz"[(unsigned)c%26];
}
}
return zName;
}
/*
** field lengths of 'ustar' name and prefix fields.
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
<
<
<
<
|
<
<
<
<
<
|
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
static struct tarball_t {
unsigned char *aHdr; /* Space for building headers */
char *zSpaces; /* Spaces for padding */
char *zPrevDir; /* Name of directory for previous entry */
int nPrevDirAlloc; /* size of zPrevDir */
Blob pax; /* PAX data */
} tball;
/*
** Convert a string so that it contains only lower-case ASCII, digits,
** "_" and "-". Changes are made in-place.
*/
static void sanitize_name(char *zName){
int i;
char c;
for(i=0; (c = zName[i])!=0; i++){
if( fossil_isupper(c) ){
zName[i] = fossil_tolower(c);
}else if( !fossil_isalnum(c) && c!='_' && c!='-' ){
/* 123456789 123456789 123456 */
zName[i] = "abcdefghijklmnopqrstuvwxyz"[(unsigned)c%26];
}
}
}
/*
** Compute a sensible base-name for an archive file (tarball, ZIP, or SQLAR)
** based on the rid of the check-in contained in that file.
**
** PROJECTNAME-DATETIME-HASHPREFIX
**
** So that the name will be safe to use as a URL or a filename on any system,
** the name is only allowed to contain lower-case ASCII alphabetics,
** digits, '_' and '-'. Upper-case ASCII is converted to lower-case. All
** other bytes are mapped into a lower-case alphabetic.
**
** The value returned is obtained from mprintf() or fossil_strdup() and should
** be released by the caller using fossil_free().
*/
char *archive_base_name(int rid){
char *zName;
zName = db_text(0,
"SELECT coalesce(config.value,'unnamed')||"
" strftime('-%%Y%%m%%d%%H%%M%%S-',event.mtime)||"
" substr(blob.uuid,1,10)"
" FROM blob, event LEFT JOIN config"
" WHERE blob.rid=%d"
" AND event.objid=%d"
" AND config.name='project-name'",
rid, rid);
sanitize_name(zName);
return zName;
}
/*
** field lengths of 'ustar' name and prefix fields.
|
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
|
tmFlags = TIMELINE_DISJOINT | TIMELINE_NOSCROLL | TIMELINE_COLUMNAR
| TIMELINE_BRCOLOR;
www_print_timeline(&q, tmFlags, 0, 0, 0, 0, 0, download_extra);
db_finalize(&q);
}
if( g.perm.Clone ){
const char *zNm = db_get("short-project-name","clone");
@ <hr>
@ <h2>You Can Clone This Repository</h2>
@ <p>A clone gives you local access to all historical content.
@ Cloning is a bandwidth- and CPU-efficient alternative to extracting
@ multiple tarballs and ZIP archives for users who need access to many
@ different check-ins.
@
@ <p>Clone this repository by running a command like the following:
@ <blockquote><pre>
@ fossil clone %s(g.zBaseURL) %h(zNm).fossil
@ </pre></blockquote>
@ <p>Do a web search for "fossil clone" or similar to find additional
@ information about using a cloned Fossil repository. Or ask your
@ favorite AI how to extract content from a Fossil clone.
}
style_finish_page();
}
/*
** WEBPAGE: rchvdwnld
|
|
>
<
<
<
<
|
>
>
>
|
>
|
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
|
tmFlags = TIMELINE_DISJOINT | TIMELINE_NOSCROLL | TIMELINE_COLUMNAR
| TIMELINE_BRCOLOR;
www_print_timeline(&q, tmFlags, 0, 0, 0, 0, 0, download_extra);
db_finalize(&q);
}
if( g.perm.Clone ){
char *zNm = fossil_strdup(db_get("project-name","clone"));
sanitize_name(zNm);
@ <hr>
@ <h2>You Can Clone This Repository</h2>
@
@ <p>Clone this repository by running a command similar to the following:
@ <blockquote><pre>
@ fossil clone %s(g.zBaseURL) %h(zNm).fossil
@ </pre></blockquote>
@ <p>A clone gives you local access to all historical content.
@ Cloning is a bandwidth- and CPU-efficient alternative to extracting
@ multiple tarballs and ZIPs.
@ Do a web search for "fossil clone" or similar to find additional
@ information about using a cloned Fossil repository. Or ask your
@ favorite AI how to extract content from a Fossil clone.
fossil_free(zNm);
}
style_finish_page();
}
/*
** WEBPAGE: rchvdwnld
|