Fossil SCM
Fixed diff of an individual checked-out file (/localdiff) so it compares against the correct artifact when on a branch.
Commit
5cbb78b486cd899f303fa1d7607731545cecf92f63bc804c3d527bb336961b44
Parent
db758a34544b47a…
1 file changed
+6
-6
+6
-6
| --- src/info.c | ||
| +++ src/info.c | ||
| @@ -661,11 +661,11 @@ | ||
| 661 | 661 | if( showDiff ){ |
| 662 | 662 | if( diffFlags ){ |
| 663 | 663 | append_diff(zOld, NULL, zName, diffFlags, pRe); |
| 664 | 664 | }else if( isChnged ){ |
| 665 | 665 | @ |
| 666 | - @ %z(href("%R/localdiff?name=%T",zName))[diff]</a> | |
| 666 | + @ %z(href("%R/localdiff?name=%T&from=%!S",zName,zOld))[diff]</a> | |
| 667 | 667 | } |
| 668 | 668 | } |
| 669 | 669 | } |
| 670 | 670 | @ </p> |
| 671 | 671 | fossil_free(zFullName); |
| @@ -2034,11 +2034,11 @@ | ||
| 2034 | 2034 | |
| 2035 | 2035 | /* |
| 2036 | 2036 | ** WEBPAGE: fdiff |
| 2037 | 2037 | ** WEBPAGE: localdiff |
| 2038 | 2038 | ** URL: fdiff?v1=HASH&v2=HASH |
| 2039 | -** URL: localdiff?name=filename | |
| 2039 | +** URL: localdiff?name=filename&from=HASH | |
| 2040 | 2040 | ** |
| 2041 | 2041 | ** Two arguments, v1 and v2, identify the artifacts to be diffed. |
| 2042 | 2042 | ** Show diff side by side unless sbs is 0. Generate plain text if |
| 2043 | 2043 | ** "patch" is present, otherwise generate "pretty" HTML. |
| 2044 | 2044 | ** |
| @@ -2047,13 +2047,13 @@ | ||
| 2047 | 2047 | ** If the "from" and "to" query parameters are both present, then they are |
| 2048 | 2048 | ** the names of two files within the check-in "ci" that are diffed. If the |
| 2049 | 2049 | ** "ci" parameter is omitted, then the most recent check-in ("tip") is |
| 2050 | 2050 | ** used. |
| 2051 | 2051 | ** |
| 2052 | -** The /localdiff version will diff the given filename from the most recent | |
| 2053 | -** check-in ("tip") against the current (edited) version in the checkout | |
| 2054 | -** directory. | |
| 2052 | +** The /localdiff from shows changes to the locally-checkedout copy of "name" | |
| 2053 | +** compared with the artifact identified by "from" (normally the version which | |
| 2054 | +** was originally checked-out). | |
| 2055 | 2055 | ** |
| 2056 | 2056 | ** Additional parameters: |
| 2057 | 2057 | ** |
| 2058 | 2058 | ** dc=N Show N lines of context around each diff |
| 2059 | 2059 | ** patch Use the patch diff format |
| @@ -2081,11 +2081,11 @@ | ||
| 2081 | 2081 | cookie_link_parameter("diff","diff","2"); |
| 2082 | 2082 | diffType = atoi(PD("diff","2")); |
| 2083 | 2083 | cookie_render(); |
| 2084 | 2084 | if( bLocalMode ){ |
| 2085 | 2085 | zLocalName = P("name"); |
| 2086 | - v1 = artifact_from_ci_and_filename("name"); | |
| 2086 | + v1 = name_to_rid_www("from"); | |
| 2087 | 2087 | v2 = (zLocalName!=NULL)?-1:0; /* -1 prevents "not found" check below */ |
| 2088 | 2088 | }else if( P("from") && P("to") ){ |
| 2089 | 2089 | v1 = artifact_from_ci_and_filename("from"); |
| 2090 | 2090 | v2 = artifact_from_ci_and_filename("to"); |
| 2091 | 2091 | }else{ |
| 2092 | 2092 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -661,11 +661,11 @@ | |
| 661 | if( showDiff ){ |
| 662 | if( diffFlags ){ |
| 663 | append_diff(zOld, NULL, zName, diffFlags, pRe); |
| 664 | }else if( isChnged ){ |
| 665 | @ |
| 666 | @ %z(href("%R/localdiff?name=%T",zName))[diff]</a> |
| 667 | } |
| 668 | } |
| 669 | } |
| 670 | @ </p> |
| 671 | fossil_free(zFullName); |
| @@ -2034,11 +2034,11 @@ | |
| 2034 | |
| 2035 | /* |
| 2036 | ** WEBPAGE: fdiff |
| 2037 | ** WEBPAGE: localdiff |
| 2038 | ** URL: fdiff?v1=HASH&v2=HASH |
| 2039 | ** URL: localdiff?name=filename |
| 2040 | ** |
| 2041 | ** Two arguments, v1 and v2, identify the artifacts to be diffed. |
| 2042 | ** Show diff side by side unless sbs is 0. Generate plain text if |
| 2043 | ** "patch" is present, otherwise generate "pretty" HTML. |
| 2044 | ** |
| @@ -2047,13 +2047,13 @@ | |
| 2047 | ** If the "from" and "to" query parameters are both present, then they are |
| 2048 | ** the names of two files within the check-in "ci" that are diffed. If the |
| 2049 | ** "ci" parameter is omitted, then the most recent check-in ("tip") is |
| 2050 | ** used. |
| 2051 | ** |
| 2052 | ** The /localdiff version will diff the given filename from the most recent |
| 2053 | ** check-in ("tip") against the current (edited) version in the checkout |
| 2054 | ** directory. |
| 2055 | ** |
| 2056 | ** Additional parameters: |
| 2057 | ** |
| 2058 | ** dc=N Show N lines of context around each diff |
| 2059 | ** patch Use the patch diff format |
| @@ -2081,11 +2081,11 @@ | |
| 2081 | cookie_link_parameter("diff","diff","2"); |
| 2082 | diffType = atoi(PD("diff","2")); |
| 2083 | cookie_render(); |
| 2084 | if( bLocalMode ){ |
| 2085 | zLocalName = P("name"); |
| 2086 | v1 = artifact_from_ci_and_filename("name"); |
| 2087 | v2 = (zLocalName!=NULL)?-1:0; /* -1 prevents "not found" check below */ |
| 2088 | }else if( P("from") && P("to") ){ |
| 2089 | v1 = artifact_from_ci_and_filename("from"); |
| 2090 | v2 = artifact_from_ci_and_filename("to"); |
| 2091 | }else{ |
| 2092 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -661,11 +661,11 @@ | |
| 661 | if( showDiff ){ |
| 662 | if( diffFlags ){ |
| 663 | append_diff(zOld, NULL, zName, diffFlags, pRe); |
| 664 | }else if( isChnged ){ |
| 665 | @ |
| 666 | @ %z(href("%R/localdiff?name=%T&from=%!S",zName,zOld))[diff]</a> |
| 667 | } |
| 668 | } |
| 669 | } |
| 670 | @ </p> |
| 671 | fossil_free(zFullName); |
| @@ -2034,11 +2034,11 @@ | |
| 2034 | |
| 2035 | /* |
| 2036 | ** WEBPAGE: fdiff |
| 2037 | ** WEBPAGE: localdiff |
| 2038 | ** URL: fdiff?v1=HASH&v2=HASH |
| 2039 | ** URL: localdiff?name=filename&from=HASH |
| 2040 | ** |
| 2041 | ** Two arguments, v1 and v2, identify the artifacts to be diffed. |
| 2042 | ** Show diff side by side unless sbs is 0. Generate plain text if |
| 2043 | ** "patch" is present, otherwise generate "pretty" HTML. |
| 2044 | ** |
| @@ -2047,13 +2047,13 @@ | |
| 2047 | ** If the "from" and "to" query parameters are both present, then they are |
| 2048 | ** the names of two files within the check-in "ci" that are diffed. If the |
| 2049 | ** "ci" parameter is omitted, then the most recent check-in ("tip") is |
| 2050 | ** used. |
| 2051 | ** |
| 2052 | ** The /localdiff from shows changes to the locally-checkedout copy of "name" |
| 2053 | ** compared with the artifact identified by "from" (normally the version which |
| 2054 | ** was originally checked-out). |
| 2055 | ** |
| 2056 | ** Additional parameters: |
| 2057 | ** |
| 2058 | ** dc=N Show N lines of context around each diff |
| 2059 | ** patch Use the patch diff format |
| @@ -2081,11 +2081,11 @@ | |
| 2081 | cookie_link_parameter("diff","diff","2"); |
| 2082 | diffType = atoi(PD("diff","2")); |
| 2083 | cookie_render(); |
| 2084 | if( bLocalMode ){ |
| 2085 | zLocalName = P("name"); |
| 2086 | v1 = name_to_rid_www("from"); |
| 2087 | v2 = (zLocalName!=NULL)?-1:0; /* -1 prevents "not found" check below */ |
| 2088 | }else if( P("from") && P("to") ){ |
| 2089 | v1 = artifact_from_ci_and_filename("from"); |
| 2090 | v2 = artifact_from_ci_and_filename("to"); |
| 2091 | }else{ |
| 2092 |