Fossil SCM

Fixed diff of an individual checked-out file (/localdiff) so it compares against the correct artifact when on a branch.

graham 2020-05-31 11:22 ui-local-diff
Commit 5cbb78b486cd899f303fa1d7607731545cecf92f63bc804c3d527bb336961b44
1 file changed +6 -6
+6 -6
--- src/info.c
+++ src/info.c
@@ -661,11 +661,11 @@
661661
if( showDiff ){
662662
if( diffFlags ){
663663
append_diff(zOld, NULL, zName, diffFlags, pRe);
664664
}else if( isChnged ){
665665
@   
666
- @ %z(href("%R/localdiff?name=%T",zName))[diff]</a>
666
+ @ %z(href("%R/localdiff?name=%T&from=%!S",zName,zOld))[diff]</a>
667667
}
668668
}
669669
}
670670
@ </p>
671671
fossil_free(zFullName);
@@ -2034,11 +2034,11 @@
20342034
20352035
/*
20362036
** WEBPAGE: fdiff
20372037
** WEBPAGE: localdiff
20382038
** URL: fdiff?v1=HASH&v2=HASH
2039
-** URL: localdiff?name=filename
2039
+** URL: localdiff?name=filename&from=HASH
20402040
**
20412041
** Two arguments, v1 and v2, identify the artifacts to be diffed.
20422042
** Show diff side by side unless sbs is 0. Generate plain text if
20432043
** "patch" is present, otherwise generate "pretty" HTML.
20442044
**
@@ -2047,13 +2047,13 @@
20472047
** If the "from" and "to" query parameters are both present, then they are
20482048
** the names of two files within the check-in "ci" that are diffed. If the
20492049
** "ci" parameter is omitted, then the most recent check-in ("tip") is
20502050
** used.
20512051
**
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).
20552055
**
20562056
** Additional parameters:
20572057
**
20582058
** dc=N Show N lines of context around each diff
20592059
** patch Use the patch diff format
@@ -2081,11 +2081,11 @@
20812081
cookie_link_parameter("diff","diff","2");
20822082
diffType = atoi(PD("diff","2"));
20832083
cookie_render();
20842084
if( bLocalMode ){
20852085
zLocalName = P("name");
2086
- v1 = artifact_from_ci_and_filename("name");
2086
+ v1 = name_to_rid_www("from");
20872087
v2 = (zLocalName!=NULL)?-1:0; /* -1 prevents "not found" check below */
20882088
}else if( P("from") && P("to") ){
20892089
v1 = artifact_from_ci_and_filename("from");
20902090
v2 = artifact_from_ci_and_filename("to");
20912091
}else{
20922092
--- 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 @ &nbsp;&nbsp;
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 @ &nbsp;&nbsp;
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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button