Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Cache the name of the main branch. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
ca0d66b2e4e74eab6bee5d1229b44610 |
| User & Date: | danield 2025-10-28 15:05:15.024 |
Context
|
2025-10-31
| ||
| 13:29 | Allow symbolic names for the name= query parameter to the /rchvdwnld. check-in: 50b810013f user: drh tags: trunk | |
|
2025-10-29
| ||
| 11:10 | Merge from trunk. check-in: 50b56eec70 user: brickviking tags: bv-infotool | |
|
2025-10-28
| ||
| 15:05 | Cache the name of the main branch. check-in: ca0d66b2e4 user: danield tags: trunk | |
| 14:15 | Try to always honor the main-branch setting rather than hard-coding "trunk". check-in: 3a6dd83947 user: drh tags: trunk | |
Changes
Changes to src/branch.c.
| ︙ | ︙ | |||
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
*******************************************************************************
**
** This file contains code used to create new branches within a repository.
*/
#include "config.h"
#include "branch.h"
#include <assert.h>
/*
** Return true if zBr is the branch name associated with check-in with
** blob.uuid value of zUuid
*/
int branch_includes_uuid(const char *zBr, const char *zUuid){
return db_exists(
| > > > > > > > > > > > > | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
*******************************************************************************
**
** This file contains code used to create new branches within a repository.
*/
#include "config.h"
#include "branch.h"
#include <assert.h>
/*
** Return the name of the main branch. Cache the result.
**
** This is the current value of the "main-branch" setting, or its default
** value (historically, and as of 2025-10-28: "trunk") if not set.
*/
const char *db_main_branch(void){
static char *zMainBranch = 0;
if( zMainBranch==0 ) zMainBranch = db_get("main-branch", 0);
return zMainBranch;
}
/*
** Return true if zBr is the branch name associated with check-in with
** blob.uuid value of zUuid
*/
int branch_includes_uuid(const char *zBr, const char *zUuid){
return db_exists(
|
| ︙ | ︙ | |||
51 52 53 54 55 56 57 |
" AND tagtype>0", TAG_BRANCH);
db_bind_int(&q, "$rid", rid);
if( db_step(&q)==SQLITE_ROW ){
zBr = fossil_strdup(db_column_text(&q,0));
}
db_reset(&q);
if( zBr==0 ){
| < < | | 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
" AND tagtype>0", TAG_BRANCH);
db_bind_int(&q, "$rid", rid);
if( db_step(&q)==SQLITE_ROW ){
zBr = fossil_strdup(db_column_text(&q,0));
}
db_reset(&q);
if( zBr==0 ){
zBr = fossil_strdup(db_main_branch());
}
return zBr;
}
/*
** fossil branch new NAME BASIS ?OPTIONS?
** argv0 argv1 argv2 argv3 argv4
|
| ︙ | ︙ | |||
835 836 837 838 839 840 841 |
** Control jumps to this routine from brlist_page() (the /brlist handler)
** if there are no query parameters.
*/
static void new_brlist_page(void){
Stmt q;
double rNow;
int show_colors = PB("colors");
| | | | 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 |
** Control jumps to this routine from brlist_page() (the /brlist handler)
** if there are no query parameters.
*/
static void new_brlist_page(void){
Stmt q;
double rNow;
int show_colors = PB("colors");
const char *zMainBranch;
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
style_set_current_feature("branch");
style_header("Branches");
style_adunit_config(ADUNIT_RIGHT_OK);
style_submenu_checkbox("colors", "Use Branch Colors", 0, 0);
login_anonymous_available();
zMainBranch = db_main_branch();
brlist_create_temp_table();
db_prepare(&q, "SELECT * FROM tmp_brlist ORDER BY mtime DESC");
rNow = db_double(0.0, "SELECT julianday('now')");
@ <script id="brlist-data" type="application/json">\
@ {"timelineUrl":"%R/timeline"}</script>
@ <div class="brlist">
|
| ︙ | ︙ |
Changes to src/browse.c.
| ︙ | ︙ | |||
125 126 127 128 129 130 131 | ** source tree. This works similarly to /dir but with the following ** differences: ** ** * Links to files go to /doc (showing the file content directly, ** depending on mimetype) rather than to /file (which always shows ** the file embedded in a standard Fossil page frame). ** | | | 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | ** source tree. This works similarly to /dir but with the following ** differences: ** ** * Links to files go to /doc (showing the file content directly, ** depending on mimetype) rather than to /file (which always shows ** the file embedded in a standard Fossil page frame). ** ** * The submenu and the page title is not shown. The page is plain. ** ** The /docdir page is a shorthand for /dir with the "dx" query parameter. ** ** Query parameters: ** ** ci=LABEL Show only files in this check-in. If omitted, the ** "trunk" directory is used. |
| ︙ | ︙ | |||
190 191 192 193 194 195 196 |
/* If the name= parameter is an empty string, make it a NULL pointer */
if( zD && strlen(zD)==0 ){ zD = 0; }
/* If a specific check-in is requested, fetch and parse it. If the
** specific check-in does not exist, clear zCI. zCI==0 will cause all
** files from all check-ins to be displayed.
*/
| | | 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 |
/* If the name= parameter is an empty string, make it a NULL pointer */
if( zD && strlen(zD)==0 ){ zD = 0; }
/* If a specific check-in is requested, fetch and parse it. If the
** specific check-in does not exist, clear zCI. zCI==0 will cause all
** files from all check-ins to be displayed.
*/
if( bDocDir && zCI==0 ) zCI = db_main_branch();
if( zCI ){
pM = manifest_get_by_name(zCI, &rid);
if( pM ){
zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
isSymbolicCI = (sqlite3_strnicmp(zUuid, zCI, strlen(zCI))!=0);
isBranchCI = branch_includes_uuid(zCI, zUuid);
if( bDocDir ) zCI = mprintf("%S", zUuid);
|
| ︙ | ︙ |
Changes to src/checkin.c.
| ︙ | ︙ | |||
1625 1626 1627 1628 1629 1630 1631 |
int parent_rid, /* parent check-in */
Blob *pComment, /* Check-in comment */
int dryRunFlag /* True for a dry-run only */
){
Blob *pDesc;
char *zTags;
char *zFilename;
| | | 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 |
int parent_rid, /* parent check-in */
Blob *pComment, /* Check-in comment */
int dryRunFlag /* True for a dry-run only */
){
Blob *pDesc;
char *zTags;
char *zFilename;
const char *zMainBranch = db_main_branch();
Blob desc;
blob_init(&desc, 0, 0);
pDesc = &desc;
blob_appendf(pDesc, "checkout %s\n", g.zLocalRoot);
blob_appendf(pDesc, "repository %s\n", g.zRepositoryName);
blob_appendf(pDesc, "user %s\n",
p->zUserOvrd ? p->zUserOvrd : login_name());
|
| ︙ | ︙ | |||
2623 2624 2625 2626 2627 2628 2629 |
}
/* Get the ID of the parent manifest artifact */
vid = db_lget_int("checkout", 0);
if( vid==0 ){
useCksum = 1;
if( privateFlag==0 && sCiInfo.zBranch==0 ) {
| | | 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 |
}
/* Get the ID of the parent manifest artifact */
vid = db_lget_int("checkout", 0);
if( vid==0 ){
useCksum = 1;
if( privateFlag==0 && sCiInfo.zBranch==0 ) {
sCiInfo.zBranch = db_main_branch();
}
}else{
privateParent = content_is_private(vid);
}
user_select();
/*
|
| ︙ | ︙ |
Changes to src/checkout.c.
| ︙ | ︙ | |||
494 495 496 497 498 499 500 |
z = find_option("dest",0,1);
if( z ) zDest = fossil_strdup(z);
verify_all_options();
if( g.argc<3 || g.argc>4 ){
usage("URL ?VERSION? ?OPTIONS?");
}
zUrl = g.argv[2];
| | | 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 |
z = find_option("dest",0,1);
if( z ) zDest = fossil_strdup(z);
verify_all_options();
if( g.argc<3 || g.argc>4 ){
usage("URL ?VERSION? ?OPTIONS?");
}
zUrl = g.argv[2];
zVers = g.argc==4 ? g.argv[3] : db_main_branch();
/* Parse the URL of the repository */
url_parse(zUrl, 0);
/* Construct an appropriate name for the destination directory */
if( zDest==0 ){
int i;
|
| ︙ | ︙ |
Changes to src/db.c.
| ︙ | ︙ | |||
4401 4402 4403 4404 4405 4406 4407 |
db_open_repository(zRepo);
/* Figure out which revision to open. */
if( !emptyFlag ){
if( g.argc==4 ){
g.zOpenRevision = g.argv[3];
}else if( db_exists("SELECT 1 FROM event WHERE type='ci'") ){
| | | 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 |
db_open_repository(zRepo);
/* Figure out which revision to open. */
if( !emptyFlag ){
if( g.argc==4 ){
g.zOpenRevision = g.argv[3];
}else if( db_exists("SELECT 1 FROM event WHERE type='ci'") ){
g.zOpenRevision = fossil_strdup(db_main_branch());
}
if( autosync_loop(SYNC_PULL, !bForce, "open") && !bForce ){
fossil_fatal("unable to auto-sync the repository");
}
}
|
| ︙ | ︙ |
Changes to src/descendants.c.
| ︙ | ︙ | |||
435 436 437 438 439 440 441 |
int recomputeFlag = find_option("recompute",0,0)!=0;
int byBranch = find_option("bybranch",0,0)!=0;
int multipleFlag = find_option("multiple","m",0)!=0;
const char *zWidth = find_option("width","W",1);
char *zLastBr = 0;
int n, width;
char zLineNo[10];
| | | 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 |
int recomputeFlag = find_option("recompute",0,0)!=0;
int byBranch = find_option("bybranch",0,0)!=0;
int multipleFlag = find_option("multiple","m",0)!=0;
const char *zWidth = find_option("width","W",1);
char *zLastBr = 0;
int n, width;
char zLineNo[10];
const char *zMainBranch = db_main_branch();
if( multipleFlag ) byBranch = 1;
if( zWidth ){
width = atoi(zWidth);
if( (width!=0) && (width<=39) ){
fossil_fatal("-W|--width value must be >39 or 0");
}
|
| ︙ | ︙ | |||
533 534 535 536 537 538 539 |
}
z = mprintf("%s [%S] %s%s", zDate, zId, zCom,
zBranchPoint ? zBranchPoint : "");
comment_print(z, zCom, 7, width, get_comment_format());
fossil_free(z);
fossil_free(zBranchPoint);
}
| < | 533 534 535 536 537 538 539 540 541 542 543 544 545 546 |
}
z = mprintf("%s [%S] %s%s", zDate, zId, zCom,
zBranchPoint ? zBranchPoint : "");
comment_print(z, zCom, 7, width, get_comment_format());
fossil_free(z);
fossil_free(zBranchPoint);
}
fossil_free(zLastBr);
db_finalize(&q);
}
/*
** WEBPAGE: leaves
**
|
| ︙ | ︙ |
Changes to src/export.c.
| ︙ | ︙ | |||
489 490 491 492 493 494 495 |
*/
void export_cmd(void){
Stmt q, q2, q3;
Bag blobs, vers;
unsigned int unused_mark = 1;
const char *markfile_in;
const char *markfile_out;
| | | 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 |
*/
void export_cmd(void){
Stmt q, q2, q3;
Bag blobs, vers;
unsigned int unused_mark = 1;
const char *markfile_in;
const char *markfile_out;
const char *zMainBranch = db_main_branch();
bag_init(&blobs);
bag_init(&vers);
find_option("git", 0, 0); /* Ignore the --git option for now */
markfile_in = find_option("import-marks", 0, 1);
markfile_out = find_option("export-marks", 0, 1);
|
| ︙ | ︙ | |||
1089 1090 1091 1092 1093 1094 1095 | Blob comment; /* The comment text for the check-in */ int nErr = 0; /* Number of errors */ int bPhantomOk; /* True if phantom files should be ignored */ char buf[24]; char *zEmail; /* Contact info for Git committer field */ int fManifest; /* Should the manifest files be included? */ int fPManifest = 0; /* OR of the manifest files for all parents */ | | | 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 |
Blob comment; /* The comment text for the check-in */
int nErr = 0; /* Number of errors */
int bPhantomOk; /* True if phantom files should be ignored */
char buf[24];
char *zEmail; /* Contact info for Git committer field */
int fManifest; /* Should the manifest files be included? */
int fPManifest = 0; /* OR of the manifest files for all parents */
const char *zMainBranch;
pMan = manifest_get(rid, CFTYPE_MANIFEST, 0);
if( pMan==0 ){
/* Must be a phantom. Return without doing anything, and in particular
** without creating a mark for this check-in. */
gitmirror_message(VERB_NORMAL, "missing check-in: %s\n", zUuid);
return 0;
|
| ︙ | ︙ | |||
1149 1150 1151 1152 1153 1154 1155 |
}
/* Figure out which branch this check-in is a member of */
zBranch = db_text(0,
"SELECT value FROM tagxref WHERE tagid=%d AND tagtype>0 AND rid=%d",
TAG_BRANCH, rid
);
| | | 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 |
}
/* Figure out which branch this check-in is a member of */
zBranch = db_text(0,
"SELECT value FROM tagxref WHERE tagid=%d AND tagtype>0 AND rid=%d",
TAG_BRANCH, rid
);
zMainBranch = db_main_branch();
if( fossil_strcmp(zBranch, zMainBranch)==0 ){
assert( gitmirror_mainbranch!=0 );
fossil_free(zBranch);
zBranch = fossil_strdup(gitmirror_mainbranch);
}else if( zBranch==0 ){
zBranch = mprintf("unknown");
}else{
|
| ︙ | ︙ |
Changes to src/fileedit.c.
| ︙ | ︙ | |||
831 832 833 834 835 836 837 |
if(zDate){
cimi.zDate = fossil_strdup(zDate);
}
if(zRevision==0 || zRevision[0]==0){
if(g.localOpen/*check-out*/){
zRevision = db_lget("checkout-hash", 0)/*leak*/;
}else{
| | | 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 |
if(zDate){
cimi.zDate = fossil_strdup(zDate);
}
if(zRevision==0 || zRevision[0]==0){
if(g.localOpen/*check-out*/){
zRevision = db_lget("checkout-hash", 0)/*leak*/;
}else{
zRevision = db_main_branch();
}
}
name_to_uuid2(zRevision, "ci", &cimi.zParentUuid);
if(cimi.zParentUuid==0){
fossil_fatal("Cannot determine version to commit to.");
}
blob_read_from_file(&cimi.fileContent, zFilename, ExtFILE);
|
| ︙ | ︙ |
Changes to src/finfo.c.
| ︙ | ︙ | |||
174 175 176 177 178 179 180 |
Blob fname;
int rid;
const char *zFilename;
const char *zLimit;
const char *zWidth;
const char *zOffset;
int iLimit, iOffset, iBrief, iWidth;
| | | 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
Blob fname;
int rid;
const char *zFilename;
const char *zLimit;
const char *zWidth;
const char *zOffset;
int iLimit, iOffset, iBrief, iWidth;
const char *zMainBranch;
if( find_option("log","l",0) ){
/* this is the default, no-op */
}
zLimit = find_option("limit","n",1);
zWidth = find_option("width","W",1);
iLimit = zLimit ? atoi(zLimit) : -1;
|
| ︙ | ︙ | |||
230 231 232 233 234 235 236 237 238 239 240 241 242 243 |
TAG_BRANCH, zFilename, filename_collation(),
iLimit, iOffset
);
blob_zero(&line);
if( iBrief == 0 ){
fossil_print("History for %s\n", blob_str(&fname));
}
while( db_step(&q)==SQLITE_ROW ){
const char *zFileUuid = db_column_text(&q, 0);
const char *zCiUuid = db_column_text(&q,1);
const char *zDate = db_column_text(&q, 2);
const char *zCom = db_column_text(&q, 3);
const char *zUser = db_column_text(&q, 4);
const char *zBr = db_column_text(&q, 5);
| > | 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 |
TAG_BRANCH, zFilename, filename_collation(),
iLimit, iOffset
);
blob_zero(&line);
if( iBrief == 0 ){
fossil_print("History for %s\n", blob_str(&fname));
}
zMainBranch = db_main_branch();
while( db_step(&q)==SQLITE_ROW ){
const char *zFileUuid = db_column_text(&q, 0);
const char *zCiUuid = db_column_text(&q,1);
const char *zDate = db_column_text(&q, 2);
const char *zCom = db_column_text(&q, 3);
const char *zUser = db_column_text(&q, 4);
const char *zBr = db_column_text(&q, 5);
|
| ︙ | ︙ | |||
375 376 377 378 379 380 381 | Stmt qparent; int iTableId = timeline_tableid(); int tmFlags = 0; /* Viewing mode */ const char *zStyle; /* Viewing mode name */ const char *zMark; /* Mark this version of the file */ int selRid = 0; /* RID of the marked file version */ int mxfnid; /* Maximum filename.fnid value */ | | | 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 |
Stmt qparent;
int iTableId = timeline_tableid();
int tmFlags = 0; /* Viewing mode */
const char *zStyle; /* Viewing mode name */
const char *zMark; /* Mark this version of the file */
int selRid = 0; /* RID of the marked file version */
int mxfnid; /* Maximum filename.fnid value */
const char *zMainBranch;
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
fnid = db_int(0, "SELECT fnid FROM filename WHERE name=%Q", zFilename);
ridCi = zCI ? name_to_rid_www("ci") : 0;
if( fnid==0 ){
style_header("No such file");
|
| ︙ | ︙ | |||
633 634 635 636 637 638 639 640 641 642 643 644 645 646 |
db_bind_int(&qparent, ":mid", fmid);
db_bind_int(&qparent, ":fnid", fnid);
while( db_step(&qparent)==SQLITE_ROW && nParent<count(aParent) ){
aParent[nParent] = db_column_int64(&qparent, 0);
nParent++;
}
db_reset(&qparent);
if( zBr==0 ) zBr = fossil_strdup(zMainBranch);
if( uBg ){
zBgClr = user_color(zUser);
}else if( brBg || zBgClr==0 || zBgClr[0]==0 ){
zBgClr = strcmp(zBr, zMainBranch)==0 ? "" : hash_color(zBr);
}else if( zBgClr ){
zBgClr = reasonable_bg_color(zBgClr,0);
| > | 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 |
db_bind_int(&qparent, ":mid", fmid);
db_bind_int(&qparent, ":fnid", fnid);
while( db_step(&qparent)==SQLITE_ROW && nParent<count(aParent) ){
aParent[nParent] = db_column_int64(&qparent, 0);
nParent++;
}
db_reset(&qparent);
zMainBranch = db_main_branch();
if( zBr==0 ) zBr = fossil_strdup(zMainBranch);
if( uBg ){
zBgClr = user_color(zUser);
}else if( brBg || zBgClr==0 || zBgClr[0]==0 ){
zBgClr = strcmp(zBr, zMainBranch)==0 ? "" : hash_color(zBr);
}else if( zBgClr ){
zBgClr = reasonable_bg_color(zBgClr,0);
|
| ︙ | ︙ |
Changes to src/graph.c.
| ︙ | ︙ | |||
511 512 513 514 515 516 517 |
u32 tmFlags /* TIMELINE flags */
){
GraphRow *pRow, *pDesc, *pDup, *pLoop, *pParent;
int i, j;
u64 mask;
int hasDup = 0; /* True if one or more isDup entries */
const char *zTrunk;
| | | 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 |
u32 tmFlags /* TIMELINE flags */
){
GraphRow *pRow, *pDesc, *pDup, *pLoop, *pParent;
int i, j;
u64 mask;
int hasDup = 0; /* True if one or more isDup entries */
const char *zTrunk;
const char *zMainBranch;
u8 *aMap; /* Copy of p->aiRailMap */
int omitDescenders = (tmFlags & TIMELINE_DISJOINT)!=0;
int nTimewarp = 0;
int riserMargin = (tmFlags & TIMELINE_DISJOINT) ? 0 : RISER_MARGIN;
/* If mergeRiserFrom[X]==Y that means rail X holds a merge riser
** coming up from the bottom of the graph from off-screen check-in Y
|
| ︙ | ︙ | |||
707 708 709 710 711 712 713 | } /* Identify rows where the primary parent is off screen. Assign ** each to a rail and draw descenders downward. ** ** Strive to put the main branch (usually "trunk") on far left. */ | | | 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 |
}
/* Identify rows where the primary parent is off screen. Assign
** each to a rail and draw descenders downward.
**
** Strive to put the main branch (usually "trunk") on far left.
*/
zMainBranch = db_main_branch();
zTrunk = persistBranchName(p, zMainBranch);
for(i=0; i<2; i++){
for(pRow=p->pLast; pRow; pRow=pRow->pPrev){
if( i==0 && pRow->zBranch!=zTrunk ) continue;
if( pRow->iRail>=0 ) continue;
if( pRow->isDup ) continue;
if( pRow->nParent<0 ) continue;
|
| ︙ | ︙ |
Changes to src/import.c.
| ︙ | ︙ | |||
1261 1262 1263 1264 1265 1266 1267 |
/*
** Extract the branch or tag that the given path is on. Return the branch ID.
** Return 0 if not a branch, tag, or trunk, or if ignored by --ignore-tree.
*/
static int svn_parse_path(char *zPath, char **zFile, int *type){
char *zBranch = 0;
int branchId = 0;
| | > | 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 |
/*
** Extract the branch or tag that the given path is on. Return the branch ID.
** Return 0 if not a branch, tag, or trunk, or if ignored by --ignore-tree.
*/
static int svn_parse_path(char *zPath, char **zFile, int *type){
char *zBranch = 0;
int branchId = 0;
const char *zMainBranch;
if( gsvn.azIgnTree ){
const char **pzIgnTree;
unsigned nPath = strlen(zPath);
for( pzIgnTree = gsvn.azIgnTree; *pzIgnTree; ++pzIgnTree ){
const char *zIgn = *pzIgnTree;
unsigned nIgn = strlen(zIgn);
if( strncmp(zPath, zIgn, nIgn) == 0
&& ( nPath == nIgn || (nPath > nIgn && zPath[nIgn] == '/')) ){
return 0;
}
}
}
*type = SVN_UNKNOWN;
*zFile = 0;
zMainBranch = db_main_branch();
if( gsvn.lenTrunk==0 ){
zBranch = fossil_strdup(zMainBranch);
*zFile = zPath;
*type = SVN_TRUNK;
}else
if( strncmp(zPath, gsvn.zTrunk, gsvn.lenTrunk-1)==0 ){
if( zPath[gsvn.lenTrunk-1]=='/' || zPath[gsvn.lenTrunk-1]==0 ){
|
| ︙ | ︙ | |||
1726 1727 1728 1729 1730 1731 1732 |
Stmt q;
int forceFlag = find_option("force", "f", 0)!=0;
int svnFlag = find_option("svn", 0, 0)!=0;
int gitFlag = find_option("git", 0, 0)!=0;
int omitRebuild = find_option("no-rebuild",0,0)!=0;
int omitVacuum = find_option("no-vacuum",0,0)!=0;
const char *zDefaultUser = find_option("admin-user","A",1);
| < | 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 |
Stmt q;
int forceFlag = find_option("force", "f", 0)!=0;
int svnFlag = find_option("svn", 0, 0)!=0;
int gitFlag = find_option("git", 0, 0)!=0;
int omitRebuild = find_option("no-rebuild",0,0)!=0;
int omitVacuum = find_option("no-vacuum",0,0)!=0;
const char *zDefaultUser = find_option("admin-user","A",1);
/* Options common to all input formats */
int incrFlag = find_option("incremental", "i", 0)!=0;
/* Options for --svn only */
const char *zBase = "";
int flatFlag = 0;
|
| ︙ | ︙ | |||
1770 1771 1772 1773 1774 1775 1776 |
}else{
*renOpt->varPre = renOpt->zDefaultPre;
*renOpt->varSuf = renOpt->zDefaultSuf;
}
}
}
if( !(gimport.zTrunkName = find_option("rename-trunk", 0, 1)) ){
| | | 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 |
}else{
*renOpt->varPre = renOpt->zDefaultPre;
*renOpt->varSuf = renOpt->zDefaultSuf;
}
}
}
if( !(gimport.zTrunkName = find_option("rename-trunk", 0, 1)) ){
gimport.zTrunkName = fossil_strdup(db_main_branch());
}
if( svnFlag ){
/* Get --svn related options here, so verify_all_options() fails when
* svn-only options are specified with --git
*/
const char *zIgnTree;
|
| ︙ | ︙ |
Changes to src/info.c.
| ︙ | ︙ | |||
1139 1140 1141 1142 1143 1144 1145 |
}else if( zLinks[0] ){
zLinks += 3;
}
@ %s(zLinks)</td></tr>
}
if( g.perm.Hyperlink ){
| | | 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 |
}else if( zLinks[0] ){
zLinks += 3;
}
@ %s(zLinks)</td></tr>
}
if( g.perm.Hyperlink ){
const char *zMainBranch = db_main_branch();
@ <tr><th>Other Links:</th>
@ <td>
if( fossil_strcmp(zBrName, zMainBranch)!=0 ){
@ %z(href("%R/vdiff?branch=%!S", zUuid))branch diff</a> |
}
@ %z(href("%R/artifact/%!S",zUuid))manifest</a>
@ | %z(href("%R/ci_tags/%!S",zUuid))tags</a>
|
| ︙ | ︙ | |||
3716 3717 3718 3719 3720 3721 3722 |
blob_append(&comment, zNewComment, -1);
zUuid[10] = 0;
style_header("Edit Check-in [%s]", zUuid);
if( P("preview") ){
Blob suffix;
int nTag = 0;
const char *zDplyBr; /* Branch name used to determine BG color */
| | | 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 |
blob_append(&comment, zNewComment, -1);
zUuid[10] = 0;
style_header("Edit Check-in [%s]", zUuid);
if( P("preview") ){
Blob suffix;
int nTag = 0;
const char *zDplyBr; /* Branch name used to determine BG color */
const char *zMainBranch = db_main_branch();
if( zNewBrFlag[0] && zNewBranch[0] ){
zDplyBr = zNewBranch;
}else{
zDplyBr = zBranchName;
}
@ <b>Preview:</b>
@ <blockquote>
|
| ︙ | ︙ | |||
3855 3856 3857 3858 3859 3860 3861 |
@ Cancel tag <b>%h(&zTagName[4])</b></label>
}
}
db_finalize(&q);
@ </td></tr>
if( !zBranchName ){
| | | 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 |
@ Cancel tag <b>%h(&zTagName[4])</b></label>
}
}
db_finalize(&q);
@ </td></tr>
if( !zBranchName ){
zBranchName = fossil_strdup(db_main_branch());
}
if( !zNewBranch || !zNewBranch[0]){
zNewBranch = zBranchName;
}
@ <tr><th align="right" valign="top">Branching:</th>
@ <td valign="top">
@ <label><input id="newbr" type="checkbox" name="newbr" \
|
| ︙ | ︙ |
Changes to src/json_branch.c.
| ︙ | ︙ | |||
311 312 313 314 315 316 317 |
*/
static cson_value * json_branch_create(void){
cson_value * payV = NULL;
cson_object * pay = NULL;
int rc = 0;
BranchCreateOptions opt;
char * zUuid = NULL;
| | | 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 |
*/
static cson_value * json_branch_create(void){
cson_value * payV = NULL;
cson_object * pay = NULL;
int rc = 0;
BranchCreateOptions opt;
char * zUuid = NULL;
const char *zMainBranch = db_main_branch();
int rid = 0;
if( !g.perm.Write ){
json_set_err(FSL_JSON_E_DENIED,
"Requires 'i' permissions.");
return NULL;
}
memset(&opt,0,sizeof(BranchCreateOptions));
|
| ︙ | ︙ |
Changes to src/leaf.c.
| ︙ | ︙ | |||
226 227 228 229 230 231 232 |
int leaf_ambiguity_warning(int rid, int currentCkout){
char *zBr;
Stmt q;
int n = 0;
Blob msg;
const char *zMainBranch;
if( leaf_ambiguity(rid)==0 ) return 0;
| | | 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 |
int leaf_ambiguity_warning(int rid, int currentCkout){
char *zBr;
Stmt q;
int n = 0;
Blob msg;
const char *zMainBranch;
if( leaf_ambiguity(rid)==0 ) return 0;
zMainBranch = db_main_branch();
zBr = db_text(0, "SELECT value FROM tagxref WHERE tagid=%d AND rid=%d",
TAG_BRANCH, rid);
if( zBr==0 ) zBr = fossil_strdup(zMainBranch);
blob_init(&msg, 0, 0);
blob_appendf(&msg, "WARNING: multiple open leaf check-ins on %s:", zBr);
db_prepare(&q,
"SELECT"
|
| ︙ | ︙ |
Changes to src/rebuild.c.
| ︙ | ︙ | |||
349 350 351 352 353 354 355 |
}
/*
** Check to see if the "sym-trunk" tag exists. If not, create it
** and attach it to the very first check-in.
*/
static void rebuild_tag_trunk(void){
| | | 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 |
}
/*
** Check to see if the "sym-trunk" tag exists. If not, create it
** and attach it to the very first check-in.
*/
static void rebuild_tag_trunk(void){
const char *zMainBranch = db_main_branch();
int tagid = db_int(0, "SELECT 1 FROM tag WHERE tagname='sym-%q'",zMainBranch);
int rid;
char *zUuid;
if( tagid>0 ) return;
rid = db_int(0, "SELECT pid FROM plink AS x WHERE NOT EXISTS("
" SELECT 1 FROM plink WHERE cid=x.pid)");
|
| ︙ | ︙ |
Changes to src/search.c.
| ︙ | ︙ | |||
850 851 852 853 854 855 856 |
const char *zPattern, /* The query pattern */
unsigned int srchFlags /* What to search over */
){
search_init(zPattern, "<mark>", "</mark>", " ... ",
SRCHFLG_STATIC|SRCHFLG_HTML);
if( (srchFlags & SRCH_DOC)!=0 ){
char *zDocGlob = db_get("doc-glob","");
| | | 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 |
const char *zPattern, /* The query pattern */
unsigned int srchFlags /* What to search over */
){
search_init(zPattern, "<mark>", "</mark>", " ... ",
SRCHFLG_STATIC|SRCHFLG_HTML);
if( (srchFlags & SRCH_DOC)!=0 ){
char *zDocGlob = db_get("doc-glob","");
const char *zMainBranch = db_main_branch();
char *zDocBr = db_get("doc-branch", zMainBranch);
if( zDocGlob && zDocGlob[0] && zDocBr && zDocBr[0] ){
Glob * pGlob = glob_create(zDocBr)
/* We're misusing a Glob as a list of comma-/space-delimited
** tokens. We're not actually doing glob matches here. */;
int i;
db_multi_exec(
|
| ︙ | ︙ | |||
1985 1986 1987 1988 1989 1990 1991 |
/*
** If the doc-glob and doc-br settings are valid for document search
** and if the latest check-in on doc-br is in the unindexed set of
** check-ins, then update all 'd' entries in FTSDOCS that have
** changed.
*/
static void search_update_doc_index(void){
| | | 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 |
/*
** If the doc-glob and doc-br settings are valid for document search
** and if the latest check-in on doc-br is in the unindexed set of
** check-ins, then update all 'd' entries in FTSDOCS that have
** changed.
*/
static void search_update_doc_index(void){
const char *zMainBranch = db_main_branch();
const char *zDocBranches = db_get("doc-branch", zMainBranch);
int i;
Glob * pGlob = glob_create(zDocBranches)
/* We're misusing a Glob as a list of comma-/space-delimited
** tokens. We're not actually doing glob matches here. */;
if( !pGlob ) return;
db_multi_exec(
|
| ︙ | ︙ |
Changes to src/setup.c.
| ︙ | ︙ | |||
2280 2281 2282 2283 2284 2285 2286 |
/*
** WEBPAGE: srchsetup
**
** Configure the search engine. Requires Admin privilege.
*/
void page_srchsetup(){
| | | 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 |
/*
** WEBPAGE: srchsetup
**
** Configure the search engine. Requires Admin privilege.
*/
void page_srchsetup(){
const char *zMainBranch;
login_check_credentials();
if( !g.perm.Admin ){
login_needed(0);
return;
}
style_set_current_feature("setup");
style_header("Search Configuration");
|
| ︙ | ︙ | |||
2311 2312 2313 2314 2315 2316 2317 | @ <td>Search all Markdown files in the doc/ subfolder and all README.txt @ files.</tr> @ <tr><td>*<td><td>Search all checked-in files</tr> @ <tr><td><i>(blank)</i><td> @ <td>Search nothing. (Disables document search).</tr> @ </table> @ <hr> | | | 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 |
@ <td>Search all Markdown files in the doc/ subfolder and all README.txt
@ files.</tr>
@ <tr><td>*<td><td>Search all checked-in files</tr>
@ <tr><td><i>(blank)</i><td>
@ <td>Search nothing. (Disables document search).</tr>
@ </table>
@ <hr>
zMainBranch = db_main_branch();
entry_attribute("Document Branches", 20, "doc-branch", "db", zMainBranch, 0);
@ <p>When searching documents, use the versions of the files found at the
@ type of the "Document Branches" branch. Recommended value: the name of
@ the main branch (usually "trunk").
@ Document search is disabled if blank. It may be a list of branch names
@ separated by spaces and/or commas.
@ <hr>
|
| ︙ | ︙ |
Changes to src/tar.c.
| ︙ | ︙ | |||
947 948 949 950 951 952 953 | const char *zInclude; /* The in= query parameter */ const char *zExclude; /* The ex= query parameter */ Blob cacheKey; /* The key to cache */ Glob *pInclude = 0; /* The compiled in= glob pattern */ Glob *pExclude = 0; /* The compiled ex= glob pattern */ Blob tarball; /* Tarball accumulated here */ const char *z; | < | | 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 |
const char *zInclude; /* The in= query parameter */
const char *zExclude; /* The ex= query parameter */
Blob cacheKey; /* The key to cache */
Glob *pInclude = 0; /* The compiled in= glob pattern */
Glob *pExclude = 0; /* The compiled ex= glob pattern */
Blob tarball; /* Tarball accumulated here */
const char *z;
login_check_credentials();
if( !g.perm.Zip ){ login_needed(g.anon.Zip); return; }
if( robot_restrict("zip") ) return;
fossil_nice_default();
zName = fossil_strdup(PD("name",""));
z = P("r");
if( z==0 ) z = P("uuid");
if( z==0 ) z = tar_uuid_from_name(&zName);
if( z==0 ) z = fossil_strdup(db_main_branch());
g.zOpenRevision = zRid = fossil_strdup(z);
nRid = strlen(zRid);
zInclude = P("in");
if( zInclude ) pInclude = glob_create(zInclude);
zExclude = P("ex");
if( zExclude ) pExclude = glob_create(zExclude);
if( zInclude==0 && zExclude==0 ){
|
| ︙ | ︙ |
Changes to src/timeline.c.
| ︙ | ︙ | |||
386 387 388 389 390 391 392 |
int dateFormat = 0; /* 0: HH:MM (default) */
int bCommentGitStyle = 0; /* Only show comments through first blank line */
const char *zStyle; /* Sub-name for classes for the style */
const char *zDateFmt;
int iTableId = timeline_tableid();
int bTimestampLinksToInfo; /* True if timestamp hyperlinks go to the /info
** page rather than the /timeline page */
| | | 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 |
int dateFormat = 0; /* 0: HH:MM (default) */
int bCommentGitStyle = 0; /* Only show comments through first blank line */
const char *zStyle; /* Sub-name for classes for the style */
const char *zDateFmt;
int iTableId = timeline_tableid();
int bTimestampLinksToInfo; /* True if timestamp hyperlinks go to the /info
** page rather than the /timeline page */
const char *zMainBranch = db_main_branch();
if( cgi_is_loopback(g.zIpAddr) && db_open_local(0) ){
vid = db_lget_int("checkout", 0);
}
if( xExtra==0 ) xExtra = timeline_extra;
zPrevDate[0] = 0;
|
| ︙ | ︙ |
Changes to src/update.c.
| ︙ | ︙ | |||
749 750 751 752 753 754 755 |
** zRevision is NULL.
*/
Manifest *historical_manifest(
const char *zRevision /* The check-in to query, or NULL for current */
){
int vid;
Manifest *pManifest;
| < | | 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 |
** zRevision is NULL.
*/
Manifest *historical_manifest(
const char *zRevision /* The check-in to query, or NULL for current */
){
int vid;
Manifest *pManifest;
/* Determine the check-in manifest artifact ID. Panic on failure. */
if( zRevision ){
vid = name_to_typed_rid(zRevision, "ci");
}else if( !g.localOpen ){
vid = name_to_typed_rid(db_main_branch(), "ci");
}else{
vid = db_lget_int("checkout", 0);
if( !is_a_version(vid) ){
if( vid==0 ) return 0;
zRevision = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", vid);
if( zRevision ){
fossil_fatal("check-out artifact is not a check-in: %s", zRevision);
|
| ︙ | ︙ |
Changes to src/zip.c.
| ︙ | ︙ | |||
1018 1019 1020 1021 1022 1023 1024 | const char *zExclude; /* The ex= query parameter */ Blob cacheKey; /* The key to cache */ Glob *pInclude = 0; /* The compiled in= glob pattern */ Glob *pExclude = 0; /* The compiled ex= glob pattern */ Blob zip; /* ZIP archive accumulated here */ int eType = ARCHIVE_ZIP; /* Type of archive to generate */ char *zType; /* Human-readable archive type */ | < | | 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 |
const char *zExclude; /* The ex= query parameter */
Blob cacheKey; /* The key to cache */
Glob *pInclude = 0; /* The compiled in= glob pattern */
Glob *pExclude = 0; /* The compiled ex= glob pattern */
Blob zip; /* ZIP archive accumulated here */
int eType = ARCHIVE_ZIP; /* Type of archive to generate */
char *zType; /* Human-readable archive type */
login_check_credentials();
if( !g.perm.Zip ){ login_needed(g.anon.Zip); return; }
if( robot_restrict("zip") ) return;
if( fossil_strcmp(g.zPath, "sqlar")==0 ){
eType = ARCHIVE_SQLAR;
zType = "SQL";
}else{
eType = ARCHIVE_ZIP;
zType = "ZIP";
}
fossil_nice_default();
zName = fossil_strdup(PD("name",""));
z = P("r");
if( z==0 ) z = P("uuid");
if( z==0 ) z = tar_uuid_from_name(&zName);
if( z==0 ) z = fossil_strdup(db_main_branch());
nName = strlen(zName);
g.zOpenRevision = zRid = fossil_strdup(z);
nRid = strlen(zRid);
zInclude = P("in");
if( zInclude ) pInclude = glob_create(zInclude);
zExclude = P("ex");
if( zExclude ) pExclude = glob_create(zExclude);
|
| ︙ | ︙ |