Fossil SCM
Replace hard-coded "trunk" with the value of 'main-branch' (defaulting to "trunk").
Commit
dd8995bbdd9e33287d259b706bd98b57e935b8264abe056d7e68ac32027cac12
Parent
4163ef006d7067a…
21 files changed
+4
-1
+1
-1
+3
-1
+1
-1
+1
-1
+2
-1
+11
-5
+1
-1
+7
-3
+5
-2
+9
-5
+6
-2
+4
-2
+3
-1
+5
-3
+6
-2
+6
-2
+11
-5
+2
-1
+3
-1
+11
-5
~
src/branch.c
~
src/browse.c
~
src/checkin.c
~
src/checkout.c
~
src/descendants.c
~
src/diff.c
~
src/export.c
~
src/fileedit.c
~
src/finfo.c
~
src/graph.c
~
src/import.c
~
src/info.c
~
src/json_branch.c
~
src/leaf.c
~
src/rebuild.c
~
src/search.c
~
src/setup.c
~
src/tar.c
~
src/timeline.c
~
src/update.c
~
src/zip.c
+4
-1
| --- src/branch.c | ||
| +++ src/branch.c | ||
| @@ -837,18 +837,20 @@ | ||
| 837 | 837 | */ |
| 838 | 838 | static void new_brlist_page(void){ |
| 839 | 839 | Stmt q; |
| 840 | 840 | double rNow; |
| 841 | 841 | int show_colors = PB("colors"); |
| 842 | + char *zMainBranch; | |
| 842 | 843 | login_check_credentials(); |
| 843 | 844 | if( !g.perm.Read ){ login_needed(g.anon.Read); return; } |
| 844 | 845 | style_set_current_feature("branch"); |
| 845 | 846 | style_header("Branches"); |
| 846 | 847 | style_adunit_config(ADUNIT_RIGHT_OK); |
| 847 | 848 | style_submenu_checkbox("colors", "Use Branch Colors", 0, 0); |
| 848 | 849 | |
| 849 | 850 | login_anonymous_available(); |
| 851 | + zMainBranch = db_get("main-branch", 0); | |
| 850 | 852 | |
| 851 | 853 | brlist_create_temp_table(); |
| 852 | 854 | db_prepare(&q, "SELECT * FROM tmp_brlist ORDER BY mtime DESC"); |
| 853 | 855 | rNow = db_double(0.0, "SELECT julianday('now')"); |
| 854 | 856 | @ <script id="brlist-data" type="application/json">\ |
| @@ -873,11 +875,11 @@ | ||
| 873 | 875 | char *zAge = human_readable_age(rNow - rMtime); |
| 874 | 876 | sqlite3_int64 iMtime = (sqlite3_int64)(rMtime*86400.0); |
| 875 | 877 | if( zMergeTo && zMergeTo[0]==0 ) zMergeTo = 0; |
| 876 | 878 | if( zBgClr ) zBgClr = reasonable_bg_color(zBgClr, 0); |
| 877 | 879 | if( zBgClr==0 ){ |
| 878 | - if( zBranch==0 || strcmp(zBranch,"trunk")==0 ){ | |
| 880 | + if( zBranch==0 || strcmp(zBranch, zMainBranch)==0 ){ | |
| 879 | 881 | zBgClr = 0; |
| 880 | 882 | }else{ |
| 881 | 883 | zBgClr = hash_color(zBranch); |
| 882 | 884 | } |
| 883 | 885 | } |
| @@ -899,10 +901,11 @@ | ||
| 899 | 901 | @ <td></td> |
| 900 | 902 | } |
| 901 | 903 | @ </tr> |
| 902 | 904 | } |
| 903 | 905 | @ </tbody></table></div> |
| 906 | + fossil_free(zMainBranch); | |
| 904 | 907 | db_finalize(&q); |
| 905 | 908 | builtin_request_js("fossil.page.brlist.js"); |
| 906 | 909 | style_table_sorter(); |
| 907 | 910 | style_finish_page(); |
| 908 | 911 | } |
| 909 | 912 |
| --- src/branch.c | |
| +++ src/branch.c | |
| @@ -837,18 +837,20 @@ | |
| 837 | */ |
| 838 | static void new_brlist_page(void){ |
| 839 | Stmt q; |
| 840 | double rNow; |
| 841 | int show_colors = PB("colors"); |
| 842 | login_check_credentials(); |
| 843 | if( !g.perm.Read ){ login_needed(g.anon.Read); return; } |
| 844 | style_set_current_feature("branch"); |
| 845 | style_header("Branches"); |
| 846 | style_adunit_config(ADUNIT_RIGHT_OK); |
| 847 | style_submenu_checkbox("colors", "Use Branch Colors", 0, 0); |
| 848 | |
| 849 | login_anonymous_available(); |
| 850 | |
| 851 | brlist_create_temp_table(); |
| 852 | db_prepare(&q, "SELECT * FROM tmp_brlist ORDER BY mtime DESC"); |
| 853 | rNow = db_double(0.0, "SELECT julianday('now')"); |
| 854 | @ <script id="brlist-data" type="application/json">\ |
| @@ -873,11 +875,11 @@ | |
| 873 | char *zAge = human_readable_age(rNow - rMtime); |
| 874 | sqlite3_int64 iMtime = (sqlite3_int64)(rMtime*86400.0); |
| 875 | if( zMergeTo && zMergeTo[0]==0 ) zMergeTo = 0; |
| 876 | if( zBgClr ) zBgClr = reasonable_bg_color(zBgClr, 0); |
| 877 | if( zBgClr==0 ){ |
| 878 | if( zBranch==0 || strcmp(zBranch,"trunk")==0 ){ |
| 879 | zBgClr = 0; |
| 880 | }else{ |
| 881 | zBgClr = hash_color(zBranch); |
| 882 | } |
| 883 | } |
| @@ -899,10 +901,11 @@ | |
| 899 | @ <td></td> |
| 900 | } |
| 901 | @ </tr> |
| 902 | } |
| 903 | @ </tbody></table></div> |
| 904 | db_finalize(&q); |
| 905 | builtin_request_js("fossil.page.brlist.js"); |
| 906 | style_table_sorter(); |
| 907 | style_finish_page(); |
| 908 | } |
| 909 |
| --- src/branch.c | |
| +++ src/branch.c | |
| @@ -837,18 +837,20 @@ | |
| 837 | */ |
| 838 | static void new_brlist_page(void){ |
| 839 | Stmt q; |
| 840 | double rNow; |
| 841 | int show_colors = PB("colors"); |
| 842 | char *zMainBranch; |
| 843 | login_check_credentials(); |
| 844 | if( !g.perm.Read ){ login_needed(g.anon.Read); return; } |
| 845 | style_set_current_feature("branch"); |
| 846 | style_header("Branches"); |
| 847 | style_adunit_config(ADUNIT_RIGHT_OK); |
| 848 | style_submenu_checkbox("colors", "Use Branch Colors", 0, 0); |
| 849 | |
| 850 | login_anonymous_available(); |
| 851 | zMainBranch = db_get("main-branch", 0); |
| 852 | |
| 853 | brlist_create_temp_table(); |
| 854 | db_prepare(&q, "SELECT * FROM tmp_brlist ORDER BY mtime DESC"); |
| 855 | rNow = db_double(0.0, "SELECT julianday('now')"); |
| 856 | @ <script id="brlist-data" type="application/json">\ |
| @@ -873,11 +875,11 @@ | |
| 875 | char *zAge = human_readable_age(rNow - rMtime); |
| 876 | sqlite3_int64 iMtime = (sqlite3_int64)(rMtime*86400.0); |
| 877 | if( zMergeTo && zMergeTo[0]==0 ) zMergeTo = 0; |
| 878 | if( zBgClr ) zBgClr = reasonable_bg_color(zBgClr, 0); |
| 879 | if( zBgClr==0 ){ |
| 880 | if( zBranch==0 || strcmp(zBranch, zMainBranch)==0 ){ |
| 881 | zBgClr = 0; |
| 882 | }else{ |
| 883 | zBgClr = hash_color(zBranch); |
| 884 | } |
| 885 | } |
| @@ -899,10 +901,11 @@ | |
| 901 | @ <td></td> |
| 902 | } |
| 903 | @ </tr> |
| 904 | } |
| 905 | @ </tbody></table></div> |
| 906 | fossil_free(zMainBranch); |
| 907 | db_finalize(&q); |
| 908 | builtin_request_js("fossil.page.brlist.js"); |
| 909 | style_table_sorter(); |
| 910 | style_finish_page(); |
| 911 | } |
| 912 |
+1
-1
| --- src/browse.c | ||
| +++ src/browse.c | ||
| @@ -192,11 +192,11 @@ | ||
| 192 | 192 | |
| 193 | 193 | /* If a specific check-in is requested, fetch and parse it. If the |
| 194 | 194 | ** specific check-in does not exist, clear zCI. zCI==0 will cause all |
| 195 | 195 | ** files from all check-ins to be displayed. |
| 196 | 196 | */ |
| 197 | - if( bDocDir && zCI==0 ) zCI = "trunk"; | |
| 197 | + if( bDocDir && zCI==0 ) zCI = db_get("main-branch", 0); | |
| 198 | 198 | if( zCI ){ |
| 199 | 199 | pM = manifest_get_by_name(zCI, &rid); |
| 200 | 200 | if( pM ){ |
| 201 | 201 | zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 202 | 202 | isSymbolicCI = (sqlite3_strnicmp(zUuid, zCI, strlen(zCI))!=0); |
| 203 | 203 |
| --- src/browse.c | |
| +++ src/browse.c | |
| @@ -192,11 +192,11 @@ | |
| 192 | |
| 193 | /* If a specific check-in is requested, fetch and parse it. If the |
| 194 | ** specific check-in does not exist, clear zCI. zCI==0 will cause all |
| 195 | ** files from all check-ins to be displayed. |
| 196 | */ |
| 197 | if( bDocDir && zCI==0 ) zCI = "trunk"; |
| 198 | if( zCI ){ |
| 199 | pM = manifest_get_by_name(zCI, &rid); |
| 200 | if( pM ){ |
| 201 | zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 202 | isSymbolicCI = (sqlite3_strnicmp(zUuid, zCI, strlen(zCI))!=0); |
| 203 |
| --- src/browse.c | |
| +++ src/browse.c | |
| @@ -192,11 +192,11 @@ | |
| 192 | |
| 193 | /* If a specific check-in is requested, fetch and parse it. If the |
| 194 | ** specific check-in does not exist, clear zCI. zCI==0 will cause all |
| 195 | ** files from all check-ins to be displayed. |
| 196 | */ |
| 197 | if( bDocDir && zCI==0 ) zCI = db_get("main-branch", 0); |
| 198 | if( zCI ){ |
| 199 | pM = manifest_get_by_name(zCI, &rid); |
| 200 | if( pM ){ |
| 201 | zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 202 | isSymbolicCI = (sqlite3_strnicmp(zUuid, zCI, strlen(zCI))!=0); |
| 203 |
+3
-1
| --- src/checkin.c | ||
| +++ src/checkin.c | ||
| @@ -1627,19 +1627,20 @@ | ||
| 1627 | 1627 | int dryRunFlag /* True for a dry-run only */ |
| 1628 | 1628 | ){ |
| 1629 | 1629 | Blob *pDesc; |
| 1630 | 1630 | char *zTags; |
| 1631 | 1631 | char *zFilename; |
| 1632 | + char *zMainBranch = db_get("main-branch", 0); | |
| 1632 | 1633 | Blob desc; |
| 1633 | 1634 | blob_init(&desc, 0, 0); |
| 1634 | 1635 | pDesc = &desc; |
| 1635 | 1636 | blob_appendf(pDesc, "checkout %s\n", g.zLocalRoot); |
| 1636 | 1637 | blob_appendf(pDesc, "repository %s\n", g.zRepositoryName); |
| 1637 | 1638 | blob_appendf(pDesc, "user %s\n", |
| 1638 | 1639 | p->zUserOvrd ? p->zUserOvrd : login_name()); |
| 1639 | 1640 | blob_appendf(pDesc, "branch %s\n", |
| 1640 | - (p->zBranch && p->zBranch[0]) ? p->zBranch : "trunk"); | |
| 1641 | + (p->zBranch && p->zBranch[0]) ? p->zBranch : zMainBranch); | |
| 1641 | 1642 | zTags = info_tags_of_checkin(parent_rid, 1); |
| 1642 | 1643 | if( zTags || p->azTag ){ |
| 1643 | 1644 | blob_append(pDesc, "tags ", -1); |
| 1644 | 1645 | if(zTags){ |
| 1645 | 1646 | blob_appendf(pDesc, "%z%s", zTags, p->azTag ? ", " : ""); |
| @@ -1673,10 +1674,11 @@ | ||
| 1673 | 1674 | sqlite3_randomness(sizeof(r), r); |
| 1674 | 1675 | zFilename = mprintf("%scommit-description-%08x%08x.txt", |
| 1675 | 1676 | g.zLocalRoot, r[0], r[1]); |
| 1676 | 1677 | blob_write_to_file(pDesc, zFilename); |
| 1677 | 1678 | } |
| 1679 | + fossil_free(zMainBranch); | |
| 1678 | 1680 | blob_reset(pDesc); |
| 1679 | 1681 | return zFilename; |
| 1680 | 1682 | } |
| 1681 | 1683 | |
| 1682 | 1684 | |
| 1683 | 1685 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -1627,19 +1627,20 @@ | |
| 1627 | int dryRunFlag /* True for a dry-run only */ |
| 1628 | ){ |
| 1629 | Blob *pDesc; |
| 1630 | char *zTags; |
| 1631 | char *zFilename; |
| 1632 | Blob desc; |
| 1633 | blob_init(&desc, 0, 0); |
| 1634 | pDesc = &desc; |
| 1635 | blob_appendf(pDesc, "checkout %s\n", g.zLocalRoot); |
| 1636 | blob_appendf(pDesc, "repository %s\n", g.zRepositoryName); |
| 1637 | blob_appendf(pDesc, "user %s\n", |
| 1638 | p->zUserOvrd ? p->zUserOvrd : login_name()); |
| 1639 | blob_appendf(pDesc, "branch %s\n", |
| 1640 | (p->zBranch && p->zBranch[0]) ? p->zBranch : "trunk"); |
| 1641 | zTags = info_tags_of_checkin(parent_rid, 1); |
| 1642 | if( zTags || p->azTag ){ |
| 1643 | blob_append(pDesc, "tags ", -1); |
| 1644 | if(zTags){ |
| 1645 | blob_appendf(pDesc, "%z%s", zTags, p->azTag ? ", " : ""); |
| @@ -1673,10 +1674,11 @@ | |
| 1673 | sqlite3_randomness(sizeof(r), r); |
| 1674 | zFilename = mprintf("%scommit-description-%08x%08x.txt", |
| 1675 | g.zLocalRoot, r[0], r[1]); |
| 1676 | blob_write_to_file(pDesc, zFilename); |
| 1677 | } |
| 1678 | blob_reset(pDesc); |
| 1679 | return zFilename; |
| 1680 | } |
| 1681 | |
| 1682 | |
| 1683 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -1627,19 +1627,20 @@ | |
| 1627 | int dryRunFlag /* True for a dry-run only */ |
| 1628 | ){ |
| 1629 | Blob *pDesc; |
| 1630 | char *zTags; |
| 1631 | char *zFilename; |
| 1632 | char *zMainBranch = db_get("main-branch", 0); |
| 1633 | Blob desc; |
| 1634 | blob_init(&desc, 0, 0); |
| 1635 | pDesc = &desc; |
| 1636 | blob_appendf(pDesc, "checkout %s\n", g.zLocalRoot); |
| 1637 | blob_appendf(pDesc, "repository %s\n", g.zRepositoryName); |
| 1638 | blob_appendf(pDesc, "user %s\n", |
| 1639 | p->zUserOvrd ? p->zUserOvrd : login_name()); |
| 1640 | blob_appendf(pDesc, "branch %s\n", |
| 1641 | (p->zBranch && p->zBranch[0]) ? p->zBranch : zMainBranch); |
| 1642 | zTags = info_tags_of_checkin(parent_rid, 1); |
| 1643 | if( zTags || p->azTag ){ |
| 1644 | blob_append(pDesc, "tags ", -1); |
| 1645 | if(zTags){ |
| 1646 | blob_appendf(pDesc, "%z%s", zTags, p->azTag ? ", " : ""); |
| @@ -1673,10 +1674,11 @@ | |
| 1674 | sqlite3_randomness(sizeof(r), r); |
| 1675 | zFilename = mprintf("%scommit-description-%08x%08x.txt", |
| 1676 | g.zLocalRoot, r[0], r[1]); |
| 1677 | blob_write_to_file(pDesc, zFilename); |
| 1678 | } |
| 1679 | fossil_free(zMainBranch); |
| 1680 | blob_reset(pDesc); |
| 1681 | return zFilename; |
| 1682 | } |
| 1683 | |
| 1684 | |
| 1685 |
+1
-1
| --- src/checkout.c | ||
| +++ src/checkout.c | ||
| @@ -496,11 +496,11 @@ | ||
| 496 | 496 | verify_all_options(); |
| 497 | 497 | if( g.argc<3 || g.argc>4 ){ |
| 498 | 498 | usage("URL ?VERSION? ?OPTIONS?"); |
| 499 | 499 | } |
| 500 | 500 | zUrl = g.argv[2]; |
| 501 | - zVers = g.argc==4 ? g.argv[3] : "trunk"; | |
| 501 | + zVers = g.argc==4 ? g.argv[3] : db_get("main-branch", 0); | |
| 502 | 502 | |
| 503 | 503 | /* Parse the URL of the repository */ |
| 504 | 504 | url_parse(zUrl, 0); |
| 505 | 505 | |
| 506 | 506 | /* Construct an appropriate name for the destination directory */ |
| 507 | 507 |
| --- src/checkout.c | |
| +++ src/checkout.c | |
| @@ -496,11 +496,11 @@ | |
| 496 | verify_all_options(); |
| 497 | if( g.argc<3 || g.argc>4 ){ |
| 498 | usage("URL ?VERSION? ?OPTIONS?"); |
| 499 | } |
| 500 | zUrl = g.argv[2]; |
| 501 | zVers = g.argc==4 ? g.argv[3] : "trunk"; |
| 502 | |
| 503 | /* Parse the URL of the repository */ |
| 504 | url_parse(zUrl, 0); |
| 505 | |
| 506 | /* Construct an appropriate name for the destination directory */ |
| 507 |
| --- src/checkout.c | |
| +++ src/checkout.c | |
| @@ -496,11 +496,11 @@ | |
| 496 | verify_all_options(); |
| 497 | if( g.argc<3 || g.argc>4 ){ |
| 498 | usage("URL ?VERSION? ?OPTIONS?"); |
| 499 | } |
| 500 | zUrl = g.argv[2]; |
| 501 | zVers = g.argc==4 ? g.argv[3] : db_get("main-branch", 0); |
| 502 | |
| 503 | /* Parse the URL of the repository */ |
| 504 | url_parse(zUrl, 0); |
| 505 | |
| 506 | /* Construct an appropriate name for the destination directory */ |
| 507 |
+1
-1
| --- src/descendants.c | ||
| +++ src/descendants.c | ||
| @@ -437,11 +437,11 @@ | ||
| 437 | 437 | int multipleFlag = find_option("multiple","m",0)!=0; |
| 438 | 438 | const char *zWidth = find_option("width","W",1); |
| 439 | 439 | char *zLastBr = 0; |
| 440 | 440 | int n, width; |
| 441 | 441 | char zLineNo[10]; |
| 442 | - char * const zMainBranch = db_get("main-branch","trunk"); | |
| 442 | + char *zMainBranch = db_get("main-branch", 0); | |
| 443 | 443 | |
| 444 | 444 | if( multipleFlag ) byBranch = 1; |
| 445 | 445 | if( zWidth ){ |
| 446 | 446 | width = atoi(zWidth); |
| 447 | 447 | if( (width!=0) && (width<=39) ){ |
| 448 | 448 |
| --- src/descendants.c | |
| +++ src/descendants.c | |
| @@ -437,11 +437,11 @@ | |
| 437 | int multipleFlag = find_option("multiple","m",0)!=0; |
| 438 | const char *zWidth = find_option("width","W",1); |
| 439 | char *zLastBr = 0; |
| 440 | int n, width; |
| 441 | char zLineNo[10]; |
| 442 | char * const zMainBranch = db_get("main-branch","trunk"); |
| 443 | |
| 444 | if( multipleFlag ) byBranch = 1; |
| 445 | if( zWidth ){ |
| 446 | width = atoi(zWidth); |
| 447 | if( (width!=0) && (width<=39) ){ |
| 448 |
| --- src/descendants.c | |
| +++ src/descendants.c | |
| @@ -437,11 +437,11 @@ | |
| 437 | int multipleFlag = find_option("multiple","m",0)!=0; |
| 438 | const char *zWidth = find_option("width","W",1); |
| 439 | char *zLastBr = 0; |
| 440 | int n, width; |
| 441 | char zLineNo[10]; |
| 442 | char *zMainBranch = db_get("main-branch", 0); |
| 443 | |
| 444 | if( multipleFlag ) byBranch = 1; |
| 445 | if( zWidth ){ |
| 446 | width = atoi(zWidth); |
| 447 | if( (width!=0) && (width<=39) ){ |
| 448 |
+2
-1
| --- src/diff.c | ||
| +++ src/diff.c | ||
| @@ -3949,11 +3949,12 @@ | ||
| 3949 | 3949 | ** -n|--limit LIMIT LIMIT can be one of: |
| 3950 | 3950 | ** N Up to N versions |
| 3951 | 3951 | ** Xs As much as possible in X seconds |
| 3952 | 3952 | ** none No limit |
| 3953 | 3953 | ** -o|--origin VERSION The origin check-in. By default this is the |
| 3954 | -** root of the repository. Set to "trunk" or | |
| 3954 | +** root of the repository. Set to the name of | |
| 3955 | +** the main branch (usually "trunk") or | |
| 3955 | 3956 | ** similar for a reverse annotation. |
| 3956 | 3957 | ** -w|--ignore-all-space Ignore white space when comparing lines |
| 3957 | 3958 | ** -Z|--ignore-trailing-space Ignore whitespace at line end |
| 3958 | 3959 | ** |
| 3959 | 3960 | ** See also: [[info]], [[finfo]], [[timeline]] |
| 3960 | 3961 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -3949,11 +3949,12 @@ | |
| 3949 | ** -n|--limit LIMIT LIMIT can be one of: |
| 3950 | ** N Up to N versions |
| 3951 | ** Xs As much as possible in X seconds |
| 3952 | ** none No limit |
| 3953 | ** -o|--origin VERSION The origin check-in. By default this is the |
| 3954 | ** root of the repository. Set to "trunk" or |
| 3955 | ** similar for a reverse annotation. |
| 3956 | ** -w|--ignore-all-space Ignore white space when comparing lines |
| 3957 | ** -Z|--ignore-trailing-space Ignore whitespace at line end |
| 3958 | ** |
| 3959 | ** See also: [[info]], [[finfo]], [[timeline]] |
| 3960 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -3949,11 +3949,12 @@ | |
| 3949 | ** -n|--limit LIMIT LIMIT can be one of: |
| 3950 | ** N Up to N versions |
| 3951 | ** Xs As much as possible in X seconds |
| 3952 | ** none No limit |
| 3953 | ** -o|--origin VERSION The origin check-in. By default this is the |
| 3954 | ** root of the repository. Set to the name of |
| 3955 | ** the main branch (usually "trunk") or |
| 3956 | ** similar for a reverse annotation. |
| 3957 | ** -w|--ignore-all-space Ignore white space when comparing lines |
| 3958 | ** -Z|--ignore-trailing-space Ignore whitespace at line end |
| 3959 | ** |
| 3960 | ** See also: [[info]], [[finfo]], [[timeline]] |
| 3961 |
+11
-5
| --- src/export.c | ||
| +++ src/export.c | ||
| @@ -491,20 +491,21 @@ | ||
| 491 | 491 | Stmt q, q2, q3; |
| 492 | 492 | Bag blobs, vers; |
| 493 | 493 | unsigned int unused_mark = 1; |
| 494 | 494 | const char *markfile_in; |
| 495 | 495 | const char *markfile_out; |
| 496 | + char *zMainBranch = db_get("main-branch", 0); | |
| 496 | 497 | |
| 497 | 498 | bag_init(&blobs); |
| 498 | 499 | bag_init(&vers); |
| 499 | 500 | |
| 500 | 501 | find_option("git", 0, 0); /* Ignore the --git option for now */ |
| 501 | 502 | markfile_in = find_option("import-marks", 0, 1); |
| 502 | 503 | markfile_out = find_option("export-marks", 0, 1); |
| 503 | 504 | |
| 504 | 505 | if( !(gexport.zTrunkName = find_option("rename-trunk", 0, 1)) ){ |
| 505 | - gexport.zTrunkName = "trunk"; | |
| 506 | + gexport.zTrunkName = fossil_strdup(zMainBranch); | |
| 506 | 507 | } |
| 507 | 508 | |
| 508 | 509 | db_find_and_open_repository(0, 2); |
| 509 | 510 | verify_all_options(); |
| 510 | 511 | if( g.argc!=2 && g.argc!=3 ){ usage("--git ?REPOSITORY?"); } |
| @@ -542,10 +543,11 @@ | ||
| 542 | 543 | db_bind_int(&qc, ":rid", rid); |
| 543 | 544 | db_step(&qc); |
| 544 | 545 | db_reset(&qc); |
| 545 | 546 | }while((rid = bag_next(&vers, rid))!=0); |
| 546 | 547 | } |
| 548 | + fossil_free(zMainBranch); | |
| 547 | 549 | db_finalize(&qb); |
| 548 | 550 | db_finalize(&qc); |
| 549 | 551 | fclose(f); |
| 550 | 552 | } |
| 551 | 553 | |
| @@ -629,11 +631,11 @@ | ||
| 629 | 631 | |
| 630 | 632 | bag_insert(&vers, ckinId); |
| 631 | 633 | db_bind_int(&q2, ":rid", ckinId); |
| 632 | 634 | db_step(&q2); |
| 633 | 635 | db_reset(&q2); |
| 634 | - if( zBranch==0 || fossil_strcmp(zBranch, "trunk")==0 ){ | |
| 636 | + if( zBranch==0 || fossil_strcmp(zBranch, zMainBranch)==0 ){ | |
| 635 | 637 | zBranch = gexport.zTrunkName; |
| 636 | 638 | } |
| 637 | 639 | zMark = mark_name_from_rid(ckinId, &unused_mark); |
| 638 | 640 | printf("commit refs/heads/"); |
| 639 | 641 | print_ref(zBranch); |
| @@ -697,10 +699,11 @@ | ||
| 697 | 699 | } |
| 698 | 700 | db_finalize(&q4); |
| 699 | 701 | db_finalize(&q3); |
| 700 | 702 | printf("\n"); |
| 701 | 703 | } |
| 704 | + fossil_free(zMainBranch); | |
| 702 | 705 | db_finalize(&q2); |
| 703 | 706 | db_finalize(&q); |
| 704 | 707 | manifest_cache_clear(); |
| 705 | 708 | |
| 706 | 709 | |
| @@ -857,12 +860,12 @@ | ||
| 857 | 860 | #define VERB_ERROR 1 |
| 858 | 861 | #define VERB_NORMAL 2 |
| 859 | 862 | #define VERB_EXTRA 3 |
| 860 | 863 | static int gitmirror_verbosity = VERB_NORMAL; |
| 861 | 864 | |
| 862 | -/* The main branch in the Git repository. The "trunk" branch of | |
| 863 | -** Fossil is renamed to be this branch name. | |
| 865 | +/* The main branch in the Git repository. The main branch of the | |
| 866 | +** Fossil repository (usually "trunk") is renamed to be this branch name. | |
| 864 | 867 | */ |
| 865 | 868 | static const char *gitmirror_mainbranch = 0; |
| 866 | 869 | |
| 867 | 870 | /* |
| 868 | 871 | ** Output routine that depends on verbosity |
| @@ -1090,10 +1093,11 @@ | ||
| 1090 | 1093 | int bPhantomOk; /* True if phantom files should be ignored */ |
| 1091 | 1094 | char buf[24]; |
| 1092 | 1095 | char *zEmail; /* Contact info for Git committer field */ |
| 1093 | 1096 | int fManifest; /* Should the manifest files be included? */ |
| 1094 | 1097 | int fPManifest = 0; /* OR of the manifest files for all parents */ |
| 1098 | + char *zMainBranch; | |
| 1095 | 1099 | |
| 1096 | 1100 | pMan = manifest_get(rid, CFTYPE_MANIFEST, 0); |
| 1097 | 1101 | if( pMan==0 ){ |
| 1098 | 1102 | /* Must be a phantom. Return without doing anything, and in particular |
| 1099 | 1103 | ** without creating a mark for this check-in. */ |
| @@ -1149,11 +1153,12 @@ | ||
| 1149 | 1153 | /* Figure out which branch this check-in is a member of */ |
| 1150 | 1154 | zBranch = db_text(0, |
| 1151 | 1155 | "SELECT value FROM tagxref WHERE tagid=%d AND tagtype>0 AND rid=%d", |
| 1152 | 1156 | TAG_BRANCH, rid |
| 1153 | 1157 | ); |
| 1154 | - if( fossil_strcmp(zBranch,"trunk")==0 ){ | |
| 1158 | + zMainBranch = db_get("main-branch", 0); | |
| 1159 | + if( fossil_strcmp(zBranch, zMainBranch)==0 ){ | |
| 1155 | 1160 | assert( gitmirror_mainbranch!=0 ); |
| 1156 | 1161 | fossil_free(zBranch); |
| 1157 | 1162 | zBranch = fossil_strdup(gitmirror_mainbranch); |
| 1158 | 1163 | }else if( zBranch==0 ){ |
| 1159 | 1164 | zBranch = mprintf("unknown"); |
| @@ -1303,10 +1308,11 @@ | ||
| 1303 | 1308 | fprintf(xCmd, "D manifest.tags\n"); |
| 1304 | 1309 | } |
| 1305 | 1310 | |
| 1306 | 1311 | /* The check-in is finished, so decrement the counter */ |
| 1307 | 1312 | (*pnLimit)--; |
| 1313 | + fossil_free(zMainBranch); | |
| 1308 | 1314 | return 0; |
| 1309 | 1315 | } |
| 1310 | 1316 | |
| 1311 | 1317 | /* |
| 1312 | 1318 | ** Create a new Git repository at zMirror to use as the mirror. |
| 1313 | 1319 |
| --- src/export.c | |
| +++ src/export.c | |
| @@ -491,20 +491,21 @@ | |
| 491 | Stmt q, q2, q3; |
| 492 | Bag blobs, vers; |
| 493 | unsigned int unused_mark = 1; |
| 494 | const char *markfile_in; |
| 495 | const char *markfile_out; |
| 496 | |
| 497 | bag_init(&blobs); |
| 498 | bag_init(&vers); |
| 499 | |
| 500 | find_option("git", 0, 0); /* Ignore the --git option for now */ |
| 501 | markfile_in = find_option("import-marks", 0, 1); |
| 502 | markfile_out = find_option("export-marks", 0, 1); |
| 503 | |
| 504 | if( !(gexport.zTrunkName = find_option("rename-trunk", 0, 1)) ){ |
| 505 | gexport.zTrunkName = "trunk"; |
| 506 | } |
| 507 | |
| 508 | db_find_and_open_repository(0, 2); |
| 509 | verify_all_options(); |
| 510 | if( g.argc!=2 && g.argc!=3 ){ usage("--git ?REPOSITORY?"); } |
| @@ -542,10 +543,11 @@ | |
| 542 | db_bind_int(&qc, ":rid", rid); |
| 543 | db_step(&qc); |
| 544 | db_reset(&qc); |
| 545 | }while((rid = bag_next(&vers, rid))!=0); |
| 546 | } |
| 547 | db_finalize(&qb); |
| 548 | db_finalize(&qc); |
| 549 | fclose(f); |
| 550 | } |
| 551 | |
| @@ -629,11 +631,11 @@ | |
| 629 | |
| 630 | bag_insert(&vers, ckinId); |
| 631 | db_bind_int(&q2, ":rid", ckinId); |
| 632 | db_step(&q2); |
| 633 | db_reset(&q2); |
| 634 | if( zBranch==0 || fossil_strcmp(zBranch, "trunk")==0 ){ |
| 635 | zBranch = gexport.zTrunkName; |
| 636 | } |
| 637 | zMark = mark_name_from_rid(ckinId, &unused_mark); |
| 638 | printf("commit refs/heads/"); |
| 639 | print_ref(zBranch); |
| @@ -697,10 +699,11 @@ | |
| 697 | } |
| 698 | db_finalize(&q4); |
| 699 | db_finalize(&q3); |
| 700 | printf("\n"); |
| 701 | } |
| 702 | db_finalize(&q2); |
| 703 | db_finalize(&q); |
| 704 | manifest_cache_clear(); |
| 705 | |
| 706 | |
| @@ -857,12 +860,12 @@ | |
| 857 | #define VERB_ERROR 1 |
| 858 | #define VERB_NORMAL 2 |
| 859 | #define VERB_EXTRA 3 |
| 860 | static int gitmirror_verbosity = VERB_NORMAL; |
| 861 | |
| 862 | /* The main branch in the Git repository. The "trunk" branch of |
| 863 | ** Fossil is renamed to be this branch name. |
| 864 | */ |
| 865 | static const char *gitmirror_mainbranch = 0; |
| 866 | |
| 867 | /* |
| 868 | ** Output routine that depends on verbosity |
| @@ -1090,10 +1093,11 @@ | |
| 1090 | int bPhantomOk; /* True if phantom files should be ignored */ |
| 1091 | char buf[24]; |
| 1092 | char *zEmail; /* Contact info for Git committer field */ |
| 1093 | int fManifest; /* Should the manifest files be included? */ |
| 1094 | int fPManifest = 0; /* OR of the manifest files for all parents */ |
| 1095 | |
| 1096 | pMan = manifest_get(rid, CFTYPE_MANIFEST, 0); |
| 1097 | if( pMan==0 ){ |
| 1098 | /* Must be a phantom. Return without doing anything, and in particular |
| 1099 | ** without creating a mark for this check-in. */ |
| @@ -1149,11 +1153,12 @@ | |
| 1149 | /* Figure out which branch this check-in is a member of */ |
| 1150 | zBranch = db_text(0, |
| 1151 | "SELECT value FROM tagxref WHERE tagid=%d AND tagtype>0 AND rid=%d", |
| 1152 | TAG_BRANCH, rid |
| 1153 | ); |
| 1154 | if( fossil_strcmp(zBranch,"trunk")==0 ){ |
| 1155 | assert( gitmirror_mainbranch!=0 ); |
| 1156 | fossil_free(zBranch); |
| 1157 | zBranch = fossil_strdup(gitmirror_mainbranch); |
| 1158 | }else if( zBranch==0 ){ |
| 1159 | zBranch = mprintf("unknown"); |
| @@ -1303,10 +1308,11 @@ | |
| 1303 | fprintf(xCmd, "D manifest.tags\n"); |
| 1304 | } |
| 1305 | |
| 1306 | /* The check-in is finished, so decrement the counter */ |
| 1307 | (*pnLimit)--; |
| 1308 | return 0; |
| 1309 | } |
| 1310 | |
| 1311 | /* |
| 1312 | ** Create a new Git repository at zMirror to use as the mirror. |
| 1313 |
| --- src/export.c | |
| +++ src/export.c | |
| @@ -491,20 +491,21 @@ | |
| 491 | Stmt q, q2, q3; |
| 492 | Bag blobs, vers; |
| 493 | unsigned int unused_mark = 1; |
| 494 | const char *markfile_in; |
| 495 | const char *markfile_out; |
| 496 | char *zMainBranch = db_get("main-branch", 0); |
| 497 | |
| 498 | bag_init(&blobs); |
| 499 | bag_init(&vers); |
| 500 | |
| 501 | find_option("git", 0, 0); /* Ignore the --git option for now */ |
| 502 | markfile_in = find_option("import-marks", 0, 1); |
| 503 | markfile_out = find_option("export-marks", 0, 1); |
| 504 | |
| 505 | if( !(gexport.zTrunkName = find_option("rename-trunk", 0, 1)) ){ |
| 506 | gexport.zTrunkName = fossil_strdup(zMainBranch); |
| 507 | } |
| 508 | |
| 509 | db_find_and_open_repository(0, 2); |
| 510 | verify_all_options(); |
| 511 | if( g.argc!=2 && g.argc!=3 ){ usage("--git ?REPOSITORY?"); } |
| @@ -542,10 +543,11 @@ | |
| 543 | db_bind_int(&qc, ":rid", rid); |
| 544 | db_step(&qc); |
| 545 | db_reset(&qc); |
| 546 | }while((rid = bag_next(&vers, rid))!=0); |
| 547 | } |
| 548 | fossil_free(zMainBranch); |
| 549 | db_finalize(&qb); |
| 550 | db_finalize(&qc); |
| 551 | fclose(f); |
| 552 | } |
| 553 | |
| @@ -629,11 +631,11 @@ | |
| 631 | |
| 632 | bag_insert(&vers, ckinId); |
| 633 | db_bind_int(&q2, ":rid", ckinId); |
| 634 | db_step(&q2); |
| 635 | db_reset(&q2); |
| 636 | if( zBranch==0 || fossil_strcmp(zBranch, zMainBranch)==0 ){ |
| 637 | zBranch = gexport.zTrunkName; |
| 638 | } |
| 639 | zMark = mark_name_from_rid(ckinId, &unused_mark); |
| 640 | printf("commit refs/heads/"); |
| 641 | print_ref(zBranch); |
| @@ -697,10 +699,11 @@ | |
| 699 | } |
| 700 | db_finalize(&q4); |
| 701 | db_finalize(&q3); |
| 702 | printf("\n"); |
| 703 | } |
| 704 | fossil_free(zMainBranch); |
| 705 | db_finalize(&q2); |
| 706 | db_finalize(&q); |
| 707 | manifest_cache_clear(); |
| 708 | |
| 709 | |
| @@ -857,12 +860,12 @@ | |
| 860 | #define VERB_ERROR 1 |
| 861 | #define VERB_NORMAL 2 |
| 862 | #define VERB_EXTRA 3 |
| 863 | static int gitmirror_verbosity = VERB_NORMAL; |
| 864 | |
| 865 | /* The main branch in the Git repository. The main branch of the |
| 866 | ** Fossil repository (usually "trunk") is renamed to be this branch name. |
| 867 | */ |
| 868 | static const char *gitmirror_mainbranch = 0; |
| 869 | |
| 870 | /* |
| 871 | ** Output routine that depends on verbosity |
| @@ -1090,10 +1093,11 @@ | |
| 1093 | int bPhantomOk; /* True if phantom files should be ignored */ |
| 1094 | char buf[24]; |
| 1095 | char *zEmail; /* Contact info for Git committer field */ |
| 1096 | int fManifest; /* Should the manifest files be included? */ |
| 1097 | int fPManifest = 0; /* OR of the manifest files for all parents */ |
| 1098 | char *zMainBranch; |
| 1099 | |
| 1100 | pMan = manifest_get(rid, CFTYPE_MANIFEST, 0); |
| 1101 | if( pMan==0 ){ |
| 1102 | /* Must be a phantom. Return without doing anything, and in particular |
| 1103 | ** without creating a mark for this check-in. */ |
| @@ -1149,11 +1153,12 @@ | |
| 1153 | /* Figure out which branch this check-in is a member of */ |
| 1154 | zBranch = db_text(0, |
| 1155 | "SELECT value FROM tagxref WHERE tagid=%d AND tagtype>0 AND rid=%d", |
| 1156 | TAG_BRANCH, rid |
| 1157 | ); |
| 1158 | zMainBranch = db_get("main-branch", 0); |
| 1159 | if( fossil_strcmp(zBranch, zMainBranch)==0 ){ |
| 1160 | assert( gitmirror_mainbranch!=0 ); |
| 1161 | fossil_free(zBranch); |
| 1162 | zBranch = fossil_strdup(gitmirror_mainbranch); |
| 1163 | }else if( zBranch==0 ){ |
| 1164 | zBranch = mprintf("unknown"); |
| @@ -1303,10 +1308,11 @@ | |
| 1308 | fprintf(xCmd, "D manifest.tags\n"); |
| 1309 | } |
| 1310 | |
| 1311 | /* The check-in is finished, so decrement the counter */ |
| 1312 | (*pnLimit)--; |
| 1313 | fossil_free(zMainBranch); |
| 1314 | return 0; |
| 1315 | } |
| 1316 | |
| 1317 | /* |
| 1318 | ** Create a new Git repository at zMirror to use as the mirror. |
| 1319 |
+1
-1
| --- src/fileedit.c | ||
| +++ src/fileedit.c | ||
| @@ -833,11 +833,11 @@ | ||
| 833 | 833 | } |
| 834 | 834 | if(zRevision==0 || zRevision[0]==0){ |
| 835 | 835 | if(g.localOpen/*check-out*/){ |
| 836 | 836 | zRevision = db_lget("checkout-hash", 0)/*leak*/; |
| 837 | 837 | }else{ |
| 838 | - zRevision = "trunk"; | |
| 838 | + zRevision = db_get("main-branch", 0); | |
| 839 | 839 | } |
| 840 | 840 | } |
| 841 | 841 | name_to_uuid2(zRevision, "ci", &cimi.zParentUuid); |
| 842 | 842 | if(cimi.zParentUuid==0){ |
| 843 | 843 | fossil_fatal("Cannot determine version to commit to."); |
| 844 | 844 |
| --- src/fileedit.c | |
| +++ src/fileedit.c | |
| @@ -833,11 +833,11 @@ | |
| 833 | } |
| 834 | if(zRevision==0 || zRevision[0]==0){ |
| 835 | if(g.localOpen/*check-out*/){ |
| 836 | zRevision = db_lget("checkout-hash", 0)/*leak*/; |
| 837 | }else{ |
| 838 | zRevision = "trunk"; |
| 839 | } |
| 840 | } |
| 841 | name_to_uuid2(zRevision, "ci", &cimi.zParentUuid); |
| 842 | if(cimi.zParentUuid==0){ |
| 843 | fossil_fatal("Cannot determine version to commit to."); |
| 844 |
| --- src/fileedit.c | |
| +++ src/fileedit.c | |
| @@ -833,11 +833,11 @@ | |
| 833 | } |
| 834 | if(zRevision==0 || zRevision[0]==0){ |
| 835 | if(g.localOpen/*check-out*/){ |
| 836 | zRevision = db_lget("checkout-hash", 0)/*leak*/; |
| 837 | }else{ |
| 838 | zRevision = db_get("main-branch", 0); |
| 839 | } |
| 840 | } |
| 841 | name_to_uuid2(zRevision, "ci", &cimi.zParentUuid); |
| 842 | if(cimi.zParentUuid==0){ |
| 843 | fossil_fatal("Cannot determine version to commit to."); |
| 844 |
+7
-3
| --- src/finfo.c | ||
| +++ src/finfo.c | ||
| @@ -176,10 +176,11 @@ | ||
| 176 | 176 | const char *zFilename; |
| 177 | 177 | const char *zLimit; |
| 178 | 178 | const char *zWidth; |
| 179 | 179 | const char *zOffset; |
| 180 | 180 | int iLimit, iOffset, iBrief, iWidth; |
| 181 | + char *zMainBranch = db_get("main-branch", 0); | |
| 181 | 182 | |
| 182 | 183 | if( find_option("log","l",0) ){ |
| 183 | 184 | /* this is the default, no-op */ |
| 184 | 185 | } |
| 185 | 186 | zLimit = find_option("limit","n",1); |
| @@ -239,11 +240,11 @@ | ||
| 239 | 240 | const char *zDate = db_column_text(&q, 2); |
| 240 | 241 | const char *zCom = db_column_text(&q, 3); |
| 241 | 242 | const char *zUser = db_column_text(&q, 4); |
| 242 | 243 | const char *zBr = db_column_text(&q, 5); |
| 243 | 244 | char *zOut; |
| 244 | - if( zBr==0 ) zBr = "trunk"; | |
| 245 | + if( zBr==0 ) zBr = fossil_strdup(zMainBranch); | |
| 245 | 246 | if( iBrief == 0 ){ |
| 246 | 247 | fossil_print("%s ", zDate); |
| 247 | 248 | zOut = mprintf( |
| 248 | 249 | "[%S] %s (user: %s, artifact: [%S], branch: %s)", |
| 249 | 250 | zCiUuid, zCom, zUser, zFileUuid, zBr); |
| @@ -257,10 +258,11 @@ | ||
| 257 | 258 | blob_appendf(&line, "%8.8s ", zBr); |
| 258 | 259 | blob_appendf(&line,"%-39.39s", zCom ); |
| 259 | 260 | comment_print(blob_str(&line), zCom, 0, iWidth, get_comment_format()); |
| 260 | 261 | } |
| 261 | 262 | } |
| 263 | + fossil_free(zMainBranch); | |
| 262 | 264 | db_finalize(&q); |
| 263 | 265 | blob_reset(&fname); |
| 264 | 266 | } |
| 265 | 267 | } |
| 266 | 268 | |
| @@ -376,10 +378,11 @@ | ||
| 376 | 378 | int tmFlags = 0; /* Viewing mode */ |
| 377 | 379 | const char *zStyle; /* Viewing mode name */ |
| 378 | 380 | const char *zMark; /* Mark this version of the file */ |
| 379 | 381 | int selRid = 0; /* RID of the marked file version */ |
| 380 | 382 | int mxfnid; /* Maximum filename.fnid value */ |
| 383 | + char *zMainBranch = db_get("main-branch", 0); | |
| 381 | 384 | |
| 382 | 385 | login_check_credentials(); |
| 383 | 386 | if( !g.perm.Read ){ login_needed(g.anon.Read); return; } |
| 384 | 387 | fnid = db_int(0, "SELECT fnid FROM filename WHERE name=%Q", zFilename); |
| 385 | 388 | ridCi = zCI ? name_to_rid_www("ci") : 0; |
| @@ -633,15 +636,15 @@ | ||
| 633 | 636 | while( db_step(&qparent)==SQLITE_ROW && nParent<count(aParent) ){ |
| 634 | 637 | aParent[nParent] = db_column_int64(&qparent, 0); |
| 635 | 638 | nParent++; |
| 636 | 639 | } |
| 637 | 640 | db_reset(&qparent); |
| 638 | - if( zBr==0 ) zBr = "trunk"; | |
| 641 | + if( zBr==0 ) zBr = fossil_strdup(zMainBranch); | |
| 639 | 642 | if( uBg ){ |
| 640 | 643 | zBgClr = user_color(zUser); |
| 641 | 644 | }else if( brBg || zBgClr==0 || zBgClr[0]==0 ){ |
| 642 | - zBgClr = strcmp(zBr,"trunk")==0 ? "" : hash_color(zBr); | |
| 645 | + zBgClr = strcmp(zBr, zMainBranch)==0 ? "" : hash_color(zBr); | |
| 643 | 646 | }else if( zBgClr ){ |
| 644 | 647 | zBgClr = reasonable_bg_color(zBgClr,0); |
| 645 | 648 | } |
| 646 | 649 | gidx = graph_add_row(pGraph, |
| 647 | 650 | frid>0 ? (GraphRowId)frid*(mxfnid+1)+fnid : fpid+1000000000, |
| @@ -807,10 +810,11 @@ | ||
| 807 | 810 | }else{ |
| 808 | 811 | @ )</span> |
| 809 | 812 | } |
| 810 | 813 | @ </td></tr> |
| 811 | 814 | } |
| 815 | + fossil_free(zMainBranch); | |
| 812 | 816 | db_finalize(&q); |
| 813 | 817 | db_finalize(&qparent); |
| 814 | 818 | if( pGraph ){ |
| 815 | 819 | graph_finish(pGraph, 0, TIMELINE_DISJOINT); |
| 816 | 820 | if( pGraph->nErr ){ |
| 817 | 821 |
| --- src/finfo.c | |
| +++ src/finfo.c | |
| @@ -176,10 +176,11 @@ | |
| 176 | const char *zFilename; |
| 177 | const char *zLimit; |
| 178 | const char *zWidth; |
| 179 | const char *zOffset; |
| 180 | int iLimit, iOffset, iBrief, iWidth; |
| 181 | |
| 182 | if( find_option("log","l",0) ){ |
| 183 | /* this is the default, no-op */ |
| 184 | } |
| 185 | zLimit = find_option("limit","n",1); |
| @@ -239,11 +240,11 @@ | |
| 239 | const char *zDate = db_column_text(&q, 2); |
| 240 | const char *zCom = db_column_text(&q, 3); |
| 241 | const char *zUser = db_column_text(&q, 4); |
| 242 | const char *zBr = db_column_text(&q, 5); |
| 243 | char *zOut; |
| 244 | if( zBr==0 ) zBr = "trunk"; |
| 245 | if( iBrief == 0 ){ |
| 246 | fossil_print("%s ", zDate); |
| 247 | zOut = mprintf( |
| 248 | "[%S] %s (user: %s, artifact: [%S], branch: %s)", |
| 249 | zCiUuid, zCom, zUser, zFileUuid, zBr); |
| @@ -257,10 +258,11 @@ | |
| 257 | blob_appendf(&line, "%8.8s ", zBr); |
| 258 | blob_appendf(&line,"%-39.39s", zCom ); |
| 259 | comment_print(blob_str(&line), zCom, 0, iWidth, get_comment_format()); |
| 260 | } |
| 261 | } |
| 262 | db_finalize(&q); |
| 263 | blob_reset(&fname); |
| 264 | } |
| 265 | } |
| 266 | |
| @@ -376,10 +378,11 @@ | |
| 376 | int tmFlags = 0; /* Viewing mode */ |
| 377 | const char *zStyle; /* Viewing mode name */ |
| 378 | const char *zMark; /* Mark this version of the file */ |
| 379 | int selRid = 0; /* RID of the marked file version */ |
| 380 | int mxfnid; /* Maximum filename.fnid value */ |
| 381 | |
| 382 | login_check_credentials(); |
| 383 | if( !g.perm.Read ){ login_needed(g.anon.Read); return; } |
| 384 | fnid = db_int(0, "SELECT fnid FROM filename WHERE name=%Q", zFilename); |
| 385 | ridCi = zCI ? name_to_rid_www("ci") : 0; |
| @@ -633,15 +636,15 @@ | |
| 633 | while( db_step(&qparent)==SQLITE_ROW && nParent<count(aParent) ){ |
| 634 | aParent[nParent] = db_column_int64(&qparent, 0); |
| 635 | nParent++; |
| 636 | } |
| 637 | db_reset(&qparent); |
| 638 | if( zBr==0 ) zBr = "trunk"; |
| 639 | if( uBg ){ |
| 640 | zBgClr = user_color(zUser); |
| 641 | }else if( brBg || zBgClr==0 || zBgClr[0]==0 ){ |
| 642 | zBgClr = strcmp(zBr,"trunk")==0 ? "" : hash_color(zBr); |
| 643 | }else if( zBgClr ){ |
| 644 | zBgClr = reasonable_bg_color(zBgClr,0); |
| 645 | } |
| 646 | gidx = graph_add_row(pGraph, |
| 647 | frid>0 ? (GraphRowId)frid*(mxfnid+1)+fnid : fpid+1000000000, |
| @@ -807,10 +810,11 @@ | |
| 807 | }else{ |
| 808 | @ )</span> |
| 809 | } |
| 810 | @ </td></tr> |
| 811 | } |
| 812 | db_finalize(&q); |
| 813 | db_finalize(&qparent); |
| 814 | if( pGraph ){ |
| 815 | graph_finish(pGraph, 0, TIMELINE_DISJOINT); |
| 816 | if( pGraph->nErr ){ |
| 817 |
| --- src/finfo.c | |
| +++ src/finfo.c | |
| @@ -176,10 +176,11 @@ | |
| 176 | const char *zFilename; |
| 177 | const char *zLimit; |
| 178 | const char *zWidth; |
| 179 | const char *zOffset; |
| 180 | int iLimit, iOffset, iBrief, iWidth; |
| 181 | char *zMainBranch = db_get("main-branch", 0); |
| 182 | |
| 183 | if( find_option("log","l",0) ){ |
| 184 | /* this is the default, no-op */ |
| 185 | } |
| 186 | zLimit = find_option("limit","n",1); |
| @@ -239,11 +240,11 @@ | |
| 240 | const char *zDate = db_column_text(&q, 2); |
| 241 | const char *zCom = db_column_text(&q, 3); |
| 242 | const char *zUser = db_column_text(&q, 4); |
| 243 | const char *zBr = db_column_text(&q, 5); |
| 244 | char *zOut; |
| 245 | if( zBr==0 ) zBr = fossil_strdup(zMainBranch); |
| 246 | if( iBrief == 0 ){ |
| 247 | fossil_print("%s ", zDate); |
| 248 | zOut = mprintf( |
| 249 | "[%S] %s (user: %s, artifact: [%S], branch: %s)", |
| 250 | zCiUuid, zCom, zUser, zFileUuid, zBr); |
| @@ -257,10 +258,11 @@ | |
| 258 | blob_appendf(&line, "%8.8s ", zBr); |
| 259 | blob_appendf(&line,"%-39.39s", zCom ); |
| 260 | comment_print(blob_str(&line), zCom, 0, iWidth, get_comment_format()); |
| 261 | } |
| 262 | } |
| 263 | fossil_free(zMainBranch); |
| 264 | db_finalize(&q); |
| 265 | blob_reset(&fname); |
| 266 | } |
| 267 | } |
| 268 | |
| @@ -376,10 +378,11 @@ | |
| 378 | int tmFlags = 0; /* Viewing mode */ |
| 379 | const char *zStyle; /* Viewing mode name */ |
| 380 | const char *zMark; /* Mark this version of the file */ |
| 381 | int selRid = 0; /* RID of the marked file version */ |
| 382 | int mxfnid; /* Maximum filename.fnid value */ |
| 383 | char *zMainBranch = db_get("main-branch", 0); |
| 384 | |
| 385 | login_check_credentials(); |
| 386 | if( !g.perm.Read ){ login_needed(g.anon.Read); return; } |
| 387 | fnid = db_int(0, "SELECT fnid FROM filename WHERE name=%Q", zFilename); |
| 388 | ridCi = zCI ? name_to_rid_www("ci") : 0; |
| @@ -633,15 +636,15 @@ | |
| 636 | while( db_step(&qparent)==SQLITE_ROW && nParent<count(aParent) ){ |
| 637 | aParent[nParent] = db_column_int64(&qparent, 0); |
| 638 | nParent++; |
| 639 | } |
| 640 | db_reset(&qparent); |
| 641 | if( zBr==0 ) zBr = fossil_strdup(zMainBranch); |
| 642 | if( uBg ){ |
| 643 | zBgClr = user_color(zUser); |
| 644 | }else if( brBg || zBgClr==0 || zBgClr[0]==0 ){ |
| 645 | zBgClr = strcmp(zBr, zMainBranch)==0 ? "" : hash_color(zBr); |
| 646 | }else if( zBgClr ){ |
| 647 | zBgClr = reasonable_bg_color(zBgClr,0); |
| 648 | } |
| 649 | gidx = graph_add_row(pGraph, |
| 650 | frid>0 ? (GraphRowId)frid*(mxfnid+1)+fnid : fpid+1000000000, |
| @@ -807,10 +810,11 @@ | |
| 810 | }else{ |
| 811 | @ )</span> |
| 812 | } |
| 813 | @ </td></tr> |
| 814 | } |
| 815 | fossil_free(zMainBranch); |
| 816 | db_finalize(&q); |
| 817 | db_finalize(&qparent); |
| 818 | if( pGraph ){ |
| 819 | graph_finish(pGraph, 0, TIMELINE_DISJOINT); |
| 820 | if( pGraph->nErr ){ |
| 821 |
+5
-2
| --- src/graph.c | ||
| +++ src/graph.c | ||
| @@ -513,10 +513,11 @@ | ||
| 513 | 513 | GraphRow *pRow, *pDesc, *pDup, *pLoop, *pParent; |
| 514 | 514 | int i, j; |
| 515 | 515 | u64 mask; |
| 516 | 516 | int hasDup = 0; /* True if one or more isDup entries */ |
| 517 | 517 | const char *zTrunk; |
| 518 | + char *zMainBranch; | |
| 518 | 519 | u8 *aMap; /* Copy of p->aiRailMap */ |
| 519 | 520 | int omitDescenders = (tmFlags & TIMELINE_DISJOINT)!=0; |
| 520 | 521 | int nTimewarp = 0; |
| 521 | 522 | int riserMargin = (tmFlags & TIMELINE_DISJOINT) ? 0 : RISER_MARGIN; |
| 522 | 523 | |
| @@ -706,13 +707,15 @@ | ||
| 706 | 707 | } |
| 707 | 708 | |
| 708 | 709 | /* Identify rows where the primary parent is off screen. Assign |
| 709 | 710 | ** each to a rail and draw descenders downward. |
| 710 | 711 | ** |
| 711 | - ** Strive to put the "trunk" branch on far left. | |
| 712 | + ** Strive to put the main branch (usually "trunk") on far left. | |
| 712 | 713 | */ |
| 713 | - zTrunk = persistBranchName(p, "trunk"); | |
| 714 | + zMainBranch = db_get("main-branch", 0); | |
| 715 | + zTrunk = persistBranchName(p, zMainBranch); | |
| 716 | + fossil_free(zMainBranch); | |
| 714 | 717 | for(i=0; i<2; i++){ |
| 715 | 718 | for(pRow=p->pLast; pRow; pRow=pRow->pPrev){ |
| 716 | 719 | if( i==0 && pRow->zBranch!=zTrunk ) continue; |
| 717 | 720 | if( pRow->iRail>=0 ) continue; |
| 718 | 721 | if( pRow->isDup ) continue; |
| 719 | 722 |
| --- src/graph.c | |
| +++ src/graph.c | |
| @@ -513,10 +513,11 @@ | |
| 513 | GraphRow *pRow, *pDesc, *pDup, *pLoop, *pParent; |
| 514 | int i, j; |
| 515 | u64 mask; |
| 516 | int hasDup = 0; /* True if one or more isDup entries */ |
| 517 | const char *zTrunk; |
| 518 | u8 *aMap; /* Copy of p->aiRailMap */ |
| 519 | int omitDescenders = (tmFlags & TIMELINE_DISJOINT)!=0; |
| 520 | int nTimewarp = 0; |
| 521 | int riserMargin = (tmFlags & TIMELINE_DISJOINT) ? 0 : RISER_MARGIN; |
| 522 | |
| @@ -706,13 +707,15 @@ | |
| 706 | } |
| 707 | |
| 708 | /* Identify rows where the primary parent is off screen. Assign |
| 709 | ** each to a rail and draw descenders downward. |
| 710 | ** |
| 711 | ** Strive to put the "trunk" branch on far left. |
| 712 | */ |
| 713 | zTrunk = persistBranchName(p, "trunk"); |
| 714 | for(i=0; i<2; i++){ |
| 715 | for(pRow=p->pLast; pRow; pRow=pRow->pPrev){ |
| 716 | if( i==0 && pRow->zBranch!=zTrunk ) continue; |
| 717 | if( pRow->iRail>=0 ) continue; |
| 718 | if( pRow->isDup ) continue; |
| 719 |
| --- src/graph.c | |
| +++ src/graph.c | |
| @@ -513,10 +513,11 @@ | |
| 513 | GraphRow *pRow, *pDesc, *pDup, *pLoop, *pParent; |
| 514 | int i, j; |
| 515 | u64 mask; |
| 516 | int hasDup = 0; /* True if one or more isDup entries */ |
| 517 | const char *zTrunk; |
| 518 | char *zMainBranch; |
| 519 | u8 *aMap; /* Copy of p->aiRailMap */ |
| 520 | int omitDescenders = (tmFlags & TIMELINE_DISJOINT)!=0; |
| 521 | int nTimewarp = 0; |
| 522 | int riserMargin = (tmFlags & TIMELINE_DISJOINT) ? 0 : RISER_MARGIN; |
| 523 | |
| @@ -706,13 +707,15 @@ | |
| 707 | } |
| 708 | |
| 709 | /* Identify rows where the primary parent is off screen. Assign |
| 710 | ** each to a rail and draw descenders downward. |
| 711 | ** |
| 712 | ** Strive to put the main branch (usually "trunk") on far left. |
| 713 | */ |
| 714 | zMainBranch = db_get("main-branch", 0); |
| 715 | zTrunk = persistBranchName(p, zMainBranch); |
| 716 | fossil_free(zMainBranch); |
| 717 | for(i=0; i<2; i++){ |
| 718 | for(pRow=p->pLast; pRow; pRow=pRow->pPrev){ |
| 719 | if( i==0 && pRow->zBranch!=zTrunk ) continue; |
| 720 | if( pRow->iRail>=0 ) continue; |
| 721 | if( pRow->isDup ) continue; |
| 722 |
+9
-5
| --- src/import.c | ||
| +++ src/import.c | ||
| @@ -568,12 +568,12 @@ | ||
| 568 | 568 | ** |
| 569 | 569 | ** (A) refs/heads/BRANCHNAME |
| 570 | 570 | ** (B) refs/tags/TAGNAME |
| 571 | 571 | ** |
| 572 | 572 | ** If pattern A is used, then the branchname used is as shown. |
| 573 | - ** Except, the "master" branch which is the default branch name in | |
| 574 | - ** Git is changed to "trunk" which is the default name in Fossil. | |
| 573 | + ** Except, the "master" branch which is the default branch name in Git | |
| 574 | + ** is changed to the default main branch name in Fossil (usually "trunk") | |
| 575 | 575 | ** If the pattern is B, then the new commit should be on the same |
| 576 | 576 | ** branch as its parent. And, we might need to add the TAGNAME |
| 577 | 577 | ** tag to the new commit. However, if there are multiple instances |
| 578 | 578 | ** of pattern B with the same TAGNAME, then only put the tag on the |
| 579 | 579 | ** last commit that holds that tag. |
| @@ -1263,10 +1263,11 @@ | ||
| 1263 | 1263 | ** Return 0 if not a branch, tag, or trunk, or if ignored by --ignore-tree. |
| 1264 | 1264 | */ |
| 1265 | 1265 | static int svn_parse_path(char *zPath, char **zFile, int *type){ |
| 1266 | 1266 | char *zBranch = 0; |
| 1267 | 1267 | int branchId = 0; |
| 1268 | + char *zMainBranch = db_get("main-branch", 0); | |
| 1268 | 1269 | if( gsvn.azIgnTree ){ |
| 1269 | 1270 | const char **pzIgnTree; |
| 1270 | 1271 | unsigned nPath = strlen(zPath); |
| 1271 | 1272 | for( pzIgnTree = gsvn.azIgnTree; *pzIgnTree; ++pzIgnTree ){ |
| 1272 | 1273 | const char *zIgn = *pzIgnTree; |
| @@ -1278,17 +1279,17 @@ | ||
| 1278 | 1279 | } |
| 1279 | 1280 | } |
| 1280 | 1281 | *type = SVN_UNKNOWN; |
| 1281 | 1282 | *zFile = 0; |
| 1282 | 1283 | if( gsvn.lenTrunk==0 ){ |
| 1283 | - zBranch = "trunk"; | |
| 1284 | + zBranch = fossil_strdup(zMainBranch); | |
| 1284 | 1285 | *zFile = zPath; |
| 1285 | 1286 | *type = SVN_TRUNK; |
| 1286 | 1287 | }else |
| 1287 | 1288 | if( strncmp(zPath, gsvn.zTrunk, gsvn.lenTrunk-1)==0 ){ |
| 1288 | 1289 | if( zPath[gsvn.lenTrunk-1]=='/' || zPath[gsvn.lenTrunk-1]==0 ){ |
| 1289 | - zBranch = "trunk"; | |
| 1290 | + zBranch = fossil_strdup(zMainBranch); | |
| 1290 | 1291 | *zFile = zPath+gsvn.lenTrunk; |
| 1291 | 1292 | *type = SVN_TRUNK; |
| 1292 | 1293 | }else{ |
| 1293 | 1294 | zBranch = 0; |
| 1294 | 1295 | *type = SVN_UNKNOWN; |
| @@ -1318,10 +1319,11 @@ | ||
| 1318 | 1319 | db_multi_exec("INSERT INTO xbranches (tname, ttype) VALUES(%Q, %d)", |
| 1319 | 1320 | zBranch, *type); |
| 1320 | 1321 | branchId = db_last_insert_rowid(); |
| 1321 | 1322 | } |
| 1322 | 1323 | } |
| 1324 | + fossil_free(zMainBranch); | |
| 1323 | 1325 | return branchId; |
| 1324 | 1326 | } |
| 1325 | 1327 | |
| 1326 | 1328 | /* |
| 1327 | 1329 | ** Insert content of corresponding content blob into the database. |
| @@ -1727,10 +1729,11 @@ | ||
| 1727 | 1729 | int svnFlag = find_option("svn", 0, 0)!=0; |
| 1728 | 1730 | int gitFlag = find_option("git", 0, 0)!=0; |
| 1729 | 1731 | int omitRebuild = find_option("no-rebuild",0,0)!=0; |
| 1730 | 1732 | int omitVacuum = find_option("no-vacuum",0,0)!=0; |
| 1731 | 1733 | const char *zDefaultUser = find_option("admin-user","A",1); |
| 1734 | + char *zMainBranch = db_get("main-branch", 0); | |
| 1732 | 1735 | |
| 1733 | 1736 | /* Options common to all input formats */ |
| 1734 | 1737 | int incrFlag = find_option("incremental", "i", 0)!=0; |
| 1735 | 1738 | |
| 1736 | 1739 | /* Options for --svn only */ |
| @@ -1770,11 +1773,11 @@ | ||
| 1770 | 1773 | *renOpt->varSuf = renOpt->zDefaultSuf; |
| 1771 | 1774 | } |
| 1772 | 1775 | } |
| 1773 | 1776 | } |
| 1774 | 1777 | if( !(gimport.zTrunkName = find_option("rename-trunk", 0, 1)) ){ |
| 1775 | - gimport.zTrunkName = "trunk"; | |
| 1778 | + gimport.zTrunkName = fossil_strdup(zMainBranch); | |
| 1776 | 1779 | } |
| 1777 | 1780 | |
| 1778 | 1781 | if( svnFlag ){ |
| 1779 | 1782 | /* Get --svn related options here, so verify_all_options() fails when |
| 1780 | 1783 | * svn-only options are specified with --git |
| @@ -2024,6 +2027,7 @@ | ||
| 2024 | 2027 | fossil_print("server-id: %s\n", db_get("server-code", 0)); |
| 2025 | 2028 | zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin); |
| 2026 | 2029 | fossil_print("admin-user: %s (password is \"%s\")\n", g.zLogin, zPassword); |
| 2027 | 2030 | hash_user_password(g.zLogin); |
| 2028 | 2031 | } |
| 2032 | + fossil_free(zMainBranch); | |
| 2029 | 2033 | } |
| 2030 | 2034 |
| --- src/import.c | |
| +++ src/import.c | |
| @@ -568,12 +568,12 @@ | |
| 568 | ** |
| 569 | ** (A) refs/heads/BRANCHNAME |
| 570 | ** (B) refs/tags/TAGNAME |
| 571 | ** |
| 572 | ** If pattern A is used, then the branchname used is as shown. |
| 573 | ** Except, the "master" branch which is the default branch name in |
| 574 | ** Git is changed to "trunk" which is the default name in Fossil. |
| 575 | ** If the pattern is B, then the new commit should be on the same |
| 576 | ** branch as its parent. And, we might need to add the TAGNAME |
| 577 | ** tag to the new commit. However, if there are multiple instances |
| 578 | ** of pattern B with the same TAGNAME, then only put the tag on the |
| 579 | ** last commit that holds that tag. |
| @@ -1263,10 +1263,11 @@ | |
| 1263 | ** Return 0 if not a branch, tag, or trunk, or if ignored by --ignore-tree. |
| 1264 | */ |
| 1265 | static int svn_parse_path(char *zPath, char **zFile, int *type){ |
| 1266 | char *zBranch = 0; |
| 1267 | int branchId = 0; |
| 1268 | if( gsvn.azIgnTree ){ |
| 1269 | const char **pzIgnTree; |
| 1270 | unsigned nPath = strlen(zPath); |
| 1271 | for( pzIgnTree = gsvn.azIgnTree; *pzIgnTree; ++pzIgnTree ){ |
| 1272 | const char *zIgn = *pzIgnTree; |
| @@ -1278,17 +1279,17 @@ | |
| 1278 | } |
| 1279 | } |
| 1280 | *type = SVN_UNKNOWN; |
| 1281 | *zFile = 0; |
| 1282 | if( gsvn.lenTrunk==0 ){ |
| 1283 | zBranch = "trunk"; |
| 1284 | *zFile = zPath; |
| 1285 | *type = SVN_TRUNK; |
| 1286 | }else |
| 1287 | if( strncmp(zPath, gsvn.zTrunk, gsvn.lenTrunk-1)==0 ){ |
| 1288 | if( zPath[gsvn.lenTrunk-1]=='/' || zPath[gsvn.lenTrunk-1]==0 ){ |
| 1289 | zBranch = "trunk"; |
| 1290 | *zFile = zPath+gsvn.lenTrunk; |
| 1291 | *type = SVN_TRUNK; |
| 1292 | }else{ |
| 1293 | zBranch = 0; |
| 1294 | *type = SVN_UNKNOWN; |
| @@ -1318,10 +1319,11 @@ | |
| 1318 | db_multi_exec("INSERT INTO xbranches (tname, ttype) VALUES(%Q, %d)", |
| 1319 | zBranch, *type); |
| 1320 | branchId = db_last_insert_rowid(); |
| 1321 | } |
| 1322 | } |
| 1323 | return branchId; |
| 1324 | } |
| 1325 | |
| 1326 | /* |
| 1327 | ** Insert content of corresponding content blob into the database. |
| @@ -1727,10 +1729,11 @@ | |
| 1727 | int svnFlag = find_option("svn", 0, 0)!=0; |
| 1728 | int gitFlag = find_option("git", 0, 0)!=0; |
| 1729 | int omitRebuild = find_option("no-rebuild",0,0)!=0; |
| 1730 | int omitVacuum = find_option("no-vacuum",0,0)!=0; |
| 1731 | const char *zDefaultUser = find_option("admin-user","A",1); |
| 1732 | |
| 1733 | /* Options common to all input formats */ |
| 1734 | int incrFlag = find_option("incremental", "i", 0)!=0; |
| 1735 | |
| 1736 | /* Options for --svn only */ |
| @@ -1770,11 +1773,11 @@ | |
| 1770 | *renOpt->varSuf = renOpt->zDefaultSuf; |
| 1771 | } |
| 1772 | } |
| 1773 | } |
| 1774 | if( !(gimport.zTrunkName = find_option("rename-trunk", 0, 1)) ){ |
| 1775 | gimport.zTrunkName = "trunk"; |
| 1776 | } |
| 1777 | |
| 1778 | if( svnFlag ){ |
| 1779 | /* Get --svn related options here, so verify_all_options() fails when |
| 1780 | * svn-only options are specified with --git |
| @@ -2024,6 +2027,7 @@ | |
| 2024 | fossil_print("server-id: %s\n", db_get("server-code", 0)); |
| 2025 | zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin); |
| 2026 | fossil_print("admin-user: %s (password is \"%s\")\n", g.zLogin, zPassword); |
| 2027 | hash_user_password(g.zLogin); |
| 2028 | } |
| 2029 | } |
| 2030 |
| --- src/import.c | |
| +++ src/import.c | |
| @@ -568,12 +568,12 @@ | |
| 568 | ** |
| 569 | ** (A) refs/heads/BRANCHNAME |
| 570 | ** (B) refs/tags/TAGNAME |
| 571 | ** |
| 572 | ** If pattern A is used, then the branchname used is as shown. |
| 573 | ** Except, the "master" branch which is the default branch name in Git |
| 574 | ** is changed to the default main branch name in Fossil (usually "trunk") |
| 575 | ** If the pattern is B, then the new commit should be on the same |
| 576 | ** branch as its parent. And, we might need to add the TAGNAME |
| 577 | ** tag to the new commit. However, if there are multiple instances |
| 578 | ** of pattern B with the same TAGNAME, then only put the tag on the |
| 579 | ** last commit that holds that tag. |
| @@ -1263,10 +1263,11 @@ | |
| 1263 | ** Return 0 if not a branch, tag, or trunk, or if ignored by --ignore-tree. |
| 1264 | */ |
| 1265 | static int svn_parse_path(char *zPath, char **zFile, int *type){ |
| 1266 | char *zBranch = 0; |
| 1267 | int branchId = 0; |
| 1268 | char *zMainBranch = db_get("main-branch", 0); |
| 1269 | if( gsvn.azIgnTree ){ |
| 1270 | const char **pzIgnTree; |
| 1271 | unsigned nPath = strlen(zPath); |
| 1272 | for( pzIgnTree = gsvn.azIgnTree; *pzIgnTree; ++pzIgnTree ){ |
| 1273 | const char *zIgn = *pzIgnTree; |
| @@ -1278,17 +1279,17 @@ | |
| 1279 | } |
| 1280 | } |
| 1281 | *type = SVN_UNKNOWN; |
| 1282 | *zFile = 0; |
| 1283 | if( gsvn.lenTrunk==0 ){ |
| 1284 | zBranch = fossil_strdup(zMainBranch); |
| 1285 | *zFile = zPath; |
| 1286 | *type = SVN_TRUNK; |
| 1287 | }else |
| 1288 | if( strncmp(zPath, gsvn.zTrunk, gsvn.lenTrunk-1)==0 ){ |
| 1289 | if( zPath[gsvn.lenTrunk-1]=='/' || zPath[gsvn.lenTrunk-1]==0 ){ |
| 1290 | zBranch = fossil_strdup(zMainBranch); |
| 1291 | *zFile = zPath+gsvn.lenTrunk; |
| 1292 | *type = SVN_TRUNK; |
| 1293 | }else{ |
| 1294 | zBranch = 0; |
| 1295 | *type = SVN_UNKNOWN; |
| @@ -1318,10 +1319,11 @@ | |
| 1319 | db_multi_exec("INSERT INTO xbranches (tname, ttype) VALUES(%Q, %d)", |
| 1320 | zBranch, *type); |
| 1321 | branchId = db_last_insert_rowid(); |
| 1322 | } |
| 1323 | } |
| 1324 | fossil_free(zMainBranch); |
| 1325 | return branchId; |
| 1326 | } |
| 1327 | |
| 1328 | /* |
| 1329 | ** Insert content of corresponding content blob into the database. |
| @@ -1727,10 +1729,11 @@ | |
| 1729 | int svnFlag = find_option("svn", 0, 0)!=0; |
| 1730 | int gitFlag = find_option("git", 0, 0)!=0; |
| 1731 | int omitRebuild = find_option("no-rebuild",0,0)!=0; |
| 1732 | int omitVacuum = find_option("no-vacuum",0,0)!=0; |
| 1733 | const char *zDefaultUser = find_option("admin-user","A",1); |
| 1734 | char *zMainBranch = db_get("main-branch", 0); |
| 1735 | |
| 1736 | /* Options common to all input formats */ |
| 1737 | int incrFlag = find_option("incremental", "i", 0)!=0; |
| 1738 | |
| 1739 | /* Options for --svn only */ |
| @@ -1770,11 +1773,11 @@ | |
| 1773 | *renOpt->varSuf = renOpt->zDefaultSuf; |
| 1774 | } |
| 1775 | } |
| 1776 | } |
| 1777 | if( !(gimport.zTrunkName = find_option("rename-trunk", 0, 1)) ){ |
| 1778 | gimport.zTrunkName = fossil_strdup(zMainBranch); |
| 1779 | } |
| 1780 | |
| 1781 | if( svnFlag ){ |
| 1782 | /* Get --svn related options here, so verify_all_options() fails when |
| 1783 | * svn-only options are specified with --git |
| @@ -2024,6 +2027,7 @@ | |
| 2027 | fossil_print("server-id: %s\n", db_get("server-code", 0)); |
| 2028 | zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin); |
| 2029 | fossil_print("admin-user: %s (password is \"%s\")\n", g.zLogin, zPassword); |
| 2030 | hash_user_password(g.zLogin); |
| 2031 | } |
| 2032 | fossil_free(zMainBranch); |
| 2033 | } |
| 2034 |
+6
-2
| --- src/info.c | ||
| +++ src/info.c | ||
| @@ -1141,13 +1141,14 @@ | ||
| 1141 | 1141 | } |
| 1142 | 1142 | @ %s(zLinks)</td></tr> |
| 1143 | 1143 | } |
| 1144 | 1144 | |
| 1145 | 1145 | if( g.perm.Hyperlink ){ |
| 1146 | + char *zMainBranch = db_get("main-branch", 0); | |
| 1146 | 1147 | @ <tr><th>Other Links:</th> |
| 1147 | 1148 | @ <td> |
| 1148 | - if( fossil_strcmp(zBrName, db_get("main-branch",0))!=0 ){ | |
| 1149 | + if( fossil_strcmp(zBrName, zMainBranch)!=0 ){ | |
| 1149 | 1150 | @ %z(href("%R/vdiff?branch=%!S", zUuid))branch diff</a> | |
| 1150 | 1151 | } |
| 1151 | 1152 | @ %z(href("%R/artifact/%!S",zUuid))manifest</a> |
| 1152 | 1153 | @ | %z(href("%R/ci_tags/%!S",zUuid))tags</a> |
| 1153 | 1154 | if( g.perm.Admin ){ |
| @@ -1156,10 +1157,11 @@ | ||
| 1156 | 1157 | if( g.anon.Write ){ |
| 1157 | 1158 | @ | %z(href("%R/ci_edit?r=%!S",zUuid))edit</a> |
| 1158 | 1159 | } |
| 1159 | 1160 | @ </td> |
| 1160 | 1161 | @ </tr> |
| 1162 | + fossil_free(zMainBranch); | |
| 1161 | 1163 | } |
| 1162 | 1164 | @ </table> |
| 1163 | 1165 | blob_reset(&wiki_read_links); |
| 1164 | 1166 | blob_reset(&wiki_add_links); |
| 1165 | 1167 | }else{ |
| @@ -3717,10 +3719,11 @@ | ||
| 3717 | 3719 | style_header("Edit Check-in [%s]", zUuid); |
| 3718 | 3720 | if( P("preview") ){ |
| 3719 | 3721 | Blob suffix; |
| 3720 | 3722 | int nTag = 0; |
| 3721 | 3723 | const char *zDplyBr; /* Branch name used to determine BG color */ |
| 3724 | + char *zMainBranch = db_get("main-branch", 0); | |
| 3722 | 3725 | if( zNewBrFlag[0] && zNewBranch[0] ){ |
| 3723 | 3726 | zDplyBr = zNewBranch; |
| 3724 | 3727 | }else{ |
| 3725 | 3728 | zDplyBr = zBranchName; |
| 3726 | 3729 | } |
| @@ -3729,11 +3732,11 @@ | ||
| 3729 | 3732 | @ <table border=0> |
| 3730 | 3733 | if( zNewColorFlag[0] && zNewColor && zNewColor[0] ){ |
| 3731 | 3734 | @ <tr><td style="background-color:%h(reasonable_bg_color(zNewColor,0));"> |
| 3732 | 3735 | }else if( zColor[0] ){ |
| 3733 | 3736 | @ <tr><td style="background-color:%h(reasonable_bg_color(zColor,0));"> |
| 3734 | - }else if( zDplyBr && fossil_strcmp(zDplyBr,"trunk")!=0 ){ | |
| 3737 | + }else if( zDplyBr && fossil_strcmp(zDplyBr, zMainBranch)!=0 ){ | |
| 3735 | 3738 | @ <tr><td style="background-color:%h(hash_color(zDplyBr));"> |
| 3736 | 3739 | }else{ |
| 3737 | 3740 | @ <tr><td> |
| 3738 | 3741 | } |
| 3739 | 3742 | @ %!W(blob_str(&comment)) |
| @@ -3760,10 +3763,11 @@ | ||
| 3760 | 3763 | @ <p>The timestamp on the tag used to make the changes above |
| 3761 | 3764 | @ will be overridden as: %s(date_in_standard_format(zChngTime))</p> |
| 3762 | 3765 | } |
| 3763 | 3766 | @ </blockquote> |
| 3764 | 3767 | @ <hr> |
| 3768 | + fossil_free(zMainBranch); | |
| 3765 | 3769 | blob_reset(&suffix); |
| 3766 | 3770 | } |
| 3767 | 3771 | @ <p>Make changes to attributes of check-in |
| 3768 | 3772 | @ [%z(href("%R/ci/%!S",zUuid))%s(zUuid)</a>]:</p> |
| 3769 | 3773 | form_begin(0, "%R/ci_edit"); |
| 3770 | 3774 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -1141,13 +1141,14 @@ | |
| 1141 | } |
| 1142 | @ %s(zLinks)</td></tr> |
| 1143 | } |
| 1144 | |
| 1145 | if( g.perm.Hyperlink ){ |
| 1146 | @ <tr><th>Other Links:</th> |
| 1147 | @ <td> |
| 1148 | if( fossil_strcmp(zBrName, db_get("main-branch",0))!=0 ){ |
| 1149 | @ %z(href("%R/vdiff?branch=%!S", zUuid))branch diff</a> | |
| 1150 | } |
| 1151 | @ %z(href("%R/artifact/%!S",zUuid))manifest</a> |
| 1152 | @ | %z(href("%R/ci_tags/%!S",zUuid))tags</a> |
| 1153 | if( g.perm.Admin ){ |
| @@ -1156,10 +1157,11 @@ | |
| 1156 | if( g.anon.Write ){ |
| 1157 | @ | %z(href("%R/ci_edit?r=%!S",zUuid))edit</a> |
| 1158 | } |
| 1159 | @ </td> |
| 1160 | @ </tr> |
| 1161 | } |
| 1162 | @ </table> |
| 1163 | blob_reset(&wiki_read_links); |
| 1164 | blob_reset(&wiki_add_links); |
| 1165 | }else{ |
| @@ -3717,10 +3719,11 @@ | |
| 3717 | style_header("Edit Check-in [%s]", zUuid); |
| 3718 | if( P("preview") ){ |
| 3719 | Blob suffix; |
| 3720 | int nTag = 0; |
| 3721 | const char *zDplyBr; /* Branch name used to determine BG color */ |
| 3722 | if( zNewBrFlag[0] && zNewBranch[0] ){ |
| 3723 | zDplyBr = zNewBranch; |
| 3724 | }else{ |
| 3725 | zDplyBr = zBranchName; |
| 3726 | } |
| @@ -3729,11 +3732,11 @@ | |
| 3729 | @ <table border=0> |
| 3730 | if( zNewColorFlag[0] && zNewColor && zNewColor[0] ){ |
| 3731 | @ <tr><td style="background-color:%h(reasonable_bg_color(zNewColor,0));"> |
| 3732 | }else if( zColor[0] ){ |
| 3733 | @ <tr><td style="background-color:%h(reasonable_bg_color(zColor,0));"> |
| 3734 | }else if( zDplyBr && fossil_strcmp(zDplyBr,"trunk")!=0 ){ |
| 3735 | @ <tr><td style="background-color:%h(hash_color(zDplyBr));"> |
| 3736 | }else{ |
| 3737 | @ <tr><td> |
| 3738 | } |
| 3739 | @ %!W(blob_str(&comment)) |
| @@ -3760,10 +3763,11 @@ | |
| 3760 | @ <p>The timestamp on the tag used to make the changes above |
| 3761 | @ will be overridden as: %s(date_in_standard_format(zChngTime))</p> |
| 3762 | } |
| 3763 | @ </blockquote> |
| 3764 | @ <hr> |
| 3765 | blob_reset(&suffix); |
| 3766 | } |
| 3767 | @ <p>Make changes to attributes of check-in |
| 3768 | @ [%z(href("%R/ci/%!S",zUuid))%s(zUuid)</a>]:</p> |
| 3769 | form_begin(0, "%R/ci_edit"); |
| 3770 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -1141,13 +1141,14 @@ | |
| 1141 | } |
| 1142 | @ %s(zLinks)</td></tr> |
| 1143 | } |
| 1144 | |
| 1145 | if( g.perm.Hyperlink ){ |
| 1146 | char *zMainBranch = db_get("main-branch", 0); |
| 1147 | @ <tr><th>Other Links:</th> |
| 1148 | @ <td> |
| 1149 | if( fossil_strcmp(zBrName, zMainBranch)!=0 ){ |
| 1150 | @ %z(href("%R/vdiff?branch=%!S", zUuid))branch diff</a> | |
| 1151 | } |
| 1152 | @ %z(href("%R/artifact/%!S",zUuid))manifest</a> |
| 1153 | @ | %z(href("%R/ci_tags/%!S",zUuid))tags</a> |
| 1154 | if( g.perm.Admin ){ |
| @@ -1156,10 +1157,11 @@ | |
| 1157 | if( g.anon.Write ){ |
| 1158 | @ | %z(href("%R/ci_edit?r=%!S",zUuid))edit</a> |
| 1159 | } |
| 1160 | @ </td> |
| 1161 | @ </tr> |
| 1162 | fossil_free(zMainBranch); |
| 1163 | } |
| 1164 | @ </table> |
| 1165 | blob_reset(&wiki_read_links); |
| 1166 | blob_reset(&wiki_add_links); |
| 1167 | }else{ |
| @@ -3717,10 +3719,11 @@ | |
| 3719 | style_header("Edit Check-in [%s]", zUuid); |
| 3720 | if( P("preview") ){ |
| 3721 | Blob suffix; |
| 3722 | int nTag = 0; |
| 3723 | const char *zDplyBr; /* Branch name used to determine BG color */ |
| 3724 | char *zMainBranch = db_get("main-branch", 0); |
| 3725 | if( zNewBrFlag[0] && zNewBranch[0] ){ |
| 3726 | zDplyBr = zNewBranch; |
| 3727 | }else{ |
| 3728 | zDplyBr = zBranchName; |
| 3729 | } |
| @@ -3729,11 +3732,11 @@ | |
| 3732 | @ <table border=0> |
| 3733 | if( zNewColorFlag[0] && zNewColor && zNewColor[0] ){ |
| 3734 | @ <tr><td style="background-color:%h(reasonable_bg_color(zNewColor,0));"> |
| 3735 | }else if( zColor[0] ){ |
| 3736 | @ <tr><td style="background-color:%h(reasonable_bg_color(zColor,0));"> |
| 3737 | }else if( zDplyBr && fossil_strcmp(zDplyBr, zMainBranch)!=0 ){ |
| 3738 | @ <tr><td style="background-color:%h(hash_color(zDplyBr));"> |
| 3739 | }else{ |
| 3740 | @ <tr><td> |
| 3741 | } |
| 3742 | @ %!W(blob_str(&comment)) |
| @@ -3760,10 +3763,11 @@ | |
| 3763 | @ <p>The timestamp on the tag used to make the changes above |
| 3764 | @ will be overridden as: %s(date_in_standard_format(zChngTime))</p> |
| 3765 | } |
| 3766 | @ </blockquote> |
| 3767 | @ <hr> |
| 3768 | fossil_free(zMainBranch); |
| 3769 | blob_reset(&suffix); |
| 3770 | } |
| 3771 | @ <p>Make changes to attributes of check-in |
| 3772 | @ [%z(href("%R/ci/%!S",zUuid))%s(zUuid)</a>]:</p> |
| 3773 | form_begin(0, "%R/ci_edit"); |
| 3774 |
+4
-2
| --- src/json_branch.c | ||
| +++ src/json_branch.c | ||
| @@ -313,10 +313,11 @@ | ||
| 313 | 313 | cson_value * payV = NULL; |
| 314 | 314 | cson_object * pay = NULL; |
| 315 | 315 | int rc = 0; |
| 316 | 316 | BranchCreateOptions opt; |
| 317 | 317 | char * zUuid = NULL; |
| 318 | + char *zMainBranch = db_get("main-branch", 0); | |
| 318 | 319 | int rid = 0; |
| 319 | 320 | if( !g.perm.Write ){ |
| 320 | 321 | json_set_err(FSL_JSON_E_DENIED, |
| 321 | 322 | "Requires 'i' permissions."); |
| 322 | 323 | return NULL; |
| @@ -340,11 +341,11 @@ | ||
| 340 | 341 | opt.zBasis = json_find_option_cstr("basis",NULL,NULL); |
| 341 | 342 | if(!opt.zBasis && !g.isHTTP){ |
| 342 | 343 | opt.zBasis = json_command_arg(g.json.dispatchDepth+2); |
| 343 | 344 | } |
| 344 | 345 | if(!opt.zBasis){ |
| 345 | - opt.zBasis = "trunk"; | |
| 346 | + opt.zBasis = fossil_strdup(zMainBranch); | |
| 346 | 347 | } |
| 347 | 348 | opt.isPrivate = json_find_option_bool("private",NULL,NULL,-1); |
| 348 | 349 | if(-1==opt.isPrivate){ |
| 349 | 350 | if(!g.isHTTP){ |
| 350 | 351 | opt.isPrivate = (NULL != find_option("private","",0)); |
| @@ -366,11 +367,12 @@ | ||
| 366 | 367 | cson_object_set(pay,"basis",json_new_string(opt.zBasis)); |
| 367 | 368 | cson_object_set(pay,"rid",json_new_int(rid)); |
| 368 | 369 | zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 369 | 370 | cson_object_set(pay,"uuid", json_new_string(zUuid)); |
| 370 | 371 | cson_object_set(pay, "isPrivate", cson_value_new_bool(opt.isPrivate)); |
| 371 | - free(zUuid); | |
| 372 | + fossil_free(zMainBranch); | |
| 373 | + fossil_free(zUuid); | |
| 372 | 374 | if(opt.zColor){ |
| 373 | 375 | cson_object_set(pay,"bgColor",json_new_string(opt.zColor)); |
| 374 | 376 | } |
| 375 | 377 | |
| 376 | 378 | goto ok; |
| 377 | 379 |
| --- src/json_branch.c | |
| +++ src/json_branch.c | |
| @@ -313,10 +313,11 @@ | |
| 313 | cson_value * payV = NULL; |
| 314 | cson_object * pay = NULL; |
| 315 | int rc = 0; |
| 316 | BranchCreateOptions opt; |
| 317 | char * zUuid = NULL; |
| 318 | int rid = 0; |
| 319 | if( !g.perm.Write ){ |
| 320 | json_set_err(FSL_JSON_E_DENIED, |
| 321 | "Requires 'i' permissions."); |
| 322 | return NULL; |
| @@ -340,11 +341,11 @@ | |
| 340 | opt.zBasis = json_find_option_cstr("basis",NULL,NULL); |
| 341 | if(!opt.zBasis && !g.isHTTP){ |
| 342 | opt.zBasis = json_command_arg(g.json.dispatchDepth+2); |
| 343 | } |
| 344 | if(!opt.zBasis){ |
| 345 | opt.zBasis = "trunk"; |
| 346 | } |
| 347 | opt.isPrivate = json_find_option_bool("private",NULL,NULL,-1); |
| 348 | if(-1==opt.isPrivate){ |
| 349 | if(!g.isHTTP){ |
| 350 | opt.isPrivate = (NULL != find_option("private","",0)); |
| @@ -366,11 +367,12 @@ | |
| 366 | cson_object_set(pay,"basis",json_new_string(opt.zBasis)); |
| 367 | cson_object_set(pay,"rid",json_new_int(rid)); |
| 368 | zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 369 | cson_object_set(pay,"uuid", json_new_string(zUuid)); |
| 370 | cson_object_set(pay, "isPrivate", cson_value_new_bool(opt.isPrivate)); |
| 371 | free(zUuid); |
| 372 | if(opt.zColor){ |
| 373 | cson_object_set(pay,"bgColor",json_new_string(opt.zColor)); |
| 374 | } |
| 375 | |
| 376 | goto ok; |
| 377 |
| --- src/json_branch.c | |
| +++ src/json_branch.c | |
| @@ -313,10 +313,11 @@ | |
| 313 | cson_value * payV = NULL; |
| 314 | cson_object * pay = NULL; |
| 315 | int rc = 0; |
| 316 | BranchCreateOptions opt; |
| 317 | char * zUuid = NULL; |
| 318 | char *zMainBranch = db_get("main-branch", 0); |
| 319 | int rid = 0; |
| 320 | if( !g.perm.Write ){ |
| 321 | json_set_err(FSL_JSON_E_DENIED, |
| 322 | "Requires 'i' permissions."); |
| 323 | return NULL; |
| @@ -340,11 +341,11 @@ | |
| 341 | opt.zBasis = json_find_option_cstr("basis",NULL,NULL); |
| 342 | if(!opt.zBasis && !g.isHTTP){ |
| 343 | opt.zBasis = json_command_arg(g.json.dispatchDepth+2); |
| 344 | } |
| 345 | if(!opt.zBasis){ |
| 346 | opt.zBasis = fossil_strdup(zMainBranch); |
| 347 | } |
| 348 | opt.isPrivate = json_find_option_bool("private",NULL,NULL,-1); |
| 349 | if(-1==opt.isPrivate){ |
| 350 | if(!g.isHTTP){ |
| 351 | opt.isPrivate = (NULL != find_option("private","",0)); |
| @@ -366,11 +367,12 @@ | |
| 367 | cson_object_set(pay,"basis",json_new_string(opt.zBasis)); |
| 368 | cson_object_set(pay,"rid",json_new_int(rid)); |
| 369 | zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 370 | cson_object_set(pay,"uuid", json_new_string(zUuid)); |
| 371 | cson_object_set(pay, "isPrivate", cson_value_new_bool(opt.isPrivate)); |
| 372 | fossil_free(zMainBranch); |
| 373 | fossil_free(zUuid); |
| 374 | if(opt.zColor){ |
| 375 | cson_object_set(pay,"bgColor",json_new_string(opt.zColor)); |
| 376 | } |
| 377 | |
| 378 | goto ok; |
| 379 |
+3
-1
| --- src/leaf.c | ||
| +++ src/leaf.c | ||
| @@ -226,14 +226,16 @@ | ||
| 226 | 226 | int leaf_ambiguity_warning(int rid, int currentCkout){ |
| 227 | 227 | char *zBr; |
| 228 | 228 | Stmt q; |
| 229 | 229 | int n = 0; |
| 230 | 230 | Blob msg; |
| 231 | + const char *zMainBranch; | |
| 231 | 232 | if( leaf_ambiguity(rid)==0 ) return 0; |
| 233 | + zMainBranch = db_get("main-branch", 0); | |
| 232 | 234 | zBr = db_text(0, "SELECT value FROM tagxref WHERE tagid=%d AND rid=%d", |
| 233 | 235 | TAG_BRANCH, rid); |
| 234 | - if( zBr==0 ) zBr = fossil_strdup("trunk"); | |
| 236 | + if( zBr==0 ) zBr = fossil_strdup(zMainBranch); | |
| 235 | 237 | blob_init(&msg, 0, 0); |
| 236 | 238 | blob_appendf(&msg, "WARNING: multiple open leaf check-ins on %s:", zBr); |
| 237 | 239 | db_prepare(&q, |
| 238 | 240 | "SELECT" |
| 239 | 241 | " (SELECT uuid FROM blob WHERE rid=leaf.rid)," |
| 240 | 242 |
| --- src/leaf.c | |
| +++ src/leaf.c | |
| @@ -226,14 +226,16 @@ | |
| 226 | int leaf_ambiguity_warning(int rid, int currentCkout){ |
| 227 | char *zBr; |
| 228 | Stmt q; |
| 229 | int n = 0; |
| 230 | Blob msg; |
| 231 | if( leaf_ambiguity(rid)==0 ) return 0; |
| 232 | zBr = db_text(0, "SELECT value FROM tagxref WHERE tagid=%d AND rid=%d", |
| 233 | TAG_BRANCH, rid); |
| 234 | if( zBr==0 ) zBr = fossil_strdup("trunk"); |
| 235 | blob_init(&msg, 0, 0); |
| 236 | blob_appendf(&msg, "WARNING: multiple open leaf check-ins on %s:", zBr); |
| 237 | db_prepare(&q, |
| 238 | "SELECT" |
| 239 | " (SELECT uuid FROM blob WHERE rid=leaf.rid)," |
| 240 |
| --- src/leaf.c | |
| +++ src/leaf.c | |
| @@ -226,14 +226,16 @@ | |
| 226 | int leaf_ambiguity_warning(int rid, int currentCkout){ |
| 227 | char *zBr; |
| 228 | Stmt q; |
| 229 | int n = 0; |
| 230 | Blob msg; |
| 231 | const char *zMainBranch; |
| 232 | if( leaf_ambiguity(rid)==0 ) return 0; |
| 233 | zMainBranch = db_get("main-branch", 0); |
| 234 | zBr = db_text(0, "SELECT value FROM tagxref WHERE tagid=%d AND rid=%d", |
| 235 | TAG_BRANCH, rid); |
| 236 | if( zBr==0 ) zBr = fossil_strdup(zMainBranch); |
| 237 | blob_init(&msg, 0, 0); |
| 238 | blob_appendf(&msg, "WARNING: multiple open leaf check-ins on %s:", zBr); |
| 239 | db_prepare(&q, |
| 240 | "SELECT" |
| 241 | " (SELECT uuid FROM blob WHERE rid=leaf.rid)," |
| 242 |
+5
-3
| --- src/rebuild.c | ||
| +++ src/rebuild.c | ||
| @@ -351,11 +351,12 @@ | ||
| 351 | 351 | /* |
| 352 | 352 | ** Check to see if the "sym-trunk" tag exists. If not, create it |
| 353 | 353 | ** and attach it to the very first check-in. |
| 354 | 354 | */ |
| 355 | 355 | static void rebuild_tag_trunk(void){ |
| 356 | - int tagid = db_int(0, "SELECT 1 FROM tag WHERE tagname='sym-trunk'"); | |
| 356 | + char *zMainBranch = db_get("main-branch", 0); | |
| 357 | + int tagid = db_int(0, "SELECT 1 FROM tag WHERE tagname='sym-%q'",zMainBranch); | |
| 357 | 358 | int rid; |
| 358 | 359 | char *zUuid; |
| 359 | 360 | |
| 360 | 361 | if( tagid>0 ) return; |
| 361 | 362 | rid = db_int(0, "SELECT pid FROM plink AS x WHERE NOT EXISTS(" |
| @@ -363,12 +364,13 @@ | ||
| 363 | 364 | if( rid==0 ) return; |
| 364 | 365 | |
| 365 | 366 | /* Add the trunk tag to the root of the whole tree */ |
| 366 | 367 | zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 367 | 368 | if( zUuid==0 ) return; |
| 368 | - tag_add_artifact("sym-", "trunk", zUuid, 0, 2, 0, 0); | |
| 369 | - tag_add_artifact("", "branch", zUuid, "trunk", 2, 0, 0); | |
| 369 | + tag_add_artifact("sym-", zMainBranch, zUuid, 0, 2, 0, 0); | |
| 370 | + tag_add_artifact("", "branch", zUuid, zMainBranch, 2, 0, 0); | |
| 371 | + fossil_free(zMainBranch); | |
| 370 | 372 | } |
| 371 | 373 | |
| 372 | 374 | /* |
| 373 | 375 | ** Core function to rebuild the information in the derived tables of a |
| 374 | 376 | ** fossil repository from the blobs. This function is shared between |
| 375 | 377 |
| --- src/rebuild.c | |
| +++ src/rebuild.c | |
| @@ -351,11 +351,12 @@ | |
| 351 | /* |
| 352 | ** Check to see if the "sym-trunk" tag exists. If not, create it |
| 353 | ** and attach it to the very first check-in. |
| 354 | */ |
| 355 | static void rebuild_tag_trunk(void){ |
| 356 | int tagid = db_int(0, "SELECT 1 FROM tag WHERE tagname='sym-trunk'"); |
| 357 | int rid; |
| 358 | char *zUuid; |
| 359 | |
| 360 | if( tagid>0 ) return; |
| 361 | rid = db_int(0, "SELECT pid FROM plink AS x WHERE NOT EXISTS(" |
| @@ -363,12 +364,13 @@ | |
| 363 | if( rid==0 ) return; |
| 364 | |
| 365 | /* Add the trunk tag to the root of the whole tree */ |
| 366 | zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 367 | if( zUuid==0 ) return; |
| 368 | tag_add_artifact("sym-", "trunk", zUuid, 0, 2, 0, 0); |
| 369 | tag_add_artifact("", "branch", zUuid, "trunk", 2, 0, 0); |
| 370 | } |
| 371 | |
| 372 | /* |
| 373 | ** Core function to rebuild the information in the derived tables of a |
| 374 | ** fossil repository from the blobs. This function is shared between |
| 375 |
| --- src/rebuild.c | |
| +++ src/rebuild.c | |
| @@ -351,11 +351,12 @@ | |
| 351 | /* |
| 352 | ** Check to see if the "sym-trunk" tag exists. If not, create it |
| 353 | ** and attach it to the very first check-in. |
| 354 | */ |
| 355 | static void rebuild_tag_trunk(void){ |
| 356 | char *zMainBranch = db_get("main-branch", 0); |
| 357 | int tagid = db_int(0, "SELECT 1 FROM tag WHERE tagname='sym-%q'",zMainBranch); |
| 358 | int rid; |
| 359 | char *zUuid; |
| 360 | |
| 361 | if( tagid>0 ) return; |
| 362 | rid = db_int(0, "SELECT pid FROM plink AS x WHERE NOT EXISTS(" |
| @@ -363,12 +364,13 @@ | |
| 364 | if( rid==0 ) return; |
| 365 | |
| 366 | /* Add the trunk tag to the root of the whole tree */ |
| 367 | zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 368 | if( zUuid==0 ) return; |
| 369 | tag_add_artifact("sym-", zMainBranch, zUuid, 0, 2, 0, 0); |
| 370 | tag_add_artifact("", "branch", zUuid, zMainBranch, 2, 0, 0); |
| 371 | fossil_free(zMainBranch); |
| 372 | } |
| 373 | |
| 374 | /* |
| 375 | ** Core function to rebuild the information in the derived tables of a |
| 376 | ** fossil repository from the blobs. This function is shared between |
| 377 |
+6
-2
| --- src/search.c | ||
| +++ src/search.c | ||
| @@ -852,11 +852,12 @@ | ||
| 852 | 852 | ){ |
| 853 | 853 | search_init(zPattern, "<mark>", "</mark>", " ... ", |
| 854 | 854 | SRCHFLG_STATIC|SRCHFLG_HTML); |
| 855 | 855 | if( (srchFlags & SRCH_DOC)!=0 ){ |
| 856 | 856 | char *zDocGlob = db_get("doc-glob",""); |
| 857 | - char *zDocBr = db_get("doc-branch","trunk"); | |
| 857 | + char *zMainBranch = db_get("main-branch", 0); | |
| 858 | + char *zDocBr = db_get("doc-branch", zMainBranch); | |
| 858 | 859 | if( zDocGlob && zDocGlob[0] && zDocBr && zDocBr[0] ){ |
| 859 | 860 | Glob * pGlob = glob_create(zDocBr) |
| 860 | 861 | /* We're misusing a Glob as a list of comma-/space-delimited |
| 861 | 862 | ** tokens. We're not actually doing glob matches here. */; |
| 862 | 863 | int i; |
| @@ -883,10 +884,11 @@ | ||
| 883 | 884 | zBranch, zBranch, zBranch, glob_expr("foci.filename", zDocGlob) |
| 884 | 885 | ); |
| 885 | 886 | } |
| 886 | 887 | glob_free(pGlob); |
| 887 | 888 | } |
| 889 | + fossil_free(zMainBranch); | |
| 888 | 890 | fossil_free(zDocGlob); |
| 889 | 891 | fossil_free(zDocBr); |
| 890 | 892 | } |
| 891 | 893 | if( (srchFlags & SRCH_WIKI)!=0 ){ |
| 892 | 894 | db_multi_exec( |
| @@ -1986,11 +1988,12 @@ | ||
| 1986 | 1988 | ** and if the latest check-in on doc-br is in the unindexed set of |
| 1987 | 1989 | ** check-ins, then update all 'd' entries in FTSDOCS that have |
| 1988 | 1990 | ** changed. |
| 1989 | 1991 | */ |
| 1990 | 1992 | static void search_update_doc_index(void){ |
| 1991 | - const char *zDocBranches = db_get("doc-branch","trunk"); | |
| 1993 | + char *zMainBranch = db_get("main-branch", 0); | |
| 1994 | + const char *zDocBranches = db_get("doc-branch", zMainBranch); | |
| 1992 | 1995 | int i; |
| 1993 | 1996 | Glob * pGlob = glob_create(zDocBranches) |
| 1994 | 1997 | /* We're misusing a Glob as a list of comma-/space-delimited |
| 1995 | 1998 | ** tokens. We're not actually doing glob matches here. */; |
| 1996 | 1999 | if( !pGlob ) return; |
| @@ -2043,10 +2046,11 @@ | ||
| 2043 | 2046 | " bx=NULL," |
| 2044 | 2047 | " label='Document: '||label" |
| 2045 | 2048 | " WHERE type='d' AND NOT idxed" |
| 2046 | 2049 | ); |
| 2047 | 2050 | } |
| 2051 | + fossil_free(zMainBranch); | |
| 2048 | 2052 | glob_free(pGlob); |
| 2049 | 2053 | } |
| 2050 | 2054 | |
| 2051 | 2055 | /* |
| 2052 | 2056 | ** Deal with all of the unindexed 'c' terms in FTSDOCS |
| 2053 | 2057 |
| --- src/search.c | |
| +++ src/search.c | |
| @@ -852,11 +852,12 @@ | |
| 852 | ){ |
| 853 | search_init(zPattern, "<mark>", "</mark>", " ... ", |
| 854 | SRCHFLG_STATIC|SRCHFLG_HTML); |
| 855 | if( (srchFlags & SRCH_DOC)!=0 ){ |
| 856 | char *zDocGlob = db_get("doc-glob",""); |
| 857 | char *zDocBr = db_get("doc-branch","trunk"); |
| 858 | if( zDocGlob && zDocGlob[0] && zDocBr && zDocBr[0] ){ |
| 859 | Glob * pGlob = glob_create(zDocBr) |
| 860 | /* We're misusing a Glob as a list of comma-/space-delimited |
| 861 | ** tokens. We're not actually doing glob matches here. */; |
| 862 | int i; |
| @@ -883,10 +884,11 @@ | |
| 883 | zBranch, zBranch, zBranch, glob_expr("foci.filename", zDocGlob) |
| 884 | ); |
| 885 | } |
| 886 | glob_free(pGlob); |
| 887 | } |
| 888 | fossil_free(zDocGlob); |
| 889 | fossil_free(zDocBr); |
| 890 | } |
| 891 | if( (srchFlags & SRCH_WIKI)!=0 ){ |
| 892 | db_multi_exec( |
| @@ -1986,11 +1988,12 @@ | |
| 1986 | ** and if the latest check-in on doc-br is in the unindexed set of |
| 1987 | ** check-ins, then update all 'd' entries in FTSDOCS that have |
| 1988 | ** changed. |
| 1989 | */ |
| 1990 | static void search_update_doc_index(void){ |
| 1991 | const char *zDocBranches = db_get("doc-branch","trunk"); |
| 1992 | int i; |
| 1993 | Glob * pGlob = glob_create(zDocBranches) |
| 1994 | /* We're misusing a Glob as a list of comma-/space-delimited |
| 1995 | ** tokens. We're not actually doing glob matches here. */; |
| 1996 | if( !pGlob ) return; |
| @@ -2043,10 +2046,11 @@ | |
| 2043 | " bx=NULL," |
| 2044 | " label='Document: '||label" |
| 2045 | " WHERE type='d' AND NOT idxed" |
| 2046 | ); |
| 2047 | } |
| 2048 | glob_free(pGlob); |
| 2049 | } |
| 2050 | |
| 2051 | /* |
| 2052 | ** Deal with all of the unindexed 'c' terms in FTSDOCS |
| 2053 |
| --- src/search.c | |
| +++ src/search.c | |
| @@ -852,11 +852,12 @@ | |
| 852 | ){ |
| 853 | search_init(zPattern, "<mark>", "</mark>", " ... ", |
| 854 | SRCHFLG_STATIC|SRCHFLG_HTML); |
| 855 | if( (srchFlags & SRCH_DOC)!=0 ){ |
| 856 | char *zDocGlob = db_get("doc-glob",""); |
| 857 | char *zMainBranch = db_get("main-branch", 0); |
| 858 | char *zDocBr = db_get("doc-branch", zMainBranch); |
| 859 | if( zDocGlob && zDocGlob[0] && zDocBr && zDocBr[0] ){ |
| 860 | Glob * pGlob = glob_create(zDocBr) |
| 861 | /* We're misusing a Glob as a list of comma-/space-delimited |
| 862 | ** tokens. We're not actually doing glob matches here. */; |
| 863 | int i; |
| @@ -883,10 +884,11 @@ | |
| 884 | zBranch, zBranch, zBranch, glob_expr("foci.filename", zDocGlob) |
| 885 | ); |
| 886 | } |
| 887 | glob_free(pGlob); |
| 888 | } |
| 889 | fossil_free(zMainBranch); |
| 890 | fossil_free(zDocGlob); |
| 891 | fossil_free(zDocBr); |
| 892 | } |
| 893 | if( (srchFlags & SRCH_WIKI)!=0 ){ |
| 894 | db_multi_exec( |
| @@ -1986,11 +1988,12 @@ | |
| 1988 | ** and if the latest check-in on doc-br is in the unindexed set of |
| 1989 | ** check-ins, then update all 'd' entries in FTSDOCS that have |
| 1990 | ** changed. |
| 1991 | */ |
| 1992 | static void search_update_doc_index(void){ |
| 1993 | char *zMainBranch = db_get("main-branch", 0); |
| 1994 | const char *zDocBranches = db_get("doc-branch", zMainBranch); |
| 1995 | int i; |
| 1996 | Glob * pGlob = glob_create(zDocBranches) |
| 1997 | /* We're misusing a Glob as a list of comma-/space-delimited |
| 1998 | ** tokens. We're not actually doing glob matches here. */; |
| 1999 | if( !pGlob ) return; |
| @@ -2043,10 +2046,11 @@ | |
| 2046 | " bx=NULL," |
| 2047 | " label='Document: '||label" |
| 2048 | " WHERE type='d' AND NOT idxed" |
| 2049 | ); |
| 2050 | } |
| 2051 | fossil_free(zMainBranch); |
| 2052 | glob_free(pGlob); |
| 2053 | } |
| 2054 | |
| 2055 | /* |
| 2056 | ** Deal with all of the unindexed 'c' terms in FTSDOCS |
| 2057 |
+6
-2
| --- src/setup.c | ||
| +++ src/setup.c | ||
| @@ -2282,10 +2282,11 @@ | ||
| 2282 | 2282 | ** WEBPAGE: srchsetup |
| 2283 | 2283 | ** |
| 2284 | 2284 | ** Configure the search engine. Requires Admin privilege. |
| 2285 | 2285 | */ |
| 2286 | 2286 | void page_srchsetup(){ |
| 2287 | + char *zMainBranch; | |
| 2287 | 2288 | login_check_credentials(); |
| 2288 | 2289 | if( !g.perm.Admin ){ |
| 2289 | 2290 | login_needed(0); |
| 2290 | 2291 | return; |
| 2291 | 2292 | } |
| @@ -2312,13 +2313,15 @@ | ||
| 2312 | 2313 | @ <tr><td>*<td><td>Search all checked-in files</tr> |
| 2313 | 2314 | @ <tr><td><i>(blank)</i><td> |
| 2314 | 2315 | @ <td>Search nothing. (Disables document search).</tr> |
| 2315 | 2316 | @ </table> |
| 2316 | 2317 | @ <hr> |
| 2317 | - entry_attribute("Document Branches", 20, "doc-branch", "db", "trunk", 0); | |
| 2318 | + zMainBranch = db_get("main-branch", 0); | |
| 2319 | + entry_attribute("Document Branches", 20, "doc-branch", "db", zMainBranch, 0); | |
| 2318 | 2320 | @ <p>When searching documents, use the versions of the files found at the |
| 2319 | - @ type of the "Document Branches" branch. Recommended value: "trunk". | |
| 2321 | + @ type of the "Document Branches" branch. Recommended value: the name of | |
| 2322 | + @ the main branch (usually "trunk"). | |
| 2320 | 2323 | @ Document search is disabled if blank. It may be a list of branch names |
| 2321 | 2324 | @ separated by spaces and/or commas. |
| 2322 | 2325 | @ <hr> |
| 2323 | 2326 | onoff_attribute("Search Check-in Comments", "search-ci", "sc", 0, 0); |
| 2324 | 2327 | @ <br> |
| @@ -2368,10 +2371,11 @@ | ||
| 2368 | 2371 | @ larger repositories.</p> |
| 2369 | 2372 | select_fts_tokenizer(); |
| 2370 | 2373 | @ <p><input type="submit" name="fts1" value="Create A Full-Text Index"> |
| 2371 | 2374 | } |
| 2372 | 2375 | @ </div></form> |
| 2376 | + fossil_free(zMainBranch); | |
| 2373 | 2377 | style_finish_page(); |
| 2374 | 2378 | } |
| 2375 | 2379 | |
| 2376 | 2380 | /* |
| 2377 | 2381 | ** A URL Alias originally called zOldName is now zNewName/zValue. |
| 2378 | 2382 |
| --- src/setup.c | |
| +++ src/setup.c | |
| @@ -2282,10 +2282,11 @@ | |
| 2282 | ** WEBPAGE: srchsetup |
| 2283 | ** |
| 2284 | ** Configure the search engine. Requires Admin privilege. |
| 2285 | */ |
| 2286 | void page_srchsetup(){ |
| 2287 | login_check_credentials(); |
| 2288 | if( !g.perm.Admin ){ |
| 2289 | login_needed(0); |
| 2290 | return; |
| 2291 | } |
| @@ -2312,13 +2313,15 @@ | |
| 2312 | @ <tr><td>*<td><td>Search all checked-in files</tr> |
| 2313 | @ <tr><td><i>(blank)</i><td> |
| 2314 | @ <td>Search nothing. (Disables document search).</tr> |
| 2315 | @ </table> |
| 2316 | @ <hr> |
| 2317 | entry_attribute("Document Branches", 20, "doc-branch", "db", "trunk", 0); |
| 2318 | @ <p>When searching documents, use the versions of the files found at the |
| 2319 | @ type of the "Document Branches" branch. Recommended value: "trunk". |
| 2320 | @ Document search is disabled if blank. It may be a list of branch names |
| 2321 | @ separated by spaces and/or commas. |
| 2322 | @ <hr> |
| 2323 | onoff_attribute("Search Check-in Comments", "search-ci", "sc", 0, 0); |
| 2324 | @ <br> |
| @@ -2368,10 +2371,11 @@ | |
| 2368 | @ larger repositories.</p> |
| 2369 | select_fts_tokenizer(); |
| 2370 | @ <p><input type="submit" name="fts1" value="Create A Full-Text Index"> |
| 2371 | } |
| 2372 | @ </div></form> |
| 2373 | style_finish_page(); |
| 2374 | } |
| 2375 | |
| 2376 | /* |
| 2377 | ** A URL Alias originally called zOldName is now zNewName/zValue. |
| 2378 |
| --- src/setup.c | |
| +++ src/setup.c | |
| @@ -2282,10 +2282,11 @@ | |
| 2282 | ** WEBPAGE: srchsetup |
| 2283 | ** |
| 2284 | ** Configure the search engine. Requires Admin privilege. |
| 2285 | */ |
| 2286 | void page_srchsetup(){ |
| 2287 | char *zMainBranch; |
| 2288 | login_check_credentials(); |
| 2289 | if( !g.perm.Admin ){ |
| 2290 | login_needed(0); |
| 2291 | return; |
| 2292 | } |
| @@ -2312,13 +2313,15 @@ | |
| 2313 | @ <tr><td>*<td><td>Search all checked-in files</tr> |
| 2314 | @ <tr><td><i>(blank)</i><td> |
| 2315 | @ <td>Search nothing. (Disables document search).</tr> |
| 2316 | @ </table> |
| 2317 | @ <hr> |
| 2318 | zMainBranch = db_get("main-branch", 0); |
| 2319 | entry_attribute("Document Branches", 20, "doc-branch", "db", zMainBranch, 0); |
| 2320 | @ <p>When searching documents, use the versions of the files found at the |
| 2321 | @ type of the "Document Branches" branch. Recommended value: the name of |
| 2322 | @ the main branch (usually "trunk"). |
| 2323 | @ Document search is disabled if blank. It may be a list of branch names |
| 2324 | @ separated by spaces and/or commas. |
| 2325 | @ <hr> |
| 2326 | onoff_attribute("Search Check-in Comments", "search-ci", "sc", 0, 0); |
| 2327 | @ <br> |
| @@ -2368,10 +2371,11 @@ | |
| 2371 | @ larger repositories.</p> |
| 2372 | select_fts_tokenizer(); |
| 2373 | @ <p><input type="submit" name="fts1" value="Create A Full-Text Index"> |
| 2374 | } |
| 2375 | @ </div></form> |
| 2376 | fossil_free(zMainBranch); |
| 2377 | style_finish_page(); |
| 2378 | } |
| 2379 | |
| 2380 | /* |
| 2381 | ** A URL Alias originally called zOldName is now zNewName/zValue. |
| 2382 |
+11
-5
| --- src/tar.c | ||
| +++ src/tar.c | ||
| @@ -884,11 +884,12 @@ | ||
| 884 | 884 | ** Generate a compressed tarball for the check-in specified by VERSION. |
| 885 | 885 | ** The tarball is called NAME.tar.gz and has a top-level directory called |
| 886 | 886 | ** NAME. If TAG is provided, then VERSION must hold TAG or else an error |
| 887 | 887 | ** is returned. |
| 888 | 888 | ** |
| 889 | -** The optional VERSION element defaults to "trunk" per the r= rules below. | |
| 889 | +** The optional VERSION element defaults to the name of the main branch | |
| 890 | +** (usually "trunk") per the r= rules below. | |
| 890 | 891 | ** All of the following URLs are equivalent: |
| 891 | 892 | ** |
| 892 | 893 | ** /tarball/release/xyz.tar.gz |
| 893 | 894 | ** /tarball?r=release&name=xyz.tar.gz |
| 894 | 895 | ** /tarball/xyz.tar.gz?r=release |
| @@ -897,23 +898,26 @@ | ||
| 897 | 898 | ** Query parameters: |
| 898 | 899 | ** |
| 899 | 900 | ** name=[CKIN/]NAME The optional CKIN component of the name= parameter |
| 900 | 901 | ** identifies the check-in from which the tarball is |
| 901 | 902 | ** constructed. If CKIN is omitted and there is no |
| 902 | -** r= query parameter, then use "trunk". NAME is the | |
| 903 | +** r= query parameter, then use the name of the main | |
| 904 | +** branch (usually "trunk"). NAME is the | |
| 903 | 905 | ** name of the download file. The top-level directory |
| 904 | 906 | ** in the generated tarball is called by NAME with the |
| 905 | 907 | ** file extension removed. |
| 906 | 908 | ** |
| 907 | 909 | ** r=TAG TAG identifies the check-in that is turned into a |
| 908 | -** compressed tarball. The default value is "trunk". | |
| 910 | +** compressed tarball. The default value is the name of | |
| 911 | +** the main branch (usually "trunk"). | |
| 909 | 912 | ** If r= is omitted and if the name= query parameter |
| 910 | 913 | ** contains one "/" character then the of part the |
| 911 | 914 | ** name= value before the / becomes the TAG and the |
| 912 | 915 | ** part of the name= value after the / is the download |
| 913 | 916 | ** filename. If no check-in is specified by either |
| 914 | -** name= or r=, then "trunk" is used. | |
| 917 | +** name= or r=, then the name of the main branch | |
| 918 | +** (usually "trunk") is used. | |
| 915 | 919 | ** |
| 916 | 920 | ** in=PATTERN Only include files that match the comma-separate |
| 917 | 921 | ** list of GLOB patterns in PATTERN, as with ex= |
| 918 | 922 | ** |
| 919 | 923 | ** ex=PATTERN Omit any file that match PATTERN. PATTERN is a |
| @@ -945,20 +949,21 @@ | ||
| 945 | 949 | Blob cacheKey; /* The key to cache */ |
| 946 | 950 | Glob *pInclude = 0; /* The compiled in= glob pattern */ |
| 947 | 951 | Glob *pExclude = 0; /* The compiled ex= glob pattern */ |
| 948 | 952 | Blob tarball; /* Tarball accumulated here */ |
| 949 | 953 | const char *z; |
| 954 | + char *zMainBranch = db_get("main-branch", 0); | |
| 950 | 955 | |
| 951 | 956 | login_check_credentials(); |
| 952 | 957 | if( !g.perm.Zip ){ login_needed(g.anon.Zip); return; } |
| 953 | 958 | if( robot_restrict("zip") ) return; |
| 954 | 959 | fossil_nice_default(); |
| 955 | 960 | zName = fossil_strdup(PD("name","")); |
| 956 | 961 | z = P("r"); |
| 957 | 962 | if( z==0 ) z = P("uuid"); |
| 958 | 963 | if( z==0 ) z = tar_uuid_from_name(&zName); |
| 959 | - if( z==0 ) z = "trunk"; | |
| 964 | + if( z==0 ) z = fossil_strdup(zMainBranch); | |
| 960 | 965 | g.zOpenRevision = zRid = fossil_strdup(z); |
| 961 | 966 | nRid = strlen(zRid); |
| 962 | 967 | zInclude = P("in"); |
| 963 | 968 | if( zInclude ) pInclude = glob_create(zInclude); |
| 964 | 969 | zExclude = P("ex"); |
| @@ -1030,10 +1035,11 @@ | ||
| 1030 | 1035 | tarball_of_checkin(rid, &tarball, zName, pInclude, pExclude, 0); |
| 1031 | 1036 | cache_write(&tarball, zKey); |
| 1032 | 1037 | } |
| 1033 | 1038 | glob_free(pInclude); |
| 1034 | 1039 | glob_free(pExclude); |
| 1040 | + fossil_free(zMainBranch); | |
| 1035 | 1041 | fossil_free(zName); |
| 1036 | 1042 | fossil_free(zRid); |
| 1037 | 1043 | g.zOpenRevision = 0; |
| 1038 | 1044 | blob_reset(&cacheKey); |
| 1039 | 1045 | cgi_set_content(&tarball); |
| 1040 | 1046 |
| --- src/tar.c | |
| +++ src/tar.c | |
| @@ -884,11 +884,12 @@ | |
| 884 | ** Generate a compressed tarball for the check-in specified by VERSION. |
| 885 | ** The tarball is called NAME.tar.gz and has a top-level directory called |
| 886 | ** NAME. If TAG is provided, then VERSION must hold TAG or else an error |
| 887 | ** is returned. |
| 888 | ** |
| 889 | ** The optional VERSION element defaults to "trunk" per the r= rules below. |
| 890 | ** All of the following URLs are equivalent: |
| 891 | ** |
| 892 | ** /tarball/release/xyz.tar.gz |
| 893 | ** /tarball?r=release&name=xyz.tar.gz |
| 894 | ** /tarball/xyz.tar.gz?r=release |
| @@ -897,23 +898,26 @@ | |
| 897 | ** Query parameters: |
| 898 | ** |
| 899 | ** name=[CKIN/]NAME The optional CKIN component of the name= parameter |
| 900 | ** identifies the check-in from which the tarball is |
| 901 | ** constructed. If CKIN is omitted and there is no |
| 902 | ** r= query parameter, then use "trunk". NAME is the |
| 903 | ** name of the download file. The top-level directory |
| 904 | ** in the generated tarball is called by NAME with the |
| 905 | ** file extension removed. |
| 906 | ** |
| 907 | ** r=TAG TAG identifies the check-in that is turned into a |
| 908 | ** compressed tarball. The default value is "trunk". |
| 909 | ** If r= is omitted and if the name= query parameter |
| 910 | ** contains one "/" character then the of part the |
| 911 | ** name= value before the / becomes the TAG and the |
| 912 | ** part of the name= value after the / is the download |
| 913 | ** filename. If no check-in is specified by either |
| 914 | ** name= or r=, then "trunk" is used. |
| 915 | ** |
| 916 | ** in=PATTERN Only include files that match the comma-separate |
| 917 | ** list of GLOB patterns in PATTERN, as with ex= |
| 918 | ** |
| 919 | ** ex=PATTERN Omit any file that match PATTERN. PATTERN is a |
| @@ -945,20 +949,21 @@ | |
| 945 | Blob cacheKey; /* The key to cache */ |
| 946 | Glob *pInclude = 0; /* The compiled in= glob pattern */ |
| 947 | Glob *pExclude = 0; /* The compiled ex= glob pattern */ |
| 948 | Blob tarball; /* Tarball accumulated here */ |
| 949 | const char *z; |
| 950 | |
| 951 | login_check_credentials(); |
| 952 | if( !g.perm.Zip ){ login_needed(g.anon.Zip); return; } |
| 953 | if( robot_restrict("zip") ) return; |
| 954 | fossil_nice_default(); |
| 955 | zName = fossil_strdup(PD("name","")); |
| 956 | z = P("r"); |
| 957 | if( z==0 ) z = P("uuid"); |
| 958 | if( z==0 ) z = tar_uuid_from_name(&zName); |
| 959 | if( z==0 ) z = "trunk"; |
| 960 | g.zOpenRevision = zRid = fossil_strdup(z); |
| 961 | nRid = strlen(zRid); |
| 962 | zInclude = P("in"); |
| 963 | if( zInclude ) pInclude = glob_create(zInclude); |
| 964 | zExclude = P("ex"); |
| @@ -1030,10 +1035,11 @@ | |
| 1030 | tarball_of_checkin(rid, &tarball, zName, pInclude, pExclude, 0); |
| 1031 | cache_write(&tarball, zKey); |
| 1032 | } |
| 1033 | glob_free(pInclude); |
| 1034 | glob_free(pExclude); |
| 1035 | fossil_free(zName); |
| 1036 | fossil_free(zRid); |
| 1037 | g.zOpenRevision = 0; |
| 1038 | blob_reset(&cacheKey); |
| 1039 | cgi_set_content(&tarball); |
| 1040 |
| --- src/tar.c | |
| +++ src/tar.c | |
| @@ -884,11 +884,12 @@ | |
| 884 | ** Generate a compressed tarball for the check-in specified by VERSION. |
| 885 | ** The tarball is called NAME.tar.gz and has a top-level directory called |
| 886 | ** NAME. If TAG is provided, then VERSION must hold TAG or else an error |
| 887 | ** is returned. |
| 888 | ** |
| 889 | ** The optional VERSION element defaults to the name of the main branch |
| 890 | ** (usually "trunk") per the r= rules below. |
| 891 | ** All of the following URLs are equivalent: |
| 892 | ** |
| 893 | ** /tarball/release/xyz.tar.gz |
| 894 | ** /tarball?r=release&name=xyz.tar.gz |
| 895 | ** /tarball/xyz.tar.gz?r=release |
| @@ -897,23 +898,26 @@ | |
| 898 | ** Query parameters: |
| 899 | ** |
| 900 | ** name=[CKIN/]NAME The optional CKIN component of the name= parameter |
| 901 | ** identifies the check-in from which the tarball is |
| 902 | ** constructed. If CKIN is omitted and there is no |
| 903 | ** r= query parameter, then use the name of the main |
| 904 | ** branch (usually "trunk"). NAME is the |
| 905 | ** name of the download file. The top-level directory |
| 906 | ** in the generated tarball is called by NAME with the |
| 907 | ** file extension removed. |
| 908 | ** |
| 909 | ** r=TAG TAG identifies the check-in that is turned into a |
| 910 | ** compressed tarball. The default value is the name of |
| 911 | ** the main branch (usually "trunk"). |
| 912 | ** If r= is omitted and if the name= query parameter |
| 913 | ** contains one "/" character then the of part the |
| 914 | ** name= value before the / becomes the TAG and the |
| 915 | ** part of the name= value after the / is the download |
| 916 | ** filename. If no check-in is specified by either |
| 917 | ** name= or r=, then the name of the main branch |
| 918 | ** (usually "trunk") is used. |
| 919 | ** |
| 920 | ** in=PATTERN Only include files that match the comma-separate |
| 921 | ** list of GLOB patterns in PATTERN, as with ex= |
| 922 | ** |
| 923 | ** ex=PATTERN Omit any file that match PATTERN. PATTERN is a |
| @@ -945,20 +949,21 @@ | |
| 949 | Blob cacheKey; /* The key to cache */ |
| 950 | Glob *pInclude = 0; /* The compiled in= glob pattern */ |
| 951 | Glob *pExclude = 0; /* The compiled ex= glob pattern */ |
| 952 | Blob tarball; /* Tarball accumulated here */ |
| 953 | const char *z; |
| 954 | char *zMainBranch = db_get("main-branch", 0); |
| 955 | |
| 956 | login_check_credentials(); |
| 957 | if( !g.perm.Zip ){ login_needed(g.anon.Zip); return; } |
| 958 | if( robot_restrict("zip") ) return; |
| 959 | fossil_nice_default(); |
| 960 | zName = fossil_strdup(PD("name","")); |
| 961 | z = P("r"); |
| 962 | if( z==0 ) z = P("uuid"); |
| 963 | if( z==0 ) z = tar_uuid_from_name(&zName); |
| 964 | if( z==0 ) z = fossil_strdup(zMainBranch); |
| 965 | g.zOpenRevision = zRid = fossil_strdup(z); |
| 966 | nRid = strlen(zRid); |
| 967 | zInclude = P("in"); |
| 968 | if( zInclude ) pInclude = glob_create(zInclude); |
| 969 | zExclude = P("ex"); |
| @@ -1030,10 +1035,11 @@ | |
| 1035 | tarball_of_checkin(rid, &tarball, zName, pInclude, pExclude, 0); |
| 1036 | cache_write(&tarball, zKey); |
| 1037 | } |
| 1038 | glob_free(pInclude); |
| 1039 | glob_free(pExclude); |
| 1040 | fossil_free(zMainBranch); |
| 1041 | fossil_free(zName); |
| 1042 | fossil_free(zRid); |
| 1043 | g.zOpenRevision = 0; |
| 1044 | blob_reset(&cacheKey); |
| 1045 | cgi_set_content(&tarball); |
| 1046 |
+2
-1
| --- src/timeline.c | ||
| +++ src/timeline.c | ||
| @@ -592,11 +592,11 @@ | ||
| 592 | 592 | zBr = branch_of_rid(rid); |
| 593 | 593 | if( zBgClr==0 || (tmFlags & TIMELINE_BRCOLOR)!=0 ){ |
| 594 | 594 | /* If no background color is specified, use a color based on the |
| 595 | 595 | ** branch name */ |
| 596 | 596 | if( tmFlags & (TIMELINE_DELTA|TIMELINE_NOCOLOR) ){ |
| 597 | - }else if( zBr==0 || strcmp(zBr,zMainBranch)==0 ){ | |
| 597 | + }else if( zBr==0 || strcmp(zBr, zMainBranch)==0 ){ | |
| 598 | 598 | zBgClr = 0; |
| 599 | 599 | }else{ |
| 600 | 600 | zBgClr = hash_color(zBr); |
| 601 | 601 | } |
| 602 | 602 | } |
| @@ -640,10 +640,11 @@ | ||
| 640 | 640 | ** not actually draw anything on the graph, but it will set the |
| 641 | 641 | ** background color of the timeline entry */ |
| 642 | 642 | gidx = graph_add_row(pGraph, rid, -1, 0, 0, zBr, zBgClr, zUuid, 0); |
| 643 | 643 | @ <div id="m%d(gidx)" class="tl-nodemark"></div> |
| 644 | 644 | } |
| 645 | + fossil_free(zMainBranch); | |
| 645 | 646 | fossil_free(zBr); |
| 646 | 647 | @</td> |
| 647 | 648 | if( !isSelectedOrCurrent ){ |
| 648 | 649 | @ <td class="timeline%s(zStyle)Cell%s(zExtraClass)" id='mc%d(gidx)'> |
| 649 | 650 | }else{ |
| 650 | 651 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -592,11 +592,11 @@ | |
| 592 | zBr = branch_of_rid(rid); |
| 593 | if( zBgClr==0 || (tmFlags & TIMELINE_BRCOLOR)!=0 ){ |
| 594 | /* If no background color is specified, use a color based on the |
| 595 | ** branch name */ |
| 596 | if( tmFlags & (TIMELINE_DELTA|TIMELINE_NOCOLOR) ){ |
| 597 | }else if( zBr==0 || strcmp(zBr,zMainBranch)==0 ){ |
| 598 | zBgClr = 0; |
| 599 | }else{ |
| 600 | zBgClr = hash_color(zBr); |
| 601 | } |
| 602 | } |
| @@ -640,10 +640,11 @@ | |
| 640 | ** not actually draw anything on the graph, but it will set the |
| 641 | ** background color of the timeline entry */ |
| 642 | gidx = graph_add_row(pGraph, rid, -1, 0, 0, zBr, zBgClr, zUuid, 0); |
| 643 | @ <div id="m%d(gidx)" class="tl-nodemark"></div> |
| 644 | } |
| 645 | fossil_free(zBr); |
| 646 | @</td> |
| 647 | if( !isSelectedOrCurrent ){ |
| 648 | @ <td class="timeline%s(zStyle)Cell%s(zExtraClass)" id='mc%d(gidx)'> |
| 649 | }else{ |
| 650 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -592,11 +592,11 @@ | |
| 592 | zBr = branch_of_rid(rid); |
| 593 | if( zBgClr==0 || (tmFlags & TIMELINE_BRCOLOR)!=0 ){ |
| 594 | /* If no background color is specified, use a color based on the |
| 595 | ** branch name */ |
| 596 | if( tmFlags & (TIMELINE_DELTA|TIMELINE_NOCOLOR) ){ |
| 597 | }else if( zBr==0 || strcmp(zBr, zMainBranch)==0 ){ |
| 598 | zBgClr = 0; |
| 599 | }else{ |
| 600 | zBgClr = hash_color(zBr); |
| 601 | } |
| 602 | } |
| @@ -640,10 +640,11 @@ | |
| 640 | ** not actually draw anything on the graph, but it will set the |
| 641 | ** background color of the timeline entry */ |
| 642 | gidx = graph_add_row(pGraph, rid, -1, 0, 0, zBr, zBgClr, zUuid, 0); |
| 643 | @ <div id="m%d(gidx)" class="tl-nodemark"></div> |
| 644 | } |
| 645 | fossil_free(zMainBranch); |
| 646 | fossil_free(zBr); |
| 647 | @</td> |
| 648 | if( !isSelectedOrCurrent ){ |
| 649 | @ <td class="timeline%s(zStyle)Cell%s(zExtraClass)" id='mc%d(gidx)'> |
| 650 | }else{ |
| 651 |
+3
-1
| --- src/update.c | ||
| +++ src/update.c | ||
| @@ -751,16 +751,18 @@ | ||
| 751 | 751 | Manifest *historical_manifest( |
| 752 | 752 | const char *zRevision /* The check-in to query, or NULL for current */ |
| 753 | 753 | ){ |
| 754 | 754 | int vid; |
| 755 | 755 | Manifest *pManifest; |
| 756 | + char *zMainBranch = db_get("main-branch", 0); | |
| 756 | 757 | |
| 757 | 758 | /* Determine the check-in manifest artifact ID. Panic on failure. */ |
| 758 | 759 | if( zRevision ){ |
| 759 | 760 | vid = name_to_typed_rid(zRevision, "ci"); |
| 760 | 761 | }else if( !g.localOpen ){ |
| 761 | - vid = name_to_typed_rid(db_get("main-branch", 0), "ci"); | |
| 762 | + vid = name_to_typed_rid(zMainBranch, "ci"); | |
| 763 | + fossil_free(zMainBranch); | |
| 762 | 764 | }else{ |
| 763 | 765 | vid = db_lget_int("checkout", 0); |
| 764 | 766 | if( !is_a_version(vid) ){ |
| 765 | 767 | if( vid==0 ) return 0; |
| 766 | 768 | zRevision = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", vid); |
| 767 | 769 |
| --- src/update.c | |
| +++ src/update.c | |
| @@ -751,16 +751,18 @@ | |
| 751 | Manifest *historical_manifest( |
| 752 | const char *zRevision /* The check-in to query, or NULL for current */ |
| 753 | ){ |
| 754 | int vid; |
| 755 | Manifest *pManifest; |
| 756 | |
| 757 | /* Determine the check-in manifest artifact ID. Panic on failure. */ |
| 758 | if( zRevision ){ |
| 759 | vid = name_to_typed_rid(zRevision, "ci"); |
| 760 | }else if( !g.localOpen ){ |
| 761 | vid = name_to_typed_rid(db_get("main-branch", 0), "ci"); |
| 762 | }else{ |
| 763 | vid = db_lget_int("checkout", 0); |
| 764 | if( !is_a_version(vid) ){ |
| 765 | if( vid==0 ) return 0; |
| 766 | zRevision = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", vid); |
| 767 |
| --- src/update.c | |
| +++ src/update.c | |
| @@ -751,16 +751,18 @@ | |
| 751 | Manifest *historical_manifest( |
| 752 | const char *zRevision /* The check-in to query, or NULL for current */ |
| 753 | ){ |
| 754 | int vid; |
| 755 | Manifest *pManifest; |
| 756 | char *zMainBranch = db_get("main-branch", 0); |
| 757 | |
| 758 | /* Determine the check-in manifest artifact ID. Panic on failure. */ |
| 759 | if( zRevision ){ |
| 760 | vid = name_to_typed_rid(zRevision, "ci"); |
| 761 | }else if( !g.localOpen ){ |
| 762 | vid = name_to_typed_rid(zMainBranch, "ci"); |
| 763 | fossil_free(zMainBranch); |
| 764 | }else{ |
| 765 | vid = db_lget_int("checkout", 0); |
| 766 | if( !is_a_version(vid) ){ |
| 767 | if( vid==0 ) return 0; |
| 768 | zRevision = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", vid); |
| 769 |
+11
-5
| --- src/zip.c | ||
| +++ src/zip.c | ||
| @@ -953,11 +953,12 @@ | ||
| 953 | 953 | ** |
| 954 | 954 | ** Generate a ZIP Archive or an SQL Archive for the check-in specified by |
| 955 | 955 | ** VERSION. The archive is called NAME.zip or NAME.sqlar and has a top-level |
| 956 | 956 | ** directory called NAME. |
| 957 | 957 | ** |
| 958 | -** The optional VERSION element defaults to "trunk" per the r= rules below. | |
| 958 | +** The optional VERSION element defaults to the name of the main branch | |
| 959 | +** (usually "trunk") per the r= rules below. | |
| 959 | 960 | ** All of the following URLs are equivalent: |
| 960 | 961 | ** |
| 961 | 962 | ** /zip/release/xyz.zip |
| 962 | 963 | ** /zip?r=release&name=xyz.zip |
| 963 | 964 | ** /zip/xyz.zip?r=release |
| @@ -966,23 +967,26 @@ | ||
| 966 | 967 | ** Query parameters: |
| 967 | 968 | ** |
| 968 | 969 | ** name=[CKIN/]NAME The optional CKIN component of the name= parameter |
| 969 | 970 | ** identifies the check-in from which the archive is |
| 970 | 971 | ** constructed. If CKIN is omitted and there is no |
| 971 | -** r= query parameter, then use "trunk". NAME is the | |
| 972 | +** r= query parameter, then use the name of the main | |
| 973 | +** branch (usually "trunk"). NAME is the | |
| 972 | 974 | ** name of the download file. The top-level directory |
| 973 | 975 | ** in the generated archive is called by NAME with the |
| 974 | 976 | ** file extension removed. |
| 975 | 977 | ** |
| 976 | 978 | ** r=TAG TAG identifies the check-in that is turned into an |
| 977 | -** SQL or ZIP archive. The default value is "trunk". | |
| 979 | +** SQL or ZIP archive. The default value is the name | |
| 980 | +** of the main branch (usually "trunk"). | |
| 978 | 981 | ** If r= is omitted and if the name= query parameter |
| 979 | 982 | ** contains one "/" character then the of part the |
| 980 | 983 | ** name= value before the / becomes the TAG and the |
| 981 | 984 | ** part of the name= value after the / is the download |
| 982 | 985 | ** filename. If no check-in is specified by either |
| 983 | -** name= or r=, then "trunk" is used. | |
| 986 | +** name= or r=, then the name of the main branch | |
| 987 | +** (usually "trunk") is used. | |
| 984 | 988 | ** |
| 985 | 989 | ** in=PATTERN Only include files that match the comma-separate |
| 986 | 990 | ** list of GLOB patterns in PATTERN, as with ex= |
| 987 | 991 | ** |
| 988 | 992 | ** ex=PATTERN Omit any file that match PATTERN. PATTERN is a |
| @@ -1016,10 +1020,11 @@ | ||
| 1016 | 1020 | Glob *pInclude = 0; /* The compiled in= glob pattern */ |
| 1017 | 1021 | Glob *pExclude = 0; /* The compiled ex= glob pattern */ |
| 1018 | 1022 | Blob zip; /* ZIP archive accumulated here */ |
| 1019 | 1023 | int eType = ARCHIVE_ZIP; /* Type of archive to generate */ |
| 1020 | 1024 | char *zType; /* Human-readable archive type */ |
| 1025 | + char *zMainBranch = db_get("main-branch", 0); | |
| 1021 | 1026 | |
| 1022 | 1027 | login_check_credentials(); |
| 1023 | 1028 | if( !g.perm.Zip ){ login_needed(g.anon.Zip); return; } |
| 1024 | 1029 | if( robot_restrict("zip") ) return; |
| 1025 | 1030 | if( fossil_strcmp(g.zPath, "sqlar")==0 ){ |
| @@ -1032,11 +1037,11 @@ | ||
| 1032 | 1037 | fossil_nice_default(); |
| 1033 | 1038 | zName = fossil_strdup(PD("name","")); |
| 1034 | 1039 | z = P("r"); |
| 1035 | 1040 | if( z==0 ) z = P("uuid"); |
| 1036 | 1041 | if( z==0 ) z = tar_uuid_from_name(&zName); |
| 1037 | - if( z==0 ) z = "trunk"; | |
| 1042 | + if( z==0 ) z = fossil_strdup(zMainBranch); | |
| 1038 | 1043 | nName = strlen(zName); |
| 1039 | 1044 | g.zOpenRevision = zRid = fossil_strdup(z); |
| 1040 | 1045 | nRid = strlen(zRid); |
| 1041 | 1046 | zInclude = P("in"); |
| 1042 | 1047 | if( zInclude ) pInclude = glob_create(zInclude); |
| @@ -1119,10 +1124,11 @@ | ||
| 1119 | 1124 | zip_of_checkin(eType, rid, &zip, zName, pInclude, pExclude, 0); |
| 1120 | 1125 | cache_write(&zip, zKey); |
| 1121 | 1126 | } |
| 1122 | 1127 | glob_free(pInclude); |
| 1123 | 1128 | glob_free(pExclude); |
| 1129 | + fossil_free(zMainBranch); | |
| 1124 | 1130 | fossil_free(zName); |
| 1125 | 1131 | fossil_free(zRid); |
| 1126 | 1132 | g.zOpenRevision = 0; |
| 1127 | 1133 | blob_reset(&cacheKey); |
| 1128 | 1134 | cgi_set_content(&zip); |
| 1129 | 1135 |
| --- src/zip.c | |
| +++ src/zip.c | |
| @@ -953,11 +953,12 @@ | |
| 953 | ** |
| 954 | ** Generate a ZIP Archive or an SQL Archive for the check-in specified by |
| 955 | ** VERSION. The archive is called NAME.zip or NAME.sqlar and has a top-level |
| 956 | ** directory called NAME. |
| 957 | ** |
| 958 | ** The optional VERSION element defaults to "trunk" per the r= rules below. |
| 959 | ** All of the following URLs are equivalent: |
| 960 | ** |
| 961 | ** /zip/release/xyz.zip |
| 962 | ** /zip?r=release&name=xyz.zip |
| 963 | ** /zip/xyz.zip?r=release |
| @@ -966,23 +967,26 @@ | |
| 966 | ** Query parameters: |
| 967 | ** |
| 968 | ** name=[CKIN/]NAME The optional CKIN component of the name= parameter |
| 969 | ** identifies the check-in from which the archive is |
| 970 | ** constructed. If CKIN is omitted and there is no |
| 971 | ** r= query parameter, then use "trunk". NAME is the |
| 972 | ** name of the download file. The top-level directory |
| 973 | ** in the generated archive is called by NAME with the |
| 974 | ** file extension removed. |
| 975 | ** |
| 976 | ** r=TAG TAG identifies the check-in that is turned into an |
| 977 | ** SQL or ZIP archive. The default value is "trunk". |
| 978 | ** If r= is omitted and if the name= query parameter |
| 979 | ** contains one "/" character then the of part the |
| 980 | ** name= value before the / becomes the TAG and the |
| 981 | ** part of the name= value after the / is the download |
| 982 | ** filename. If no check-in is specified by either |
| 983 | ** name= or r=, then "trunk" is used. |
| 984 | ** |
| 985 | ** in=PATTERN Only include files that match the comma-separate |
| 986 | ** list of GLOB patterns in PATTERN, as with ex= |
| 987 | ** |
| 988 | ** ex=PATTERN Omit any file that match PATTERN. PATTERN is a |
| @@ -1016,10 +1020,11 @@ | |
| 1016 | Glob *pInclude = 0; /* The compiled in= glob pattern */ |
| 1017 | Glob *pExclude = 0; /* The compiled ex= glob pattern */ |
| 1018 | Blob zip; /* ZIP archive accumulated here */ |
| 1019 | int eType = ARCHIVE_ZIP; /* Type of archive to generate */ |
| 1020 | char *zType; /* Human-readable archive type */ |
| 1021 | |
| 1022 | login_check_credentials(); |
| 1023 | if( !g.perm.Zip ){ login_needed(g.anon.Zip); return; } |
| 1024 | if( robot_restrict("zip") ) return; |
| 1025 | if( fossil_strcmp(g.zPath, "sqlar")==0 ){ |
| @@ -1032,11 +1037,11 @@ | |
| 1032 | fossil_nice_default(); |
| 1033 | zName = fossil_strdup(PD("name","")); |
| 1034 | z = P("r"); |
| 1035 | if( z==0 ) z = P("uuid"); |
| 1036 | if( z==0 ) z = tar_uuid_from_name(&zName); |
| 1037 | if( z==0 ) z = "trunk"; |
| 1038 | nName = strlen(zName); |
| 1039 | g.zOpenRevision = zRid = fossil_strdup(z); |
| 1040 | nRid = strlen(zRid); |
| 1041 | zInclude = P("in"); |
| 1042 | if( zInclude ) pInclude = glob_create(zInclude); |
| @@ -1119,10 +1124,11 @@ | |
| 1119 | zip_of_checkin(eType, rid, &zip, zName, pInclude, pExclude, 0); |
| 1120 | cache_write(&zip, zKey); |
| 1121 | } |
| 1122 | glob_free(pInclude); |
| 1123 | glob_free(pExclude); |
| 1124 | fossil_free(zName); |
| 1125 | fossil_free(zRid); |
| 1126 | g.zOpenRevision = 0; |
| 1127 | blob_reset(&cacheKey); |
| 1128 | cgi_set_content(&zip); |
| 1129 |
| --- src/zip.c | |
| +++ src/zip.c | |
| @@ -953,11 +953,12 @@ | |
| 953 | ** |
| 954 | ** Generate a ZIP Archive or an SQL Archive for the check-in specified by |
| 955 | ** VERSION. The archive is called NAME.zip or NAME.sqlar and has a top-level |
| 956 | ** directory called NAME. |
| 957 | ** |
| 958 | ** The optional VERSION element defaults to the name of the main branch |
| 959 | ** (usually "trunk") per the r= rules below. |
| 960 | ** All of the following URLs are equivalent: |
| 961 | ** |
| 962 | ** /zip/release/xyz.zip |
| 963 | ** /zip?r=release&name=xyz.zip |
| 964 | ** /zip/xyz.zip?r=release |
| @@ -966,23 +967,26 @@ | |
| 967 | ** Query parameters: |
| 968 | ** |
| 969 | ** name=[CKIN/]NAME The optional CKIN component of the name= parameter |
| 970 | ** identifies the check-in from which the archive is |
| 971 | ** constructed. If CKIN is omitted and there is no |
| 972 | ** r= query parameter, then use the name of the main |
| 973 | ** branch (usually "trunk"). NAME is the |
| 974 | ** name of the download file. The top-level directory |
| 975 | ** in the generated archive is called by NAME with the |
| 976 | ** file extension removed. |
| 977 | ** |
| 978 | ** r=TAG TAG identifies the check-in that is turned into an |
| 979 | ** SQL or ZIP archive. The default value is the name |
| 980 | ** of the main branch (usually "trunk"). |
| 981 | ** If r= is omitted and if the name= query parameter |
| 982 | ** contains one "/" character then the of part the |
| 983 | ** name= value before the / becomes the TAG and the |
| 984 | ** part of the name= value after the / is the download |
| 985 | ** filename. If no check-in is specified by either |
| 986 | ** name= or r=, then the name of the main branch |
| 987 | ** (usually "trunk") is used. |
| 988 | ** |
| 989 | ** in=PATTERN Only include files that match the comma-separate |
| 990 | ** list of GLOB patterns in PATTERN, as with ex= |
| 991 | ** |
| 992 | ** ex=PATTERN Omit any file that match PATTERN. PATTERN is a |
| @@ -1016,10 +1020,11 @@ | |
| 1020 | Glob *pInclude = 0; /* The compiled in= glob pattern */ |
| 1021 | Glob *pExclude = 0; /* The compiled ex= glob pattern */ |
| 1022 | Blob zip; /* ZIP archive accumulated here */ |
| 1023 | int eType = ARCHIVE_ZIP; /* Type of archive to generate */ |
| 1024 | char *zType; /* Human-readable archive type */ |
| 1025 | char *zMainBranch = db_get("main-branch", 0); |
| 1026 | |
| 1027 | login_check_credentials(); |
| 1028 | if( !g.perm.Zip ){ login_needed(g.anon.Zip); return; } |
| 1029 | if( robot_restrict("zip") ) return; |
| 1030 | if( fossil_strcmp(g.zPath, "sqlar")==0 ){ |
| @@ -1032,11 +1037,11 @@ | |
| 1037 | fossil_nice_default(); |
| 1038 | zName = fossil_strdup(PD("name","")); |
| 1039 | z = P("r"); |
| 1040 | if( z==0 ) z = P("uuid"); |
| 1041 | if( z==0 ) z = tar_uuid_from_name(&zName); |
| 1042 | if( z==0 ) z = fossil_strdup(zMainBranch); |
| 1043 | nName = strlen(zName); |
| 1044 | g.zOpenRevision = zRid = fossil_strdup(z); |
| 1045 | nRid = strlen(zRid); |
| 1046 | zInclude = P("in"); |
| 1047 | if( zInclude ) pInclude = glob_create(zInclude); |
| @@ -1119,10 +1124,11 @@ | |
| 1124 | zip_of_checkin(eType, rid, &zip, zName, pInclude, pExclude, 0); |
| 1125 | cache_write(&zip, zKey); |
| 1126 | } |
| 1127 | glob_free(pInclude); |
| 1128 | glob_free(pExclude); |
| 1129 | fossil_free(zMainBranch); |
| 1130 | fossil_free(zName); |
| 1131 | fossil_free(zRid); |
| 1132 | g.zOpenRevision = 0; |
| 1133 | blob_reset(&cacheKey); |
| 1134 | cgi_set_content(&zip); |
| 1135 |