Fossil SCM
Merge the root-tag branch into trunk.
Commit
9f83e033a2304a95eae85a1676cc78ea21370fa1
Parent
31545360abfca7a…
3 files changed
+10
+14
-3
+23
+10
| --- src/diffcmd.c | ||
| +++ src/diffcmd.c | ||
| @@ -481,10 +481,11 @@ | ||
| 481 | 481 | ** |
| 482 | 482 | ** The "-N" or "--new-file" option causes the complete text of added or |
| 483 | 483 | ** deleted files to be displayed. |
| 484 | 484 | ** |
| 485 | 485 | ** Options: |
| 486 | +** --branch BRANCH Show diff of all changes on BRANCH | |
| 486 | 487 | ** --brief Show filenames only |
| 487 | 488 | ** --context|-c N Use N lines of context |
| 488 | 489 | ** --from|-r VERSION select VERSION as source for the diff |
| 489 | 490 | ** -i use internal diff logic |
| 490 | 491 | ** --new-file|-N output complete text of added or deleted files |
| @@ -496,22 +497,31 @@ | ||
| 496 | 497 | int isGDiff; /* True for gdiff. False for normal diff */ |
| 497 | 498 | int isInternDiff; /* True for internal diff */ |
| 498 | 499 | int hasNFlag; /* True if -N or --new-file flag is used */ |
| 499 | 500 | const char *zFrom; /* Source version number */ |
| 500 | 501 | const char *zTo; /* Target version number */ |
| 502 | + const char *zBranch; /* Branch to diff */ | |
| 501 | 503 | const char *zDiffCmd = 0; /* External diff command. NULL for internal diff */ |
| 502 | 504 | int diffFlags = 0; /* Flags to control the DIFF */ |
| 503 | 505 | int f; |
| 504 | 506 | |
| 505 | 507 | isGDiff = g.argv[1][0]=='g'; |
| 506 | 508 | isInternDiff = find_option("internal","i",0)!=0; |
| 507 | 509 | zFrom = find_option("from", "r", 1); |
| 508 | 510 | zTo = find_option("to", 0, 1); |
| 511 | + zBranch = find_option("branch", 0, 1); | |
| 509 | 512 | diffFlags = diff_options(); |
| 510 | 513 | hasNFlag = find_option("new-file","N",0)!=0; |
| 511 | 514 | if( hasNFlag ) diffFlags |= DIFF_NEWFILE; |
| 512 | 515 | |
| 516 | + if( zBranch ){ | |
| 517 | + if( zTo || zFrom ){ | |
| 518 | + fossil_fatal("cannot use --from or --to with --branch"); | |
| 519 | + } | |
| 520 | + zTo = zBranch; | |
| 521 | + zFrom = mprintf("root:%s", zBranch); | |
| 522 | + } | |
| 513 | 523 | if( zTo==0 ){ |
| 514 | 524 | db_must_be_within_tree(); |
| 515 | 525 | verify_all_options(); |
| 516 | 526 | if( !isInternDiff ){ |
| 517 | 527 | zDiffCmd = db_get(isGDiff ? "gdiff-command" : "diff-command", 0); |
| 518 | 528 |
| --- src/diffcmd.c | |
| +++ src/diffcmd.c | |
| @@ -481,10 +481,11 @@ | |
| 481 | ** |
| 482 | ** The "-N" or "--new-file" option causes the complete text of added or |
| 483 | ** deleted files to be displayed. |
| 484 | ** |
| 485 | ** Options: |
| 486 | ** --brief Show filenames only |
| 487 | ** --context|-c N Use N lines of context |
| 488 | ** --from|-r VERSION select VERSION as source for the diff |
| 489 | ** -i use internal diff logic |
| 490 | ** --new-file|-N output complete text of added or deleted files |
| @@ -496,22 +497,31 @@ | |
| 496 | int isGDiff; /* True for gdiff. False for normal diff */ |
| 497 | int isInternDiff; /* True for internal diff */ |
| 498 | int hasNFlag; /* True if -N or --new-file flag is used */ |
| 499 | const char *zFrom; /* Source version number */ |
| 500 | const char *zTo; /* Target version number */ |
| 501 | const char *zDiffCmd = 0; /* External diff command. NULL for internal diff */ |
| 502 | int diffFlags = 0; /* Flags to control the DIFF */ |
| 503 | int f; |
| 504 | |
| 505 | isGDiff = g.argv[1][0]=='g'; |
| 506 | isInternDiff = find_option("internal","i",0)!=0; |
| 507 | zFrom = find_option("from", "r", 1); |
| 508 | zTo = find_option("to", 0, 1); |
| 509 | diffFlags = diff_options(); |
| 510 | hasNFlag = find_option("new-file","N",0)!=0; |
| 511 | if( hasNFlag ) diffFlags |= DIFF_NEWFILE; |
| 512 | |
| 513 | if( zTo==0 ){ |
| 514 | db_must_be_within_tree(); |
| 515 | verify_all_options(); |
| 516 | if( !isInternDiff ){ |
| 517 | zDiffCmd = db_get(isGDiff ? "gdiff-command" : "diff-command", 0); |
| 518 |
| --- src/diffcmd.c | |
| +++ src/diffcmd.c | |
| @@ -481,10 +481,11 @@ | |
| 481 | ** |
| 482 | ** The "-N" or "--new-file" option causes the complete text of added or |
| 483 | ** deleted files to be displayed. |
| 484 | ** |
| 485 | ** Options: |
| 486 | ** --branch BRANCH Show diff of all changes on BRANCH |
| 487 | ** --brief Show filenames only |
| 488 | ** --context|-c N Use N lines of context |
| 489 | ** --from|-r VERSION select VERSION as source for the diff |
| 490 | ** -i use internal diff logic |
| 491 | ** --new-file|-N output complete text of added or deleted files |
| @@ -496,22 +497,31 @@ | |
| 497 | int isGDiff; /* True for gdiff. False for normal diff */ |
| 498 | int isInternDiff; /* True for internal diff */ |
| 499 | int hasNFlag; /* True if -N or --new-file flag is used */ |
| 500 | const char *zFrom; /* Source version number */ |
| 501 | const char *zTo; /* Target version number */ |
| 502 | const char *zBranch; /* Branch to diff */ |
| 503 | const char *zDiffCmd = 0; /* External diff command. NULL for internal diff */ |
| 504 | int diffFlags = 0; /* Flags to control the DIFF */ |
| 505 | int f; |
| 506 | |
| 507 | isGDiff = g.argv[1][0]=='g'; |
| 508 | isInternDiff = find_option("internal","i",0)!=0; |
| 509 | zFrom = find_option("from", "r", 1); |
| 510 | zTo = find_option("to", 0, 1); |
| 511 | zBranch = find_option("branch", 0, 1); |
| 512 | diffFlags = diff_options(); |
| 513 | hasNFlag = find_option("new-file","N",0)!=0; |
| 514 | if( hasNFlag ) diffFlags |= DIFF_NEWFILE; |
| 515 | |
| 516 | if( zBranch ){ |
| 517 | if( zTo || zFrom ){ |
| 518 | fossil_fatal("cannot use --from or --to with --branch"); |
| 519 | } |
| 520 | zTo = zBranch; |
| 521 | zFrom = mprintf("root:%s", zBranch); |
| 522 | } |
| 523 | if( zTo==0 ){ |
| 524 | db_must_be_within_tree(); |
| 525 | verify_all_options(); |
| 526 | if( !isInternDiff ){ |
| 527 | zDiffCmd = db_get(isGDiff ? "gdiff-command" : "diff-command", 0); |
| 528 |
+14
-3
| --- src/info.c | ||
| +++ src/info.c | ||
| @@ -754,11 +754,16 @@ | ||
| 754 | 754 | static Manifest *vdiff_parse_manifest(const char *zParam, int *pRid){ |
| 755 | 755 | int rid; |
| 756 | 756 | |
| 757 | 757 | *pRid = rid = name_to_rid_www(zParam); |
| 758 | 758 | if( rid==0 ){ |
| 759 | - webpage_error("Missing \"%s\" query parameter.", zParam); | |
| 759 | + const char *z = P(zParam); | |
| 760 | + if( z==0 || z[0]==0 ){ | |
| 761 | + webpage_error("Missing \"%s\" query parameter.", zParam); | |
| 762 | + }else{ | |
| 763 | + webpage_error("No such artifact: \"%s\"", z); | |
| 764 | + } | |
| 760 | 765 | return 0; |
| 761 | 766 | } |
| 762 | 767 | if( !is_a_version(rid) ){ |
| 763 | 768 | webpage_error("Artifact %s is not a checkin.", P(zParam)); |
| 764 | 769 | return 0; |
| @@ -805,19 +810,25 @@ | ||
| 805 | 810 | int showDetail = 0; |
| 806 | 811 | int sideBySide = 0; |
| 807 | 812 | int diffFlags = 0; |
| 808 | 813 | Manifest *pFrom, *pTo; |
| 809 | 814 | ManifestFile *pFileFrom, *pFileTo; |
| 815 | + const char *zBranch; | |
| 810 | 816 | |
| 811 | 817 | login_check_credentials(); |
| 812 | 818 | if( !g.perm.Read ){ login_needed(); return; } |
| 813 | 819 | login_anonymous_available(); |
| 814 | 820 | |
| 815 | - pFrom = vdiff_parse_manifest("from", &ridFrom); | |
| 816 | - if( pFrom==0 ) return; | |
| 821 | + zBranch = P("branch"); | |
| 822 | + if( zBranch && zBranch[0] ){ | |
| 823 | + cgi_replace_parameter("from", mprintf("root:%s", zBranch)); | |
| 824 | + cgi_replace_parameter("to", zBranch); | |
| 825 | + } | |
| 817 | 826 | pTo = vdiff_parse_manifest("to", &ridTo); |
| 818 | 827 | if( pTo==0 ) return; |
| 828 | + pFrom = vdiff_parse_manifest("from", &ridFrom); | |
| 829 | + if( pFrom==0 ) return; | |
| 819 | 830 | sideBySide = atoi(PD("sbs","1")); |
| 820 | 831 | showDetail = atoi(PD("detail","0")); |
| 821 | 832 | if( !showDetail && sideBySide ) showDetail = 1; |
| 822 | 833 | if( !sideBySide ){ |
| 823 | 834 | style_submenu_element("Side-by-side Diff", "sbsdiff", |
| 824 | 835 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -754,11 +754,16 @@ | |
| 754 | static Manifest *vdiff_parse_manifest(const char *zParam, int *pRid){ |
| 755 | int rid; |
| 756 | |
| 757 | *pRid = rid = name_to_rid_www(zParam); |
| 758 | if( rid==0 ){ |
| 759 | webpage_error("Missing \"%s\" query parameter.", zParam); |
| 760 | return 0; |
| 761 | } |
| 762 | if( !is_a_version(rid) ){ |
| 763 | webpage_error("Artifact %s is not a checkin.", P(zParam)); |
| 764 | return 0; |
| @@ -805,19 +810,25 @@ | |
| 805 | int showDetail = 0; |
| 806 | int sideBySide = 0; |
| 807 | int diffFlags = 0; |
| 808 | Manifest *pFrom, *pTo; |
| 809 | ManifestFile *pFileFrom, *pFileTo; |
| 810 | |
| 811 | login_check_credentials(); |
| 812 | if( !g.perm.Read ){ login_needed(); return; } |
| 813 | login_anonymous_available(); |
| 814 | |
| 815 | pFrom = vdiff_parse_manifest("from", &ridFrom); |
| 816 | if( pFrom==0 ) return; |
| 817 | pTo = vdiff_parse_manifest("to", &ridTo); |
| 818 | if( pTo==0 ) return; |
| 819 | sideBySide = atoi(PD("sbs","1")); |
| 820 | showDetail = atoi(PD("detail","0")); |
| 821 | if( !showDetail && sideBySide ) showDetail = 1; |
| 822 | if( !sideBySide ){ |
| 823 | style_submenu_element("Side-by-side Diff", "sbsdiff", |
| 824 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -754,11 +754,16 @@ | |
| 754 | static Manifest *vdiff_parse_manifest(const char *zParam, int *pRid){ |
| 755 | int rid; |
| 756 | |
| 757 | *pRid = rid = name_to_rid_www(zParam); |
| 758 | if( rid==0 ){ |
| 759 | const char *z = P(zParam); |
| 760 | if( z==0 || z[0]==0 ){ |
| 761 | webpage_error("Missing \"%s\" query parameter.", zParam); |
| 762 | }else{ |
| 763 | webpage_error("No such artifact: \"%s\"", z); |
| 764 | } |
| 765 | return 0; |
| 766 | } |
| 767 | if( !is_a_version(rid) ){ |
| 768 | webpage_error("Artifact %s is not a checkin.", P(zParam)); |
| 769 | return 0; |
| @@ -805,19 +810,25 @@ | |
| 810 | int showDetail = 0; |
| 811 | int sideBySide = 0; |
| 812 | int diffFlags = 0; |
| 813 | Manifest *pFrom, *pTo; |
| 814 | ManifestFile *pFileFrom, *pFileTo; |
| 815 | const char *zBranch; |
| 816 | |
| 817 | login_check_credentials(); |
| 818 | if( !g.perm.Read ){ login_needed(); return; } |
| 819 | login_anonymous_available(); |
| 820 | |
| 821 | zBranch = P("branch"); |
| 822 | if( zBranch && zBranch[0] ){ |
| 823 | cgi_replace_parameter("from", mprintf("root:%s", zBranch)); |
| 824 | cgi_replace_parameter("to", zBranch); |
| 825 | } |
| 826 | pTo = vdiff_parse_manifest("to", &ridTo); |
| 827 | if( pTo==0 ) return; |
| 828 | pFrom = vdiff_parse_manifest("from", &ridFrom); |
| 829 | if( pFrom==0 ) return; |
| 830 | sideBySide = atoi(PD("sbs","1")); |
| 831 | showDetail = atoi(PD("detail","0")); |
| 832 | if( !showDetail && sideBySide ) showDetail = 1; |
| 833 | if( !sideBySide ){ |
| 834 | style_submenu_element("Side-by-side Diff", "sbsdiff", |
| 835 |
+23
| --- src/name.c | ||
| +++ src/name.c | ||
| @@ -152,10 +152,33 @@ | ||
| 152 | 152 | " AND event.objid=tagxref.rid " |
| 153 | 153 | " AND event.type GLOB '%q'" |
| 154 | 154 | " ORDER BY event.mtime DESC /*sort*/", |
| 155 | 155 | &zTag[4], zType |
| 156 | 156 | ); |
| 157 | + } | |
| 158 | + | |
| 159 | + /* root:TAG -> The origin of the branch */ | |
| 160 | + if( memcmp(zTag, "root:", 5)==0 ){ | |
| 161 | + Stmt q; | |
| 162 | + int rc; | |
| 163 | + rid = symbolic_name_to_rid(zTag+5, zType); | |
| 164 | + db_prepare(&q, | |
| 165 | + "SELECT pid, EXISTS(SELECT 1 FROM tagxref" | |
| 166 | + " WHERE tagid=%d AND tagtype>0" | |
| 167 | + " AND value=%Q AND rid=plink.pid)" | |
| 168 | + " FROM plink" | |
| 169 | + " WHERE cid=:cid AND isprim", | |
| 170 | + TAG_BRANCH, &zTag[5] | |
| 171 | + ); | |
| 172 | + do{ | |
| 173 | + db_reset(&q); | |
| 174 | + db_bind_int(&q, ":cid", rid); | |
| 175 | + rc = db_step(&q); | |
| 176 | + if( rc!=SQLITE_ROW ) break; | |
| 177 | + rid = db_column_int(&q, 0); | |
| 178 | + }while( db_column_int(&q, 1)==1 && rid>0 ); | |
| 179 | + db_finalize(&q); | |
| 157 | 180 | return rid; |
| 158 | 181 | } |
| 159 | 182 | |
| 160 | 183 | /* symbolic-name ":" date-time */ |
| 161 | 184 | nTag = strlen(zTag); |
| 162 | 185 |
| --- src/name.c | |
| +++ src/name.c | |
| @@ -152,10 +152,33 @@ | |
| 152 | " AND event.objid=tagxref.rid " |
| 153 | " AND event.type GLOB '%q'" |
| 154 | " ORDER BY event.mtime DESC /*sort*/", |
| 155 | &zTag[4], zType |
| 156 | ); |
| 157 | return rid; |
| 158 | } |
| 159 | |
| 160 | /* symbolic-name ":" date-time */ |
| 161 | nTag = strlen(zTag); |
| 162 |
| --- src/name.c | |
| +++ src/name.c | |
| @@ -152,10 +152,33 @@ | |
| 152 | " AND event.objid=tagxref.rid " |
| 153 | " AND event.type GLOB '%q'" |
| 154 | " ORDER BY event.mtime DESC /*sort*/", |
| 155 | &zTag[4], zType |
| 156 | ); |
| 157 | } |
| 158 | |
| 159 | /* root:TAG -> The origin of the branch */ |
| 160 | if( memcmp(zTag, "root:", 5)==0 ){ |
| 161 | Stmt q; |
| 162 | int rc; |
| 163 | rid = symbolic_name_to_rid(zTag+5, zType); |
| 164 | db_prepare(&q, |
| 165 | "SELECT pid, EXISTS(SELECT 1 FROM tagxref" |
| 166 | " WHERE tagid=%d AND tagtype>0" |
| 167 | " AND value=%Q AND rid=plink.pid)" |
| 168 | " FROM plink" |
| 169 | " WHERE cid=:cid AND isprim", |
| 170 | TAG_BRANCH, &zTag[5] |
| 171 | ); |
| 172 | do{ |
| 173 | db_reset(&q); |
| 174 | db_bind_int(&q, ":cid", rid); |
| 175 | rc = db_step(&q); |
| 176 | if( rc!=SQLITE_ROW ) break; |
| 177 | rid = db_column_int(&q, 0); |
| 178 | }while( db_column_int(&q, 1)==1 && rid>0 ); |
| 179 | db_finalize(&q); |
| 180 | return rid; |
| 181 | } |
| 182 | |
| 183 | /* symbolic-name ":" date-time */ |
| 184 | nTag = strlen(zTag); |
| 185 |