Fossil SCM

undo [b9227b85cb|status improvements]

bch 2012-01-06 05:20 trunk merge
Commit a5e9410f47546a641c52dc8f4848d46a769cfdcc
-184
--- src/diff.c
+++ src/diff.c
@@ -805,194 +805,10 @@
805805
free(c.aFrom);
806806
free(c.aTo);
807807
return c.aEdit;
808808
}
809809
}
810
-
811
-/*
812
-** Copy a line with a limit. Used for side-by-side diffs to enforce a maximum
813
-** line length limit.
814
-*/
815
-static char *copylimline(char *out, DLine *dl, int lim){
816
- int len;
817
- len = dl->h & LENGTH_MASK;
818
- if( lim && len > lim ){
819
- memcpy(out, dl->z, lim-3);
820
- memcpy(&out[lim-3], "...", 4);
821
- }else{
822
- memcpy(out, dl->z, len);
823
- out[len] = '\0';
824
- }
825
- return out;
826
-}
827
-
828
-/*
829
-** Output table body of a side-by-side diff. Prior to the call, the caller
830
-** should have output:
831
-** <table class="sbsdiff">
832
-** <tr><th colspan="2" class="diffhdr">Old title</th><th/>
833
-** <th colspan="2" class="diffhdr">New title</th></tr>
834
-**
835
-** And after the call, it should output:
836
-** </table>
837
-**
838
-** Some good reference diffs in the fossil repository for testing:
839
-** /vdiff?from=080d27a&to=4b0f813&detail=1
840
-** /vdiff?from=636804745b&to=c1d78e0556&detail=1
841
-** /vdiff?from=c0b6c28d29&to=25169506b7&detail=1
842
-** /vdiff?from=e3d022dffa&to=48bcfbd47b&detail=1
843
-*/
844
-int html_sbsdiff(
845
- Blob *pA_Blob, /* FROM file */
846
- Blob *pB_Blob, /* TO file */
847
- int nContext, /* Amount of context to unified diff */
848
- int ignoreEolWs /* Ignore whitespace at the end of lines */
849
-){
850
- DContext c;
851
- int i;
852
- int iFrom, iTo;
853
- char *linebuf;
854
- int collim=0; /* Currently not settable; allows a column limit for diffs */
855
- int allowExp=0; /* Currently not settable; (dis)allow expansion of rows */
856
-
857
- /* Prepare the input files */
858
- memset(&c, 0, sizeof(c));
859
- c.aFrom = break_into_lines(blob_str(pA_Blob), blob_size(pA_Blob),
860
- &c.nFrom, ignoreEolWs);
861
- c.aTo = break_into_lines(blob_str(pB_Blob), blob_size(pB_Blob),
862
- &c.nTo, ignoreEolWs);
863
- if( c.aFrom==0 || c.aTo==0 ){
864
- free(c.aFrom);
865
- free(c.aTo);
866
- /* Note: This would be generated within a table. */
867
- @ <p class="generalError" style="white-space: nowrap">cannot compute
868
- @ difference between binary files</p>
869
- return 0;
870
- }
871
-
872
- collim = collim < 4 ? 0 : collim;
873
-
874
- /* Compute the difference */
875
- diff_all(&c);
876
-
877
- linebuf = fossil_malloc(LENGTH_MASK+1);
878
- if( !linebuf ){
879
- free(c.aFrom);
880
- free(c.aTo);
881
- free(c.aEdit);
882
- return 0;
883
- }
884
-
885
- iFrom=iTo=0;
886
- i=0;
887
- while( i<c.nEdit ){
888
- int j;
889
- /* Copied lines */
890
- for( j=0; j<c.aEdit[i]; j++){
891
- /* Hide lines which are copied and are further away from block boundaries
892
- ** than nContext lines. For each block with hidden lines, show a row
893
- ** notifying the user about the hidden rows.
894
- */
895
- if( j<nContext || j>c.aEdit[i]-nContext-1 ){
896
- @ <tr>
897
- }else if( j==nContext && j<c.aEdit[i]-nContext-1 ){
898
- @ <tr>
899
- @ <td class="meta" colspan="5" style="white-space: nowrap;">
900
- @ %d(c.aEdit[i]-2*nContext) hidden lines</td>
901
- @ </tr>
902
- if( !allowExp )
903
- continue;
904
- @ <tr style="display:none;">
905
- }else{
906
- if( !allowExp )
907
- continue;
908
- @ <tr style="display:none;">
909
- }
910
-
911
- copylimline(linebuf, &c.aFrom[iFrom+j], collim);
912
- @ <td class="lineno">%d(iFrom+j+1)</td>
913
- @ <td class="srcline">%h(linebuf)</td>
914
-
915
- @ <td> </td>
916
-
917
- copylimline(linebuf, &c.aTo[iTo+j], collim);
918
- @ <td class="lineno">%d(iTo+j+1)</td>
919
- @ <td class="srcline">%h(linebuf)</td>
920
-
921
- @ </tr>
922
- }
923
- iFrom+=c.aEdit[i];
924
- iTo+=c.aEdit[i];
925
-
926
- if( c.aEdit[i+1]!=0 && c.aEdit[i+2]!=0 ){
927
- int lim;
928
- lim = c.aEdit[i+1] > c.aEdit[i+2] ? c.aEdit[i+1] : c.aEdit[i+2];
929
-
930
- /* Assume changed lines */
931
- for( j=0; j<lim; j++ ){
932
- @ <tr>
933
-
934
- if( j<c.aEdit[i+1] ){
935
- copylimline(linebuf, &c.aFrom[iFrom+j], collim);
936
- @ <td class="changed lineno">%d(iFrom+j+1)</td>
937
- @ <td class="changed srcline">%h(linebuf)</td>
938
- }else{
939
- @ <td colspan="2" class="changedvoid"/>
940
- }
941
-
942
- @ <td class="changed">|</td>
943
-
944
- if( j<c.aEdit[i+2] ){
945
- copylimline(linebuf, &c.aTo[iTo+j], collim);
946
- @ <td class="changed lineno">%d(iTo+j+1)</td>
947
- @ <td class="changed srcline">%h(linebuf)</td>
948
- }else{
949
- @ <td colspan="2" class="changedvoid"/>
950
- }
951
-
952
- @ </tr>
953
- }
954
- iFrom+=c.aEdit[i+1];
955
- iTo+=c.aEdit[i+2];
956
- }else{
957
-
958
- /* Process deleted lines */
959
- for( j=0; j<c.aEdit[i+1]; j++ ){
960
- @ <tr>
961
-
962
- copylimline(linebuf, &c.aFrom[iFrom+j], collim);
963
- @ <td class="removed lineno">%d(iFrom+j+1)</td>
964
- @ <td class="removed srcline">%h(linebuf)</td>
965
- @ <td>&lt;</td>
966
- @ <td colspan="2" class="removedvoid"/>
967
- @ </tr>
968
- }
969
- iFrom+=c.aEdit[i+1];
970
-
971
- /* Process inserted lines */
972
- for( j=0; j<c.aEdit[i+2]; j++ ){
973
- @ <tr>
974
- @ <td colspan="2" class="addedvoid"/>
975
- @ <td>&gt;</td>
976
- copylimline(linebuf, &c.aTo[iTo+j], collim);
977
- @ <td class="added lineno">%d(iTo+j+1)</td>
978
- @ <td class="added srcline">%h(linebuf)</td>
979
- @ </tr>
980
- }
981
- iTo+=c.aEdit[i+2];
982
- }
983
-
984
- i+=3;
985
- }
986
-
987
- free(linebuf);
988
- free(c.aFrom);
989
- free(c.aTo);
990
- free(c.aEdit);
991
- return 1;
992
-}
993
-
994810
995811
/*
996812
** COMMAND: test-rawdiff
997813
*/
998814
void test_rawdiff_cmd(void){
999815
--- src/diff.c
+++ src/diff.c
@@ -805,194 +805,10 @@
805 free(c.aFrom);
806 free(c.aTo);
807 return c.aEdit;
808 }
809 }
810
811 /*
812 ** Copy a line with a limit. Used for side-by-side diffs to enforce a maximum
813 ** line length limit.
814 */
815 static char *copylimline(char *out, DLine *dl, int lim){
816 int len;
817 len = dl->h & LENGTH_MASK;
818 if( lim && len > lim ){
819 memcpy(out, dl->z, lim-3);
820 memcpy(&out[lim-3], "...", 4);
821 }else{
822 memcpy(out, dl->z, len);
823 out[len] = '\0';
824 }
825 return out;
826 }
827
828 /*
829 ** Output table body of a side-by-side diff. Prior to the call, the caller
830 ** should have output:
831 ** <table class="sbsdiff">
832 ** <tr><th colspan="2" class="diffhdr">Old title</th><th/>
833 ** <th colspan="2" class="diffhdr">New title</th></tr>
834 **
835 ** And after the call, it should output:
836 ** </table>
837 **
838 ** Some good reference diffs in the fossil repository for testing:
839 ** /vdiff?from=080d27a&to=4b0f813&detail=1
840 ** /vdiff?from=636804745b&to=c1d78e0556&detail=1
841 ** /vdiff?from=c0b6c28d29&to=25169506b7&detail=1
842 ** /vdiff?from=e3d022dffa&to=48bcfbd47b&detail=1
843 */
844 int html_sbsdiff(
845 Blob *pA_Blob, /* FROM file */
846 Blob *pB_Blob, /* TO file */
847 int nContext, /* Amount of context to unified diff */
848 int ignoreEolWs /* Ignore whitespace at the end of lines */
849 ){
850 DContext c;
851 int i;
852 int iFrom, iTo;
853 char *linebuf;
854 int collim=0; /* Currently not settable; allows a column limit for diffs */
855 int allowExp=0; /* Currently not settable; (dis)allow expansion of rows */
856
857 /* Prepare the input files */
858 memset(&c, 0, sizeof(c));
859 c.aFrom = break_into_lines(blob_str(pA_Blob), blob_size(pA_Blob),
860 &c.nFrom, ignoreEolWs);
861 c.aTo = break_into_lines(blob_str(pB_Blob), blob_size(pB_Blob),
862 &c.nTo, ignoreEolWs);
863 if( c.aFrom==0 || c.aTo==0 ){
864 free(c.aFrom);
865 free(c.aTo);
866 /* Note: This would be generated within a table. */
867 @ <p class="generalError" style="white-space: nowrap">cannot compute
868 @ difference between binary files</p>
869 return 0;
870 }
871
872 collim = collim < 4 ? 0 : collim;
873
874 /* Compute the difference */
875 diff_all(&c);
876
877 linebuf = fossil_malloc(LENGTH_MASK+1);
878 if( !linebuf ){
879 free(c.aFrom);
880 free(c.aTo);
881 free(c.aEdit);
882 return 0;
883 }
884
885 iFrom=iTo=0;
886 i=0;
887 while( i<c.nEdit ){
888 int j;
889 /* Copied lines */
890 for( j=0; j<c.aEdit[i]; j++){
891 /* Hide lines which are copied and are further away from block boundaries
892 ** than nContext lines. For each block with hidden lines, show a row
893 ** notifying the user about the hidden rows.
894 */
895 if( j<nContext || j>c.aEdit[i]-nContext-1 ){
896 @ <tr>
897 }else if( j==nContext && j<c.aEdit[i]-nContext-1 ){
898 @ <tr>
899 @ <td class="meta" colspan="5" style="white-space: nowrap;">
900 @ %d(c.aEdit[i]-2*nContext) hidden lines</td>
901 @ </tr>
902 if( !allowExp )
903 continue;
904 @ <tr style="display:none;">
905 }else{
906 if( !allowExp )
907 continue;
908 @ <tr style="display:none;">
909 }
910
911 copylimline(linebuf, &c.aFrom[iFrom+j], collim);
912 @ <td class="lineno">%d(iFrom+j+1)</td>
913 @ <td class="srcline">%h(linebuf)</td>
914
915 @ <td> </td>
916
917 copylimline(linebuf, &c.aTo[iTo+j], collim);
918 @ <td class="lineno">%d(iTo+j+1)</td>
919 @ <td class="srcline">%h(linebuf)</td>
920
921 @ </tr>
922 }
923 iFrom+=c.aEdit[i];
924 iTo+=c.aEdit[i];
925
926 if( c.aEdit[i+1]!=0 && c.aEdit[i+2]!=0 ){
927 int lim;
928 lim = c.aEdit[i+1] > c.aEdit[i+2] ? c.aEdit[i+1] : c.aEdit[i+2];
929
930 /* Assume changed lines */
931 for( j=0; j<lim; j++ ){
932 @ <tr>
933
934 if( j<c.aEdit[i+1] ){
935 copylimline(linebuf, &c.aFrom[iFrom+j], collim);
936 @ <td class="changed lineno">%d(iFrom+j+1)</td>
937 @ <td class="changed srcline">%h(linebuf)</td>
938 }else{
939 @ <td colspan="2" class="changedvoid"/>
940 }
941
942 @ <td class="changed">|</td>
943
944 if( j<c.aEdit[i+2] ){
945 copylimline(linebuf, &c.aTo[iTo+j], collim);
946 @ <td class="changed lineno">%d(iTo+j+1)</td>
947 @ <td class="changed srcline">%h(linebuf)</td>
948 }else{
949 @ <td colspan="2" class="changedvoid"/>
950 }
951
952 @ </tr>
953 }
954 iFrom+=c.aEdit[i+1];
955 iTo+=c.aEdit[i+2];
956 }else{
957
958 /* Process deleted lines */
959 for( j=0; j<c.aEdit[i+1]; j++ ){
960 @ <tr>
961
962 copylimline(linebuf, &c.aFrom[iFrom+j], collim);
963 @ <td class="removed lineno">%d(iFrom+j+1)</td>
964 @ <td class="removed srcline">%h(linebuf)</td>
965 @ <td>&lt;</td>
966 @ <td colspan="2" class="removedvoid"/>
967 @ </tr>
968 }
969 iFrom+=c.aEdit[i+1];
970
971 /* Process inserted lines */
972 for( j=0; j<c.aEdit[i+2]; j++ ){
973 @ <tr>
974 @ <td colspan="2" class="addedvoid"/>
975 @ <td>&gt;</td>
976 copylimline(linebuf, &c.aTo[iTo+j], collim);
977 @ <td class="added lineno">%d(iTo+j+1)</td>
978 @ <td class="added srcline">%h(linebuf)</td>
979 @ </tr>
980 }
981 iTo+=c.aEdit[i+2];
982 }
983
984 i+=3;
985 }
986
987 free(linebuf);
988 free(c.aFrom);
989 free(c.aTo);
990 free(c.aEdit);
991 return 1;
992 }
993
994
995 /*
996 ** COMMAND: test-rawdiff
997 */
998 void test_rawdiff_cmd(void){
999
--- src/diff.c
+++ src/diff.c
@@ -805,194 +805,10 @@
805 free(c.aFrom);
806 free(c.aTo);
807 return c.aEdit;
808 }
809 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
810
811 /*
812 ** COMMAND: test-rawdiff
813 */
814 void test_rawdiff_cmd(void){
815
+28 -60
--- src/info.c
+++ src/info.c
@@ -251,11 +251,11 @@
251251
252252
253253
/*
254254
** Append the difference between two RIDs to the output
255255
*/
256
-static void append_diff(const char *zFrom, const char *zTo){
256
+static void append_diff(const char *zFrom, const char *zTo, int diffFlags){
257257
int fromid;
258258
int toid;
259259
Blob from, to, out;
260260
if( zFrom ){
261261
fromid = uuid_to_rid(zFrom, 0);
@@ -268,46 +268,17 @@
268268
content_get(toid, &to);
269269
}else{
270270
blob_zero(&to);
271271
}
272272
blob_zero(&out);
273
- text_diff(&from, &to, &out, DIFF_IGNORE_EOLWS | 5);
273
+ text_diff(&from, &to, &out, diffFlags);
274274
@ %h(blob_str(&out))
275275
blob_reset(&from);
276276
blob_reset(&to);
277277
blob_reset(&out);
278278
}
279279
280
-
281
-/*
282
-** Write the difference between two RIDs to the output
283
-*/
284
-static void generate_sbsdiff(const char *zFrom, const char *zTo){
285
- int fromid;
286
- int toid;
287
- Blob from, to;
288
- if( zFrom ){
289
- fromid = uuid_to_rid(zFrom, 0);
290
- content_get(fromid, &from);
291
- }else{
292
- blob_zero(&from);
293
- }
294
- if( zTo ){
295
- toid = uuid_to_rid(zTo, 0);
296
- content_get(toid, &to);
297
- }else{
298
- blob_zero(&to);
299
- }
300
- @ <table class="sbsdiff">
301
- @ <tr><th colspan="2" class="diffhdr">Old (%S(zFrom))</th><th/>
302
- @ <th colspan="2" class="diffhdr">New (%S(zTo))</th></tr>
303
- html_sbsdiff(&from, &to, 5, 1);
304
- @ </table>
305
- blob_reset(&from);
306
- blob_reset(&to);
307
-}
308
-
309280
310281
/*
311282
** Write a line of web-page output that shows changes that have occurred
312283
** to a file between two check-ins.
313284
*/
@@ -318,10 +289,14 @@
318289
const char *zOldName, /* Prior name. NULL if no name change. */
319290
int showDiff, /* Show edit diffs if true */
320291
int sideBySide, /* Show diffs side-by-side */
321292
int mperm /* executable or symlink permission for zNew */
322293
){
294
+ int diffFlags = DIFF_IGNORE_EOLWS | 7;
295
+ if( sideBySide ){
296
+ diffFlags |= DIFF_SIDEBYSIDE;
297
+ }
323298
if( !g.perm.History ){
324299
if( zNew==0 ){
325300
@ <p>Deleted %h(zName)</p>
326301
}else if( zOld==0 ){
327302
@ <p>Added %h(zName)</p>
@@ -332,17 +307,13 @@
332307
@ for %h(zName)</p>
333308
}else{
334309
@ <p>Changes to %h(zName)</p>
335310
}
336311
if( showDiff ){
337
- if( sideBySide ){
338
- generate_sbsdiff(zOld, zNew);
339
- }else{
340
- @ <blockquote><pre>
341
- append_diff(zOld, zNew);
342
- @ </pre></blockquote>
343
- }
312
+ @ <pre style="white-space:pre;">
313
+ append_diff(zOld, zNew, diffFlags);
314
+ @ </pre>
344315
}
345316
}else{
346317
if( zOld && zNew ){
347318
if( fossil_strcmp(zOld, zNew)!=0 ){
348319
@ <p>Modified <a href="%s(g.zTop)/finfo?name=%T(zName)">%h(zName)</a>
@@ -362,17 +333,13 @@
362333
}else{
363334
@ <p>Added <a href="%s(g.zTop)/finfo?name=%T(zName)">%h(zName)</a>
364335
@ version <a href="%s(g.zTop)/artifact/%s(zNew)">[%S(zNew)]</a>
365336
}
366337
if( showDiff ){
367
- if( sideBySide ){
368
- generate_sbsdiff(zOld, zNew);
369
- }else{
370
- @ <blockquote><pre>
371
- append_diff(zOld, zNew);
372
- @ </pre></blockquote>
373
- }
338
+ @ <pre style="white-space:pre;">
339
+ append_diff(zOld, zNew, diffFlags);
340
+ @ </pre>
374341
}else if( zOld && zNew && fossil_strcmp(zOld,zNew)!=0 ){
375342
@ &nbsp;&nbsp;
376343
@ <a href="%s(g.zTop)/fdiff?v1=%S(zOld)&amp;v2=%S(zNew)">[diff]</a>
377344
}
378345
@ </p>
@@ -1069,10 +1036,11 @@
10691036
int isPatch;
10701037
int sideBySide;
10711038
Blob c1, c2, diff, *pOut;
10721039
char *zV1;
10731040
char *zV2;
1041
+ int diffFlags;
10741042
10751043
login_check_credentials();
10761044
if( !g.perm.Read ){ login_needed(); return; }
10771045
v1 = name_to_rid_www("v1");
10781046
v2 = name_to_rid_www("v2");
@@ -1082,21 +1050,25 @@
10821050
zV2 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v2);
10831051
isPatch = P("patch")!=0;
10841052
if( isPatch ){
10851053
pOut = cgi_output_blob();
10861054
cgi_set_content_type("text/plain");
1055
+ diffFlags = 4;
10871056
}else{
10881057
blob_zero(&diff);
10891058
pOut = &diff;
1090
- }
1091
- if( !sideBySide || isPatch ){
1092
- content_get(v1, &c1);
1093
- content_get(v2, &c2);
1094
- text_diff(&c1, &c2, pOut, 4 | 0);
1095
- blob_reset(&c1);
1096
- blob_reset(&c2);
1097
- }
1059
+ if( sideBySide ){
1060
+ diffFlags = DIFF_IGNORE_EOLWS | DIFF_SIDEBYSIDE | 7;
1061
+ }else{
1062
+ diffFlags = DIFF_IGNORE_EOLWS | 7;
1063
+ }
1064
+ }
1065
+ content_get(v1, &c1);
1066
+ content_get(v2, &c2);
1067
+ text_diff(&c1, &c2, pOut, diffFlags);
1068
+ blob_reset(&c1);
1069
+ blob_reset(&c2);
10981070
if( !isPatch ){
10991071
style_header("Diff");
11001072
style_submenu_element("Patch", "Patch", "%s/fdiff?v1=%T&v2=%T&patch",
11011073
g.zTop, P("v1"), P("v2"));
11021074
if( !sideBySide ){
@@ -1113,17 +1085,13 @@
11131085
@ Artifact <a href="%s(g.zTop)/artifact/%S(zV1)">[%S(zV1)]</a>:</h2>
11141086
object_description(v1, 0, 0);
11151087
@ <h2>To Artifact <a href="%s(g.zTop)/artifact/%S(zV2)">[%S(zV2)]</a>:</h2>
11161088
object_description(v2, 0, 0);
11171089
@ <hr />
1118
- if( sideBySide ){
1119
- generate_sbsdiff(zV1, zV2);
1120
- }else{
1121
- @ <blockquote><pre>
1122
- @ %h(blob_str(&diff))
1123
- @ </pre></blockquote>
1124
- }
1090
+ @ <pre style="while-space:pre;">
1091
+ @ %h(blob_str(&diff))
1092
+ @ </pre>
11251093
blob_reset(&diff);
11261094
style_footer();
11271095
}
11281096
}
11291097
11301098
--- src/info.c
+++ src/info.c
@@ -251,11 +251,11 @@
251
252
253 /*
254 ** Append the difference between two RIDs to the output
255 */
256 static void append_diff(const char *zFrom, const char *zTo){
257 int fromid;
258 int toid;
259 Blob from, to, out;
260 if( zFrom ){
261 fromid = uuid_to_rid(zFrom, 0);
@@ -268,46 +268,17 @@
268 content_get(toid, &to);
269 }else{
270 blob_zero(&to);
271 }
272 blob_zero(&out);
273 text_diff(&from, &to, &out, DIFF_IGNORE_EOLWS | 5);
274 @ %h(blob_str(&out))
275 blob_reset(&from);
276 blob_reset(&to);
277 blob_reset(&out);
278 }
279
280
281 /*
282 ** Write the difference between two RIDs to the output
283 */
284 static void generate_sbsdiff(const char *zFrom, const char *zTo){
285 int fromid;
286 int toid;
287 Blob from, to;
288 if( zFrom ){
289 fromid = uuid_to_rid(zFrom, 0);
290 content_get(fromid, &from);
291 }else{
292 blob_zero(&from);
293 }
294 if( zTo ){
295 toid = uuid_to_rid(zTo, 0);
296 content_get(toid, &to);
297 }else{
298 blob_zero(&to);
299 }
300 @ <table class="sbsdiff">
301 @ <tr><th colspan="2" class="diffhdr">Old (%S(zFrom))</th><th/>
302 @ <th colspan="2" class="diffhdr">New (%S(zTo))</th></tr>
303 html_sbsdiff(&from, &to, 5, 1);
304 @ </table>
305 blob_reset(&from);
306 blob_reset(&to);
307 }
308
309
310 /*
311 ** Write a line of web-page output that shows changes that have occurred
312 ** to a file between two check-ins.
313 */
@@ -318,10 +289,14 @@
318 const char *zOldName, /* Prior name. NULL if no name change. */
319 int showDiff, /* Show edit diffs if true */
320 int sideBySide, /* Show diffs side-by-side */
321 int mperm /* executable or symlink permission for zNew */
322 ){
 
 
 
 
323 if( !g.perm.History ){
324 if( zNew==0 ){
325 @ <p>Deleted %h(zName)</p>
326 }else if( zOld==0 ){
327 @ <p>Added %h(zName)</p>
@@ -332,17 +307,13 @@
332 @ for %h(zName)</p>
333 }else{
334 @ <p>Changes to %h(zName)</p>
335 }
336 if( showDiff ){
337 if( sideBySide ){
338 generate_sbsdiff(zOld, zNew);
339 }else{
340 @ <blockquote><pre>
341 append_diff(zOld, zNew);
342 @ </pre></blockquote>
343 }
344 }
345 }else{
346 if( zOld && zNew ){
347 if( fossil_strcmp(zOld, zNew)!=0 ){
348 @ <p>Modified <a href="%s(g.zTop)/finfo?name=%T(zName)">%h(zName)</a>
@@ -362,17 +333,13 @@
362 }else{
363 @ <p>Added <a href="%s(g.zTop)/finfo?name=%T(zName)">%h(zName)</a>
364 @ version <a href="%s(g.zTop)/artifact/%s(zNew)">[%S(zNew)]</a>
365 }
366 if( showDiff ){
367 if( sideBySide ){
368 generate_sbsdiff(zOld, zNew);
369 }else{
370 @ <blockquote><pre>
371 append_diff(zOld, zNew);
372 @ </pre></blockquote>
373 }
374 }else if( zOld && zNew && fossil_strcmp(zOld,zNew)!=0 ){
375 @ &nbsp;&nbsp;
376 @ <a href="%s(g.zTop)/fdiff?v1=%S(zOld)&amp;v2=%S(zNew)">[diff]</a>
377 }
378 @ </p>
@@ -1069,10 +1036,11 @@
1069 int isPatch;
1070 int sideBySide;
1071 Blob c1, c2, diff, *pOut;
1072 char *zV1;
1073 char *zV2;
 
1074
1075 login_check_credentials();
1076 if( !g.perm.Read ){ login_needed(); return; }
1077 v1 = name_to_rid_www("v1");
1078 v2 = name_to_rid_www("v2");
@@ -1082,21 +1050,25 @@
1082 zV2 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v2);
1083 isPatch = P("patch")!=0;
1084 if( isPatch ){
1085 pOut = cgi_output_blob();
1086 cgi_set_content_type("text/plain");
 
1087 }else{
1088 blob_zero(&diff);
1089 pOut = &diff;
1090 }
1091 if( !sideBySide || isPatch ){
1092 content_get(v1, &c1);
1093 content_get(v2, &c2);
1094 text_diff(&c1, &c2, pOut, 4 | 0);
1095 blob_reset(&c1);
1096 blob_reset(&c2);
1097 }
 
 
 
1098 if( !isPatch ){
1099 style_header("Diff");
1100 style_submenu_element("Patch", "Patch", "%s/fdiff?v1=%T&v2=%T&patch",
1101 g.zTop, P("v1"), P("v2"));
1102 if( !sideBySide ){
@@ -1113,17 +1085,13 @@
1113 @ Artifact <a href="%s(g.zTop)/artifact/%S(zV1)">[%S(zV1)]</a>:</h2>
1114 object_description(v1, 0, 0);
1115 @ <h2>To Artifact <a href="%s(g.zTop)/artifact/%S(zV2)">[%S(zV2)]</a>:</h2>
1116 object_description(v2, 0, 0);
1117 @ <hr />
1118 if( sideBySide ){
1119 generate_sbsdiff(zV1, zV2);
1120 }else{
1121 @ <blockquote><pre>
1122 @ %h(blob_str(&diff))
1123 @ </pre></blockquote>
1124 }
1125 blob_reset(&diff);
1126 style_footer();
1127 }
1128 }
1129
1130
--- src/info.c
+++ src/info.c
@@ -251,11 +251,11 @@
251
252
253 /*
254 ** Append the difference between two RIDs to the output
255 */
256 static void append_diff(const char *zFrom, const char *zTo, int diffFlags){
257 int fromid;
258 int toid;
259 Blob from, to, out;
260 if( zFrom ){
261 fromid = uuid_to_rid(zFrom, 0);
@@ -268,46 +268,17 @@
268 content_get(toid, &to);
269 }else{
270 blob_zero(&to);
271 }
272 blob_zero(&out);
273 text_diff(&from, &to, &out, diffFlags);
274 @ %h(blob_str(&out))
275 blob_reset(&from);
276 blob_reset(&to);
277 blob_reset(&out);
278 }
279
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
280
281 /*
282 ** Write a line of web-page output that shows changes that have occurred
283 ** to a file between two check-ins.
284 */
@@ -318,10 +289,14 @@
289 const char *zOldName, /* Prior name. NULL if no name change. */
290 int showDiff, /* Show edit diffs if true */
291 int sideBySide, /* Show diffs side-by-side */
292 int mperm /* executable or symlink permission for zNew */
293 ){
294 int diffFlags = DIFF_IGNORE_EOLWS | 7;
295 if( sideBySide ){
296 diffFlags |= DIFF_SIDEBYSIDE;
297 }
298 if( !g.perm.History ){
299 if( zNew==0 ){
300 @ <p>Deleted %h(zName)</p>
301 }else if( zOld==0 ){
302 @ <p>Added %h(zName)</p>
@@ -332,17 +307,13 @@
307 @ for %h(zName)</p>
308 }else{
309 @ <p>Changes to %h(zName)</p>
310 }
311 if( showDiff ){
312 @ <pre style="white-space:pre;">
313 append_diff(zOld, zNew, diffFlags);
314 @ </pre>
 
 
 
 
315 }
316 }else{
317 if( zOld && zNew ){
318 if( fossil_strcmp(zOld, zNew)!=0 ){
319 @ <p>Modified <a href="%s(g.zTop)/finfo?name=%T(zName)">%h(zName)</a>
@@ -362,17 +333,13 @@
333 }else{
334 @ <p>Added <a href="%s(g.zTop)/finfo?name=%T(zName)">%h(zName)</a>
335 @ version <a href="%s(g.zTop)/artifact/%s(zNew)">[%S(zNew)]</a>
336 }
337 if( showDiff ){
338 @ <pre style="white-space:pre;">
339 append_diff(zOld, zNew, diffFlags);
340 @ </pre>
 
 
 
 
341 }else if( zOld && zNew && fossil_strcmp(zOld,zNew)!=0 ){
342 @ &nbsp;&nbsp;
343 @ <a href="%s(g.zTop)/fdiff?v1=%S(zOld)&amp;v2=%S(zNew)">[diff]</a>
344 }
345 @ </p>
@@ -1069,10 +1036,11 @@
1036 int isPatch;
1037 int sideBySide;
1038 Blob c1, c2, diff, *pOut;
1039 char *zV1;
1040 char *zV2;
1041 int diffFlags;
1042
1043 login_check_credentials();
1044 if( !g.perm.Read ){ login_needed(); return; }
1045 v1 = name_to_rid_www("v1");
1046 v2 = name_to_rid_www("v2");
@@ -1082,21 +1050,25 @@
1050 zV2 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v2);
1051 isPatch = P("patch")!=0;
1052 if( isPatch ){
1053 pOut = cgi_output_blob();
1054 cgi_set_content_type("text/plain");
1055 diffFlags = 4;
1056 }else{
1057 blob_zero(&diff);
1058 pOut = &diff;
1059 if( sideBySide ){
1060 diffFlags = DIFF_IGNORE_EOLWS | DIFF_SIDEBYSIDE | 7;
1061 }else{
1062 diffFlags = DIFF_IGNORE_EOLWS | 7;
1063 }
1064 }
1065 content_get(v1, &c1);
1066 content_get(v2, &c2);
1067 text_diff(&c1, &c2, pOut, diffFlags);
1068 blob_reset(&c1);
1069 blob_reset(&c2);
1070 if( !isPatch ){
1071 style_header("Diff");
1072 style_submenu_element("Patch", "Patch", "%s/fdiff?v1=%T&v2=%T&patch",
1073 g.zTop, P("v1"), P("v2"));
1074 if( !sideBySide ){
@@ -1113,17 +1085,13 @@
1085 @ Artifact <a href="%s(g.zTop)/artifact/%S(zV1)">[%S(zV1)]</a>:</h2>
1086 object_description(v1, 0, 0);
1087 @ <h2>To Artifact <a href="%s(g.zTop)/artifact/%S(zV2)">[%S(zV2)]</a>:</h2>
1088 object_description(v2, 0, 0);
1089 @ <hr />
1090 @ <pre style="while-space:pre;">
1091 @ %h(blob_str(&diff))
1092 @ </pre>
 
 
 
 
1093 blob_reset(&diff);
1094 style_footer();
1095 }
1096 }
1097
1098
-202
--- src/skins.c
+++ src/skins.c
@@ -153,55 +153,10 @@
153153
@ /* The label/value pairs on (for example) the vinfo page */
154154
@ table.label-value th {
155155
@ vertical-align: top;
156156
@ text-align: right;
157157
@ padding: 0.2ex 2ex;
158
-@ }
159
-@
160
-@ /* Side-by-side diff */
161
-@ table.sbsdiff {
162
-@ background-color: white;
163
-@ font-family: fixed, Dejavu Sans Mono, Monaco, Lucida Console, monospace;
164
-@ font-size: 8pt;
165
-@ border-collapse:collapse;
166
-@ white-space: pre;
167
-@ width: 98%;
168
-@ border: 1px #000 dashed;
169
-@ }
170
-@
171
-@ table.sbsdiff th.diffhdr {
172
-@ border-bottom: dotted;
173
-@ border-width: 1px;
174
-@ }
175
-@
176
-@ table.sbsdiff tr td {
177
-@ white-space: pre;
178
-@ padding-left: 3px;
179
-@ padding-right: 3px;
180
-@ margin: 0px;
181
-@ }
182
-@
183
-@ table.sbsdiff tr td.lineno {
184
-@ text-align: right;
185
-@ }
186
-@
187
-@ table.sbsdiff tr td.meta {
188
-@ color: white;
189
-@ background-color: rgb(20, 20, 20);
190
-@ text-align: center;
191
-@ }
192
-@
193
-@ table.sbsdiff tr td.added {
194
-@ background-color: rgb(230, 230, 230);
195
-@ }
196
-@
197
-@ table.sbsdiff tr td.removed {
198
-@ background-color: rgb(200, 200, 200);
199
-@ }
200
-@
201
-@ table.sbsdiff tr td.changed {
202
-@ background-color: rgb(220, 220, 220);
203158
@ }');
204159
@ REPLACE INTO config(name,mtime,value) VALUES('header',now(),'<html>
205160
@ <head>
206161
@ <title>$<project_name>: $<title></title>
207162
@ <link rel="alternate" type="application/rss+xml" title="RSS Feed"
@@ -400,54 +355,10 @@
400355
@ /* The label/value pairs on (for example) the ci page */
401356
@ table.label-value th {
402357
@ vertical-align: top;
403358
@ text-align: right;
404359
@ padding: 0.2ex 2ex;
405
-@ }
406
-@
407
-@ /* Side-by-side diff */
408
-@ table.sbsdiff {
409
-@ background-color: #ffffc5;
410
-@ font-family: fixed, Dejavu Sans Mono, Monaco, Lucida Console, monospace;
411
-@ font-size: 8pt;
412
-@ border-collapse:collapse;
413
-@ white-space: pre;
414
-@ width: 98%;
415
-@ border: 1px #000 dashed;
416
-@ }
417
-@
418
-@ table.sbsdiff th.diffhdr {
419
-@ border-bottom: dotted;
420
-@ border-width: 1px;
421
-@ }
422
-@
423
-@ table.sbsdiff tr td {
424
-@ white-space: pre;
425
-@ padding-left: 3px;
426
-@ padding-right: 3px;
427
-@ margin: 0px;
428
-@ }
429
-@
430
-@ table.sbsdiff tr td.lineno {
431
-@ text-align: right;
432
-@ }
433
-@
434
-@ table.sbsdiff tr td.meta {
435
-@ background-color: #a09048;
436
-@ text-align: center;
437
-@ }
438
-@
439
-@ table.sbsdiff tr td.added {
440
-@ background-color: rgb(210, 210, 100);
441
-@ }
442
-@
443
-@ table.sbsdiff tr td.removed {
444
-@ background-color: rgb(190, 200, 110);
445
-@ }
446
-@
447
-@ table.sbsdiff tr td.changed {
448
-@ background-color: rgb(200, 210, 120);
449360
@ }');
450361
@ REPLACE INTO config(name,mtime,value) VALUES('header',now(),'<html>
451362
@ <head>
452363
@ <title>$<project_name>: $<title></title>
453364
@ <link rel="alternate" type="application/rss+xml" title="RSS Feed"
@@ -680,56 +591,10 @@
680591
@ /* The label/value pairs on (for example) the ci page */
681592
@ table.label-value th {
682593
@ vertical-align: top;
683594
@ text-align: right;
684595
@ padding: 0.2ex 2ex;
685
-@ }
686
-@
687
-@ /* Side-by-side diff */
688
-@ table.sbsdiff {
689
-@ background-color: white;
690
-@ font-family: fixed, Dejavu Sans Mono, Monaco, Lucida Console, monospace;
691
-@ font-size: 6pt;
692
-@ border-collapse:collapse;
693
-@ white-space: pre;
694
-@ width: 98%;
695
-@ border: 1px #000 dashed;
696
-@ }
697
-@
698
-@ table.sbsdiff th.diffhdr {
699
-@ border-bottom: dotted;
700
-@ border-width: 1px;
701
-@ }
702
-@
703
-@ table.sbsdiff tr td {
704
-@ white-space: pre;
705
-@ padding-left: 3px;
706
-@ padding-right: 3px;
707
-@ margin: 0px;
708
-@ }
709
-@
710
-@ table.sbsdiff tr td.lineno {
711
-@ text-align: right;
712
-@ }
713
-@
714
-@ table.sbsdiff tr td.meta {
715
-@ color: white;
716
-@ background-color: black;
717
-@ text-align: center;
718
-@ }
719
-@
720
-@ table.sbsdiff tr td.added {
721
-@ background-color: white;
722
-@ }
723
-@
724
-@ table.sbsdiff tr td.removed {
725
-@ background-color: white;
726
-@ text-decoration: line-through;
727
-@ }
728
-@
729
-@ table.sbsdiff tr td.changed {
730
-@ background-color: white;
731596
@ }');
732597
@ REPLACE INTO config(name,mtime,value) VALUES('header',now(),'<html>
733598
@ <head>
734599
@ <title>$<project_name>: $<title></title>
735600
@ <link rel="alternate" type="application/rss+xml" title="RSS Feed"
@@ -1024,77 +889,10 @@
1024889
@ padding: 3px 5px;
1025890
@ }
1026891
@
1027892
@ textarea {
1028893
@ font-size: 1em;
1029
-@ }
1030
-@
1031
-@ /* Side-by-side diff */
1032
-@ table.sbsdiff {
1033
-@ background-color: white;
1034
-@ font-family: Dejavu Sans Mono, Monaco, Lucida Console, monospace;
1035
-@ font-size: 6pt;
1036
-@ border-collapse:collapse;
1037
-@ width: 98%;
1038
-@ border: 1px #000 dashed;
1039
-@ margin-left: auto;
1040
-@ margin-right: auto;
1041
-@ }
1042
-@
1043
-@ table.sbsdiff th.diffhdr {
1044
-@ border-bottom: dotted;
1045
-@ border-width: 1px;
1046
-@ }
1047
-@
1048
-@ table.sbsdiff tr td {
1049
-@ padding-left: 3px;
1050
-@ padding-right: 3px;
1051
-@ margin: 0px;
1052
-@ vertical-align: top;
1053
-@ white-space: pre-wrap;
1054
-@ }
1055
-@
1056
-@ table.sbsdiff tr td.lineno {
1057
-@ text-align: right;
1058
-@ /* border-bottom: 1px solid rgb(220, 220, 220); */
1059
-@ }
1060
-@
1061
-@ table.sbsdiff tr td.srcline {
1062
-@ /* max-width: 400px; */
1063
-@ /* Note: May partially hide long lines without whitespaces */
1064
-@ /* overflow: hidden; */
1065
-@ /* border-bottom: 1px solid rgb(220, 220, 220); */
1066
-@ }
1067
-@
1068
-@ table.sbsdiff tr td.meta {
1069
-@ background-color: rgb(170, 160, 255);
1070
-@ padding-top: 0.25em;
1071
-@ padding-bottom: 0.25em;
1072
-@ text-align: center;
1073
-@ -moz-border-radius: 5px;
1074
-@ -moz-border-radius: 5px;
1075
-@ -webkit-border-radius: 5px;
1076
-@ -webkit-border-radius: 5px;
1077
-@ -border-radius: 5px;
1078
-@ -border-radius: 5px;
1079
-@ border-radius: 5px;
1080
-@ border-radius: 5px;
1081
-@ }
1082
-@
1083
-@ table.sbsdiff tr td.added {
1084
-@ background-color: rgb(180, 250, 180);
1085
-@ /* border-bottom: 1px solid rgb(160, 230, 160); */
1086
-@ }
1087
-@
1088
-@ table.sbsdiff tr td.removed {
1089
-@ background-color: rgb(250, 130, 130);
1090
-@ /* border-bottom: 1px solid rgb(230, 110, 110); */
1091
-@ }
1092
-@
1093
-@ table.sbsdiff tr td.changed {
1094
-@ background-color: rgb(210, 210, 200);
1095
-@ /* border-bottom: 1px solid rgb(190, 190, 180); */
1096894
@ }');
1097895
@ REPLACE INTO config(name,mtime,value) VALUES('header',now(),'<html>
1098896
@ <head>
1099897
@ <title>$<project_name>: $<title></title>
1100898
@ <link rel="alternate" type="application/rss+xml" title="RSS Feed"
1101899
--- src/skins.c
+++ src/skins.c
@@ -153,55 +153,10 @@
153 @ /* The label/value pairs on (for example) the vinfo page */
154 @ table.label-value th {
155 @ vertical-align: top;
156 @ text-align: right;
157 @ padding: 0.2ex 2ex;
158 @ }
159 @
160 @ /* Side-by-side diff */
161 @ table.sbsdiff {
162 @ background-color: white;
163 @ font-family: fixed, Dejavu Sans Mono, Monaco, Lucida Console, monospace;
164 @ font-size: 8pt;
165 @ border-collapse:collapse;
166 @ white-space: pre;
167 @ width: 98%;
168 @ border: 1px #000 dashed;
169 @ }
170 @
171 @ table.sbsdiff th.diffhdr {
172 @ border-bottom: dotted;
173 @ border-width: 1px;
174 @ }
175 @
176 @ table.sbsdiff tr td {
177 @ white-space: pre;
178 @ padding-left: 3px;
179 @ padding-right: 3px;
180 @ margin: 0px;
181 @ }
182 @
183 @ table.sbsdiff tr td.lineno {
184 @ text-align: right;
185 @ }
186 @
187 @ table.sbsdiff tr td.meta {
188 @ color: white;
189 @ background-color: rgb(20, 20, 20);
190 @ text-align: center;
191 @ }
192 @
193 @ table.sbsdiff tr td.added {
194 @ background-color: rgb(230, 230, 230);
195 @ }
196 @
197 @ table.sbsdiff tr td.removed {
198 @ background-color: rgb(200, 200, 200);
199 @ }
200 @
201 @ table.sbsdiff tr td.changed {
202 @ background-color: rgb(220, 220, 220);
203 @ }');
204 @ REPLACE INTO config(name,mtime,value) VALUES('header',now(),'<html>
205 @ <head>
206 @ <title>$<project_name>: $<title></title>
207 @ <link rel="alternate" type="application/rss+xml" title="RSS Feed"
@@ -400,54 +355,10 @@
400 @ /* The label/value pairs on (for example) the ci page */
401 @ table.label-value th {
402 @ vertical-align: top;
403 @ text-align: right;
404 @ padding: 0.2ex 2ex;
405 @ }
406 @
407 @ /* Side-by-side diff */
408 @ table.sbsdiff {
409 @ background-color: #ffffc5;
410 @ font-family: fixed, Dejavu Sans Mono, Monaco, Lucida Console, monospace;
411 @ font-size: 8pt;
412 @ border-collapse:collapse;
413 @ white-space: pre;
414 @ width: 98%;
415 @ border: 1px #000 dashed;
416 @ }
417 @
418 @ table.sbsdiff th.diffhdr {
419 @ border-bottom: dotted;
420 @ border-width: 1px;
421 @ }
422 @
423 @ table.sbsdiff tr td {
424 @ white-space: pre;
425 @ padding-left: 3px;
426 @ padding-right: 3px;
427 @ margin: 0px;
428 @ }
429 @
430 @ table.sbsdiff tr td.lineno {
431 @ text-align: right;
432 @ }
433 @
434 @ table.sbsdiff tr td.meta {
435 @ background-color: #a09048;
436 @ text-align: center;
437 @ }
438 @
439 @ table.sbsdiff tr td.added {
440 @ background-color: rgb(210, 210, 100);
441 @ }
442 @
443 @ table.sbsdiff tr td.removed {
444 @ background-color: rgb(190, 200, 110);
445 @ }
446 @
447 @ table.sbsdiff tr td.changed {
448 @ background-color: rgb(200, 210, 120);
449 @ }');
450 @ REPLACE INTO config(name,mtime,value) VALUES('header',now(),'<html>
451 @ <head>
452 @ <title>$<project_name>: $<title></title>
453 @ <link rel="alternate" type="application/rss+xml" title="RSS Feed"
@@ -680,56 +591,10 @@
680 @ /* The label/value pairs on (for example) the ci page */
681 @ table.label-value th {
682 @ vertical-align: top;
683 @ text-align: right;
684 @ padding: 0.2ex 2ex;
685 @ }
686 @
687 @ /* Side-by-side diff */
688 @ table.sbsdiff {
689 @ background-color: white;
690 @ font-family: fixed, Dejavu Sans Mono, Monaco, Lucida Console, monospace;
691 @ font-size: 6pt;
692 @ border-collapse:collapse;
693 @ white-space: pre;
694 @ width: 98%;
695 @ border: 1px #000 dashed;
696 @ }
697 @
698 @ table.sbsdiff th.diffhdr {
699 @ border-bottom: dotted;
700 @ border-width: 1px;
701 @ }
702 @
703 @ table.sbsdiff tr td {
704 @ white-space: pre;
705 @ padding-left: 3px;
706 @ padding-right: 3px;
707 @ margin: 0px;
708 @ }
709 @
710 @ table.sbsdiff tr td.lineno {
711 @ text-align: right;
712 @ }
713 @
714 @ table.sbsdiff tr td.meta {
715 @ color: white;
716 @ background-color: black;
717 @ text-align: center;
718 @ }
719 @
720 @ table.sbsdiff tr td.added {
721 @ background-color: white;
722 @ }
723 @
724 @ table.sbsdiff tr td.removed {
725 @ background-color: white;
726 @ text-decoration: line-through;
727 @ }
728 @
729 @ table.sbsdiff tr td.changed {
730 @ background-color: white;
731 @ }');
732 @ REPLACE INTO config(name,mtime,value) VALUES('header',now(),'<html>
733 @ <head>
734 @ <title>$<project_name>: $<title></title>
735 @ <link rel="alternate" type="application/rss+xml" title="RSS Feed"
@@ -1024,77 +889,10 @@
1024 @ padding: 3px 5px;
1025 @ }
1026 @
1027 @ textarea {
1028 @ font-size: 1em;
1029 @ }
1030 @
1031 @ /* Side-by-side diff */
1032 @ table.sbsdiff {
1033 @ background-color: white;
1034 @ font-family: Dejavu Sans Mono, Monaco, Lucida Console, monospace;
1035 @ font-size: 6pt;
1036 @ border-collapse:collapse;
1037 @ width: 98%;
1038 @ border: 1px #000 dashed;
1039 @ margin-left: auto;
1040 @ margin-right: auto;
1041 @ }
1042 @
1043 @ table.sbsdiff th.diffhdr {
1044 @ border-bottom: dotted;
1045 @ border-width: 1px;
1046 @ }
1047 @
1048 @ table.sbsdiff tr td {
1049 @ padding-left: 3px;
1050 @ padding-right: 3px;
1051 @ margin: 0px;
1052 @ vertical-align: top;
1053 @ white-space: pre-wrap;
1054 @ }
1055 @
1056 @ table.sbsdiff tr td.lineno {
1057 @ text-align: right;
1058 @ /* border-bottom: 1px solid rgb(220, 220, 220); */
1059 @ }
1060 @
1061 @ table.sbsdiff tr td.srcline {
1062 @ /* max-width: 400px; */
1063 @ /* Note: May partially hide long lines without whitespaces */
1064 @ /* overflow: hidden; */
1065 @ /* border-bottom: 1px solid rgb(220, 220, 220); */
1066 @ }
1067 @
1068 @ table.sbsdiff tr td.meta {
1069 @ background-color: rgb(170, 160, 255);
1070 @ padding-top: 0.25em;
1071 @ padding-bottom: 0.25em;
1072 @ text-align: center;
1073 @ -moz-border-radius: 5px;
1074 @ -moz-border-radius: 5px;
1075 @ -webkit-border-radius: 5px;
1076 @ -webkit-border-radius: 5px;
1077 @ -border-radius: 5px;
1078 @ -border-radius: 5px;
1079 @ border-radius: 5px;
1080 @ border-radius: 5px;
1081 @ }
1082 @
1083 @ table.sbsdiff tr td.added {
1084 @ background-color: rgb(180, 250, 180);
1085 @ /* border-bottom: 1px solid rgb(160, 230, 160); */
1086 @ }
1087 @
1088 @ table.sbsdiff tr td.removed {
1089 @ background-color: rgb(250, 130, 130);
1090 @ /* border-bottom: 1px solid rgb(230, 110, 110); */
1091 @ }
1092 @
1093 @ table.sbsdiff tr td.changed {
1094 @ background-color: rgb(210, 210, 200);
1095 @ /* border-bottom: 1px solid rgb(190, 190, 180); */
1096 @ }');
1097 @ REPLACE INTO config(name,mtime,value) VALUES('header',now(),'<html>
1098 @ <head>
1099 @ <title>$<project_name>: $<title></title>
1100 @ <link rel="alternate" type="application/rss+xml" title="RSS Feed"
1101
--- src/skins.c
+++ src/skins.c
@@ -153,55 +153,10 @@
153 @ /* The label/value pairs on (for example) the vinfo page */
154 @ table.label-value th {
155 @ vertical-align: top;
156 @ text-align: right;
157 @ padding: 0.2ex 2ex;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
158 @ }');
159 @ REPLACE INTO config(name,mtime,value) VALUES('header',now(),'<html>
160 @ <head>
161 @ <title>$<project_name>: $<title></title>
162 @ <link rel="alternate" type="application/rss+xml" title="RSS Feed"
@@ -400,54 +355,10 @@
355 @ /* The label/value pairs on (for example) the ci page */
356 @ table.label-value th {
357 @ vertical-align: top;
358 @ text-align: right;
359 @ padding: 0.2ex 2ex;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
360 @ }');
361 @ REPLACE INTO config(name,mtime,value) VALUES('header',now(),'<html>
362 @ <head>
363 @ <title>$<project_name>: $<title></title>
364 @ <link rel="alternate" type="application/rss+xml" title="RSS Feed"
@@ -680,56 +591,10 @@
591 @ /* The label/value pairs on (for example) the ci page */
592 @ table.label-value th {
593 @ vertical-align: top;
594 @ text-align: right;
595 @ padding: 0.2ex 2ex;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
596 @ }');
597 @ REPLACE INTO config(name,mtime,value) VALUES('header',now(),'<html>
598 @ <head>
599 @ <title>$<project_name>: $<title></title>
600 @ <link rel="alternate" type="application/rss+xml" title="RSS Feed"
@@ -1024,77 +889,10 @@
889 @ padding: 3px 5px;
890 @ }
891 @
892 @ textarea {
893 @ font-size: 1em;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
894 @ }');
895 @ REPLACE INTO config(name,mtime,value) VALUES('header',now(),'<html>
896 @ <head>
897 @ <title>$<project_name>: $<title></title>
898 @ <link rel="alternate" type="application/rss+xml" title="RSS Feed"
899
-60
--- src/style.c
+++ src/style.c
@@ -398,70 +398,10 @@
398398
@ table.label-value th {
399399
@ vertical-align: top;
400400
@ text-align: right;
401401
@ padding: 0.2ex 2ex;
402402
@ }
403
-@
404
-@ /* Side-by-side diff */
405
-@ table.sbsdiff {
406
-@ background-color: white;
407
-@ font-family: fixed, Dejavu Sans Mono, Monaco, Lucida Console, monospace;
408
-@ font-size: 8pt;
409
-@ border-collapse:collapse;
410
-@ white-space: pre;
411
-@ width: 98%;
412
-@ border: 1px #000 dashed;
413
-@ margin-left: auto;
414
-@ margin-right: auto;
415
-@ }
416
-@
417
-@ table.sbsdiff th.diffhdr {
418
-@ border-bottom: dotted;
419
-@ border-width: 1px;
420
-@ }
421
-@
422
-@ table.sbsdiff tr td {
423
-@ white-space: pre;
424
-@ padding-left: 3px;
425
-@ padding-right: 3px;
426
-@ margin: 0px;
427
-@ vertical-align: top;
428
-@ }
429
-@
430
-@ table.sbsdiff tr td.lineno {
431
-@ text-align: right;
432
-@ }
433
-@
434
-@ table.sbsdiff tr td.srcline {
435
-@ }
436
-@
437
-@ table.sbsdiff tr td.meta {
438
-@ background-color: rgb(170, 160, 255);
439
-@ text-align: center;
440
-@ }
441
-@
442
-@ table.sbsdiff tr td.added {
443
-@ background-color: rgb(180, 250, 180);
444
-@ }
445
-@ table.sbsdiff tr td.addedvoid {
446
-@ background-color: rgb(190, 190, 180);
447
-@ }
448
-@
449
-@ table.sbsdiff tr td.removed {
450
-@ background-color: rgb(250, 130, 130);
451
-@ }
452
-@ table.sbsdiff tr td.removedvoid {
453
-@ background-color: rgb(190, 190, 180);
454
-@ }
455
-@
456
-@ table.sbsdiff tr td.changed {
457
-@ background-color: rgb(210, 210, 200);
458
-@ }
459
-@ table.sbsdiff tr td.changedvoid {
460
-@ background-color: rgb(190, 190, 180);
461
-@ }
462
-@
463403
;
464404
465405
466406
/* The following table contains bits of default CSS that must
467407
** be included if they are not found in the application-defined
468408
--- src/style.c
+++ src/style.c
@@ -398,70 +398,10 @@
398 @ table.label-value th {
399 @ vertical-align: top;
400 @ text-align: right;
401 @ padding: 0.2ex 2ex;
402 @ }
403 @
404 @ /* Side-by-side diff */
405 @ table.sbsdiff {
406 @ background-color: white;
407 @ font-family: fixed, Dejavu Sans Mono, Monaco, Lucida Console, monospace;
408 @ font-size: 8pt;
409 @ border-collapse:collapse;
410 @ white-space: pre;
411 @ width: 98%;
412 @ border: 1px #000 dashed;
413 @ margin-left: auto;
414 @ margin-right: auto;
415 @ }
416 @
417 @ table.sbsdiff th.diffhdr {
418 @ border-bottom: dotted;
419 @ border-width: 1px;
420 @ }
421 @
422 @ table.sbsdiff tr td {
423 @ white-space: pre;
424 @ padding-left: 3px;
425 @ padding-right: 3px;
426 @ margin: 0px;
427 @ vertical-align: top;
428 @ }
429 @
430 @ table.sbsdiff tr td.lineno {
431 @ text-align: right;
432 @ }
433 @
434 @ table.sbsdiff tr td.srcline {
435 @ }
436 @
437 @ table.sbsdiff tr td.meta {
438 @ background-color: rgb(170, 160, 255);
439 @ text-align: center;
440 @ }
441 @
442 @ table.sbsdiff tr td.added {
443 @ background-color: rgb(180, 250, 180);
444 @ }
445 @ table.sbsdiff tr td.addedvoid {
446 @ background-color: rgb(190, 190, 180);
447 @ }
448 @
449 @ table.sbsdiff tr td.removed {
450 @ background-color: rgb(250, 130, 130);
451 @ }
452 @ table.sbsdiff tr td.removedvoid {
453 @ background-color: rgb(190, 190, 180);
454 @ }
455 @
456 @ table.sbsdiff tr td.changed {
457 @ background-color: rgb(210, 210, 200);
458 @ }
459 @ table.sbsdiff tr td.changedvoid {
460 @ background-color: rgb(190, 190, 180);
461 @ }
462 @
463 ;
464
465
466 /* The following table contains bits of default CSS that must
467 ** be included if they are not found in the application-defined
468
--- src/style.c
+++ src/style.c
@@ -398,70 +398,10 @@
398 @ table.label-value th {
399 @ vertical-align: top;
400 @ text-align: right;
401 @ padding: 0.2ex 2ex;
402 @ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
403 ;
404
405
406 /* The following table contains bits of default CSS that must
407 ** be included if they are not found in the application-defined
408
+34 -56
--- src/vfile.c
+++ src/vfile.c
@@ -124,40 +124,30 @@
124124
manifest_destroy(p);
125125
db_end_transaction(0);
126126
}
127127
128128
/*
129
-** Look at every VFILE entry with the given vid and set update
130
-** VFILE.CHNGED field on every file according to whether or not
131
-** the file has changes. 0 means no change. 1 means edited. 2 means
132
-** the file has changed due to a merge. 3 means the file was added
133
-** by a merge.
134
-**
135
-** If VFILE.DELETED is true or if VFILE.RID is zero, then the file was
136
-** either removed from managemented via "fossil rm" or added via
137
-** "fossil add", respectively, and in both cases we always know that
138
-** the file has changed without having the check the size, mtime,
139
-** or on-disk content.
140
-**
141
-** If the size of the file has changed, then we always know that the file
142
-** changed without having to look at the mtime or on-disk content.
143
-**
144
-** The mtime of the file is only a factor if the mtime-changes setting
145
-** is false and the useSha1sum flag is false. If the mtime-changes
146
-** setting is true (or undefined - it defaults to true) or if useSha1sum
147
-** is true, then we do not trust the mtime and will examine the on-disk
148
-** content to determine if a file really is the same.
149
-**
150
-** If the mtime is used, it is used only to determine if files are the same.
151
-** If the mtime of a file has changed, we still examine the on-disk content
152
-** to see whether or not the edit was a null-edit.
129
+** Check the file signature of the disk image for every VFILE of vid.
130
+**
131
+** Set the VFILE.CHNGED field on every file that has changed. Also
132
+** set VFILE.CHNGED on every folder that contains a file or folder
133
+** that has changed.
134
+**
135
+** If VFILE.DELETED is null or if VFILE.RID is zero, then we can assume
136
+** the file has changed without having the check the on-disk image.
137
+**
138
+** If the size of the file has changed, then we assume that it has
139
+** changed. If the mtime of the file has not changed and useSha1sum is false
140
+** and the mtime-changes setting is true (the default) then we assume that
141
+** the file has not changed. If the mtime has changed, we go ahead and
142
+** double-check that the file has changed by looking at its SHA1 sum.
153143
*/
154144
void vfile_check_signature(int vid, int notFileIsFatal, int useSha1sum){
155145
int nErr = 0;
156146
Stmt q;
157147
Blob fileCksum, origCksum;
158
- int useMtime = useSha1sum==0 && db_get_boolean("mtime-changes", 1);
148
+ int checkMtime = useSha1sum==0 && db_get_boolean("mtime-changes", 1);
159149
160150
db_begin_transaction();
161151
db_prepare(&q, "SELECT id, %Q || pathname,"
162152
" vfile.mrid, deleted, chnged, uuid, size, mtime"
163153
" FROM vfile LEFT JOIN blob ON vfile.mrid=blob.rid"
@@ -167,67 +157,55 @@
167157
const char *zName;
168158
int chnged = 0;
169159
int oldChnged;
170160
i64 oldMtime;
171161
i64 currentMtime;
172
- i64 origSize;
173
- i64 currentSize;
174162
175163
id = db_column_int(&q, 0);
176164
zName = db_column_text(&q, 1);
177165
rid = db_column_int(&q, 2);
178166
isDeleted = db_column_int(&q, 3);
179
- oldChnged = chnged = db_column_int(&q, 4);
167
+ oldChnged = db_column_int(&q, 4);
180168
oldMtime = db_column_int64(&q, 7);
181
- currentSize = file_wd_size(zName);
182
- origSize = db_column_int64(&q, 6);
183
- currentMtime = file_wd_mtime(0);
184
- if( chnged==0 && (isDeleted || rid==0) ){
185
- /* "fossil rm" or "fossil add" always change the file */
169
+ if( isDeleted ){
186170
chnged = 1;
187
- }else if( !file_wd_isfile_or_link(0) && currentSize>=0 ){
171
+ }else if( !file_wd_isfile_or_link(zName) && file_wd_size(0)>=0 ){
188172
if( notFileIsFatal ){
189173
fossil_warning("not an ordinary file: %s", zName);
190174
nErr++;
191175
}
192176
chnged = 1;
177
+ }else if( oldChnged>=2 ){
178
+ chnged = oldChnged;
179
+ }else if( rid==0 ){
180
+ chnged = 1;
193181
}
194
- if( origSize!=currentSize ){
195
- if( chnged==0 ){
182
+ if( chnged!=1 ){
183
+ i64 origSize = db_column_int64(&q, 6);
184
+ currentMtime = file_wd_mtime(0);
185
+ if( origSize!=file_wd_size(0) ){
196186
/* A file size change is definitive - the file has changed. No
197
- ** need to check the mtime or sha1sum */
187
+ ** need to check the sha1sum */
198188
chnged = 1;
199189
}
200
- }else if( (chnged==1 || chnged==2) && rid!=0 && !isDeleted ){
201
- /* File is believed to have changed but it is the same size.
202
- ** Double check that it really has changed by looking at content. */
203
- assert( origSize==currentSize );
204
- db_ephemeral_blob(&q, 5, &origCksum);
205
- if( sha1sum_file(zName, &fileCksum) ){
206
- blob_zero(&fileCksum);
207
- }
208
- if( blob_compare(&fileCksum, &origCksum)==0 ) chnged = 0;
209
- blob_reset(&origCksum);
210
- blob_reset(&fileCksum);
211
- }else if( chnged==0 && (useMtime==0 || currentMtime!=oldMtime) ){
212
- /* For files that were formerly believed to be unchanged, if their
213
- ** mtime changes, or unconditionally if --sha1sum is used, check
214
- ** to see if they have been edited by looking at their SHA1 sum */
215
- assert( origSize==currentSize );
190
+ }
191
+ if( chnged!=1 && (checkMtime==0 || currentMtime!=oldMtime) ){
216192
db_ephemeral_blob(&q, 5, &origCksum);
217193
if( sha1sum_file(zName, &fileCksum) ){
218194
blob_zero(&fileCksum);
219195
}
220196
if( blob_compare(&fileCksum, &origCksum) ){
221197
chnged = 1;
198
+ }else if( currentMtime!=oldMtime ){
199
+ db_multi_exec("UPDATE vfile SET mtime=%lld WHERE id=%d",
200
+ currentMtime, id);
222201
}
223202
blob_reset(&origCksum);
224203
blob_reset(&fileCksum);
225204
}
226
- if( currentMtime!=oldMtime || chnged!=oldChnged ){
227
- db_multi_exec("UPDATE vfile SET mtime=%lld, chnged=%d WHERE id=%d",
228
- currentMtime, chnged, id);
205
+ if( chnged!=oldChnged && (chnged || !checkMtime) ){
206
+ db_multi_exec("UPDATE vfile SET chnged=%d WHERE id=%d", chnged, id);
229207
}
230208
}
231209
db_finalize(&q);
232210
if( nErr ) fossil_fatal("abort due to prior errors");
233211
db_end_transaction(0);
234212
--- src/vfile.c
+++ src/vfile.c
@@ -124,40 +124,30 @@
124 manifest_destroy(p);
125 db_end_transaction(0);
126 }
127
128 /*
129 ** Look at every VFILE entry with the given vid and set update
130 ** VFILE.CHNGED field on every file according to whether or not
131 ** the file has changes. 0 means no change. 1 means edited. 2 means
132 ** the file has changed due to a merge. 3 means the file was added
133 ** by a merge.
134 **
135 ** If VFILE.DELETED is true or if VFILE.RID is zero, then the file was
136 ** either removed from managemented via "fossil rm" or added via
137 ** "fossil add", respectively, and in both cases we always know that
138 ** the file has changed without having the check the size, mtime,
139 ** or on-disk content.
140 **
141 ** If the size of the file has changed, then we always know that the file
142 ** changed without having to look at the mtime or on-disk content.
143 **
144 ** The mtime of the file is only a factor if the mtime-changes setting
145 ** is false and the useSha1sum flag is false. If the mtime-changes
146 ** setting is true (or undefined - it defaults to true) or if useSha1sum
147 ** is true, then we do not trust the mtime and will examine the on-disk
148 ** content to determine if a file really is the same.
149 **
150 ** If the mtime is used, it is used only to determine if files are the same.
151 ** If the mtime of a file has changed, we still examine the on-disk content
152 ** to see whether or not the edit was a null-edit.
153 */
154 void vfile_check_signature(int vid, int notFileIsFatal, int useSha1sum){
155 int nErr = 0;
156 Stmt q;
157 Blob fileCksum, origCksum;
158 int useMtime = useSha1sum==0 && db_get_boolean("mtime-changes", 1);
159
160 db_begin_transaction();
161 db_prepare(&q, "SELECT id, %Q || pathname,"
162 " vfile.mrid, deleted, chnged, uuid, size, mtime"
163 " FROM vfile LEFT JOIN blob ON vfile.mrid=blob.rid"
@@ -167,67 +157,55 @@
167 const char *zName;
168 int chnged = 0;
169 int oldChnged;
170 i64 oldMtime;
171 i64 currentMtime;
172 i64 origSize;
173 i64 currentSize;
174
175 id = db_column_int(&q, 0);
176 zName = db_column_text(&q, 1);
177 rid = db_column_int(&q, 2);
178 isDeleted = db_column_int(&q, 3);
179 oldChnged = chnged = db_column_int(&q, 4);
180 oldMtime = db_column_int64(&q, 7);
181 currentSize = file_wd_size(zName);
182 origSize = db_column_int64(&q, 6);
183 currentMtime = file_wd_mtime(0);
184 if( chnged==0 && (isDeleted || rid==0) ){
185 /* "fossil rm" or "fossil add" always change the file */
186 chnged = 1;
187 }else if( !file_wd_isfile_or_link(0) && currentSize>=0 ){
188 if( notFileIsFatal ){
189 fossil_warning("not an ordinary file: %s", zName);
190 nErr++;
191 }
192 chnged = 1;
 
 
 
 
193 }
194 if( origSize!=currentSize ){
195 if( chnged==0 ){
 
 
196 /* A file size change is definitive - the file has changed. No
197 ** need to check the mtime or sha1sum */
198 chnged = 1;
199 }
200 }else if( (chnged==1 || chnged==2) && rid!=0 && !isDeleted ){
201 /* File is believed to have changed but it is the same size.
202 ** Double check that it really has changed by looking at content. */
203 assert( origSize==currentSize );
204 db_ephemeral_blob(&q, 5, &origCksum);
205 if( sha1sum_file(zName, &fileCksum) ){
206 blob_zero(&fileCksum);
207 }
208 if( blob_compare(&fileCksum, &origCksum)==0 ) chnged = 0;
209 blob_reset(&origCksum);
210 blob_reset(&fileCksum);
211 }else if( chnged==0 && (useMtime==0 || currentMtime!=oldMtime) ){
212 /* For files that were formerly believed to be unchanged, if their
213 ** mtime changes, or unconditionally if --sha1sum is used, check
214 ** to see if they have been edited by looking at their SHA1 sum */
215 assert( origSize==currentSize );
216 db_ephemeral_blob(&q, 5, &origCksum);
217 if( sha1sum_file(zName, &fileCksum) ){
218 blob_zero(&fileCksum);
219 }
220 if( blob_compare(&fileCksum, &origCksum) ){
221 chnged = 1;
 
 
 
222 }
223 blob_reset(&origCksum);
224 blob_reset(&fileCksum);
225 }
226 if( currentMtime!=oldMtime || chnged!=oldChnged ){
227 db_multi_exec("UPDATE vfile SET mtime=%lld, chnged=%d WHERE id=%d",
228 currentMtime, chnged, id);
229 }
230 }
231 db_finalize(&q);
232 if( nErr ) fossil_fatal("abort due to prior errors");
233 db_end_transaction(0);
234
--- src/vfile.c
+++ src/vfile.c
@@ -124,40 +124,30 @@
124 manifest_destroy(p);
125 db_end_transaction(0);
126 }
127
128 /*
129 ** Check the file signature of the disk image for every VFILE of vid.
130 **
131 ** Set the VFILE.CHNGED field on every file that has changed. Also
132 ** set VFILE.CHNGED on every folder that contains a file or folder
133 ** that has changed.
134 **
135 ** If VFILE.DELETED is null or if VFILE.RID is zero, then we can assume
136 ** the file has changed without having the check the on-disk image.
137 **
138 ** If the size of the file has changed, then we assume that it has
139 ** changed. If the mtime of the file has not changed and useSha1sum is false
140 ** and the mtime-changes setting is true (the default) then we assume that
141 ** the file has not changed. If the mtime has changed, we go ahead and
142 ** double-check that the file has changed by looking at its SHA1 sum.
 
 
 
 
 
 
 
 
 
 
143 */
144 void vfile_check_signature(int vid, int notFileIsFatal, int useSha1sum){
145 int nErr = 0;
146 Stmt q;
147 Blob fileCksum, origCksum;
148 int checkMtime = useSha1sum==0 && db_get_boolean("mtime-changes", 1);
149
150 db_begin_transaction();
151 db_prepare(&q, "SELECT id, %Q || pathname,"
152 " vfile.mrid, deleted, chnged, uuid, size, mtime"
153 " FROM vfile LEFT JOIN blob ON vfile.mrid=blob.rid"
@@ -167,67 +157,55 @@
157 const char *zName;
158 int chnged = 0;
159 int oldChnged;
160 i64 oldMtime;
161 i64 currentMtime;
 
 
162
163 id = db_column_int(&q, 0);
164 zName = db_column_text(&q, 1);
165 rid = db_column_int(&q, 2);
166 isDeleted = db_column_int(&q, 3);
167 oldChnged = db_column_int(&q, 4);
168 oldMtime = db_column_int64(&q, 7);
169 if( isDeleted ){
 
 
 
 
170 chnged = 1;
171 }else if( !file_wd_isfile_or_link(zName) && file_wd_size(0)>=0 ){
172 if( notFileIsFatal ){
173 fossil_warning("not an ordinary file: %s", zName);
174 nErr++;
175 }
176 chnged = 1;
177 }else if( oldChnged>=2 ){
178 chnged = oldChnged;
179 }else if( rid==0 ){
180 chnged = 1;
181 }
182 if( chnged!=1 ){
183 i64 origSize = db_column_int64(&q, 6);
184 currentMtime = file_wd_mtime(0);
185 if( origSize!=file_wd_size(0) ){
186 /* A file size change is definitive - the file has changed. No
187 ** need to check the sha1sum */
188 chnged = 1;
189 }
190 }
191 if( chnged!=1 && (checkMtime==0 || currentMtime!=oldMtime) ){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
192 db_ephemeral_blob(&q, 5, &origCksum);
193 if( sha1sum_file(zName, &fileCksum) ){
194 blob_zero(&fileCksum);
195 }
196 if( blob_compare(&fileCksum, &origCksum) ){
197 chnged = 1;
198 }else if( currentMtime!=oldMtime ){
199 db_multi_exec("UPDATE vfile SET mtime=%lld WHERE id=%d",
200 currentMtime, id);
201 }
202 blob_reset(&origCksum);
203 blob_reset(&fileCksum);
204 }
205 if( chnged!=oldChnged && (chnged || !checkMtime) ){
206 db_multi_exec("UPDATE vfile SET chnged=%d WHERE id=%d", chnged, id);
 
207 }
208 }
209 db_finalize(&q);
210 if( nErr ) fossil_fatal("abort due to prior errors");
211 db_end_transaction(0);
212
+34 -56
--- src/vfile.c
+++ src/vfile.c
@@ -124,40 +124,30 @@
124124
manifest_destroy(p);
125125
db_end_transaction(0);
126126
}
127127
128128
/*
129
-** Look at every VFILE entry with the given vid and set update
130
-** VFILE.CHNGED field on every file according to whether or not
131
-** the file has changes. 0 means no change. 1 means edited. 2 means
132
-** the file has changed due to a merge. 3 means the file was added
133
-** by a merge.
134
-**
135
-** If VFILE.DELETED is true or if VFILE.RID is zero, then the file was
136
-** either removed from managemented via "fossil rm" or added via
137
-** "fossil add", respectively, and in both cases we always know that
138
-** the file has changed without having the check the size, mtime,
139
-** or on-disk content.
140
-**
141
-** If the size of the file has changed, then we always know that the file
142
-** changed without having to look at the mtime or on-disk content.
143
-**
144
-** The mtime of the file is only a factor if the mtime-changes setting
145
-** is false and the useSha1sum flag is false. If the mtime-changes
146
-** setting is true (or undefined - it defaults to true) or if useSha1sum
147
-** is true, then we do not trust the mtime and will examine the on-disk
148
-** content to determine if a file really is the same.
149
-**
150
-** If the mtime is used, it is used only to determine if files are the same.
151
-** If the mtime of a file has changed, we still examine the on-disk content
152
-** to see whether or not the edit was a null-edit.
129
+** Check the file signature of the disk image for every VFILE of vid.
130
+**
131
+** Set the VFILE.CHNGED field on every file that has changed. Also
132
+** set VFILE.CHNGED on every folder that contains a file or folder
133
+** that has changed.
134
+**
135
+** If VFILE.DELETED is null or if VFILE.RID is zero, then we can assume
136
+** the file has changed without having the check the on-disk image.
137
+**
138
+** If the size of the file has changed, then we assume that it has
139
+** changed. If the mtime of the file has not changed and useSha1sum is false
140
+** and the mtime-changes setting is true (the default) then we assume that
141
+** the file has not changed. If the mtime has changed, we go ahead and
142
+** double-check that the file has changed by looking at its SHA1 sum.
153143
*/
154144
void vfile_check_signature(int vid, int notFileIsFatal, int useSha1sum){
155145
int nErr = 0;
156146
Stmt q;
157147
Blob fileCksum, origCksum;
158
- int useMtime = useSha1sum==0 && db_get_boolean("mtime-changes", 1);
148
+ int checkMtime = useSha1sum==0 && db_get_boolean("mtime-changes", 1);
159149
160150
db_begin_transaction();
161151
db_prepare(&q, "SELECT id, %Q || pathname,"
162152
" vfile.mrid, deleted, chnged, uuid, size, mtime"
163153
" FROM vfile LEFT JOIN blob ON vfile.mrid=blob.rid"
@@ -167,67 +157,55 @@
167157
const char *zName;
168158
int chnged = 0;
169159
int oldChnged;
170160
i64 oldMtime;
171161
i64 currentMtime;
172
- i64 origSize;
173
- i64 currentSize;
174162
175163
id = db_column_int(&q, 0);
176164
zName = db_column_text(&q, 1);
177165
rid = db_column_int(&q, 2);
178166
isDeleted = db_column_int(&q, 3);
179
- oldChnged = chnged = db_column_int(&q, 4);
167
+ oldChnged = db_column_int(&q, 4);
180168
oldMtime = db_column_int64(&q, 7);
181
- currentSize = file_wd_size(zName);
182
- origSize = db_column_int64(&q, 6);
183
- currentMtime = file_wd_mtime(0);
184
- if( chnged==0 && (isDeleted || rid==0) ){
185
- /* "fossil rm" or "fossil add" always change the file */
169
+ if( isDeleted ){
186170
chnged = 1;
187
- }else if( !file_wd_isfile_or_link(0) && currentSize>=0 ){
171
+ }else if( !file_wd_isfile_or_link(zName) && file_wd_size(0)>=0 ){
188172
if( notFileIsFatal ){
189173
fossil_warning("not an ordinary file: %s", zName);
190174
nErr++;
191175
}
192176
chnged = 1;
177
+ }else if( oldChnged>=2 ){
178
+ chnged = oldChnged;
179
+ }else if( rid==0 ){
180
+ chnged = 1;
193181
}
194
- if( origSize!=currentSize ){
195
- if( chnged==0 ){
182
+ if( chnged!=1 ){
183
+ i64 origSize = db_column_int64(&q, 6);
184
+ currentMtime = file_wd_mtime(0);
185
+ if( origSize!=file_wd_size(0) ){
196186
/* A file size change is definitive - the file has changed. No
197
- ** need to check the mtime or sha1sum */
187
+ ** need to check the sha1sum */
198188
chnged = 1;
199189
}
200
- }else if( (chnged==1 || chnged==2) && rid!=0 && !isDeleted ){
201
- /* File is believed to have changed but it is the same size.
202
- ** Double check that it really has changed by looking at content. */
203
- assert( origSize==currentSize );
204
- db_ephemeral_blob(&q, 5, &origCksum);
205
- if( sha1sum_file(zName, &fileCksum) ){
206
- blob_zero(&fileCksum);
207
- }
208
- if( blob_compare(&fileCksum, &origCksum)==0 ) chnged = 0;
209
- blob_reset(&origCksum);
210
- blob_reset(&fileCksum);
211
- }else if( chnged==0 && (useMtime==0 || currentMtime!=oldMtime) ){
212
- /* For files that were formerly believed to be unchanged, if their
213
- ** mtime changes, or unconditionally if --sha1sum is used, check
214
- ** to see if they have been edited by looking at their SHA1 sum */
215
- assert( origSize==currentSize );
190
+ }
191
+ if( chnged!=1 && (checkMtime==0 || currentMtime!=oldMtime) ){
216192
db_ephemeral_blob(&q, 5, &origCksum);
217193
if( sha1sum_file(zName, &fileCksum) ){
218194
blob_zero(&fileCksum);
219195
}
220196
if( blob_compare(&fileCksum, &origCksum) ){
221197
chnged = 1;
198
+ }else if( currentMtime!=oldMtime ){
199
+ db_multi_exec("UPDATE vfile SET mtime=%lld WHERE id=%d",
200
+ currentMtime, id);
222201
}
223202
blob_reset(&origCksum);
224203
blob_reset(&fileCksum);
225204
}
226
- if( currentMtime!=oldMtime || chnged!=oldChnged ){
227
- db_multi_exec("UPDATE vfile SET mtime=%lld, chnged=%d WHERE id=%d",
228
- currentMtime, chnged, id);
205
+ if( chnged!=oldChnged && (chnged || !checkMtime) ){
206
+ db_multi_exec("UPDATE vfile SET chnged=%d WHERE id=%d", chnged, id);
229207
}
230208
}
231209
db_finalize(&q);
232210
if( nErr ) fossil_fatal("abort due to prior errors");
233211
db_end_transaction(0);
234212
--- src/vfile.c
+++ src/vfile.c
@@ -124,40 +124,30 @@
124 manifest_destroy(p);
125 db_end_transaction(0);
126 }
127
128 /*
129 ** Look at every VFILE entry with the given vid and set update
130 ** VFILE.CHNGED field on every file according to whether or not
131 ** the file has changes. 0 means no change. 1 means edited. 2 means
132 ** the file has changed due to a merge. 3 means the file was added
133 ** by a merge.
134 **
135 ** If VFILE.DELETED is true or if VFILE.RID is zero, then the file was
136 ** either removed from managemented via "fossil rm" or added via
137 ** "fossil add", respectively, and in both cases we always know that
138 ** the file has changed without having the check the size, mtime,
139 ** or on-disk content.
140 **
141 ** If the size of the file has changed, then we always know that the file
142 ** changed without having to look at the mtime or on-disk content.
143 **
144 ** The mtime of the file is only a factor if the mtime-changes setting
145 ** is false and the useSha1sum flag is false. If the mtime-changes
146 ** setting is true (or undefined - it defaults to true) or if useSha1sum
147 ** is true, then we do not trust the mtime and will examine the on-disk
148 ** content to determine if a file really is the same.
149 **
150 ** If the mtime is used, it is used only to determine if files are the same.
151 ** If the mtime of a file has changed, we still examine the on-disk content
152 ** to see whether or not the edit was a null-edit.
153 */
154 void vfile_check_signature(int vid, int notFileIsFatal, int useSha1sum){
155 int nErr = 0;
156 Stmt q;
157 Blob fileCksum, origCksum;
158 int useMtime = useSha1sum==0 && db_get_boolean("mtime-changes", 1);
159
160 db_begin_transaction();
161 db_prepare(&q, "SELECT id, %Q || pathname,"
162 " vfile.mrid, deleted, chnged, uuid, size, mtime"
163 " FROM vfile LEFT JOIN blob ON vfile.mrid=blob.rid"
@@ -167,67 +157,55 @@
167 const char *zName;
168 int chnged = 0;
169 int oldChnged;
170 i64 oldMtime;
171 i64 currentMtime;
172 i64 origSize;
173 i64 currentSize;
174
175 id = db_column_int(&q, 0);
176 zName = db_column_text(&q, 1);
177 rid = db_column_int(&q, 2);
178 isDeleted = db_column_int(&q, 3);
179 oldChnged = chnged = db_column_int(&q, 4);
180 oldMtime = db_column_int64(&q, 7);
181 currentSize = file_wd_size(zName);
182 origSize = db_column_int64(&q, 6);
183 currentMtime = file_wd_mtime(0);
184 if( chnged==0 && (isDeleted || rid==0) ){
185 /* "fossil rm" or "fossil add" always change the file */
186 chnged = 1;
187 }else if( !file_wd_isfile_or_link(0) && currentSize>=0 ){
188 if( notFileIsFatal ){
189 fossil_warning("not an ordinary file: %s", zName);
190 nErr++;
191 }
192 chnged = 1;
 
 
 
 
193 }
194 if( origSize!=currentSize ){
195 if( chnged==0 ){
 
 
196 /* A file size change is definitive - the file has changed. No
197 ** need to check the mtime or sha1sum */
198 chnged = 1;
199 }
200 }else if( (chnged==1 || chnged==2) && rid!=0 && !isDeleted ){
201 /* File is believed to have changed but it is the same size.
202 ** Double check that it really has changed by looking at content. */
203 assert( origSize==currentSize );
204 db_ephemeral_blob(&q, 5, &origCksum);
205 if( sha1sum_file(zName, &fileCksum) ){
206 blob_zero(&fileCksum);
207 }
208 if( blob_compare(&fileCksum, &origCksum)==0 ) chnged = 0;
209 blob_reset(&origCksum);
210 blob_reset(&fileCksum);
211 }else if( chnged==0 && (useMtime==0 || currentMtime!=oldMtime) ){
212 /* For files that were formerly believed to be unchanged, if their
213 ** mtime changes, or unconditionally if --sha1sum is used, check
214 ** to see if they have been edited by looking at their SHA1 sum */
215 assert( origSize==currentSize );
216 db_ephemeral_blob(&q, 5, &origCksum);
217 if( sha1sum_file(zName, &fileCksum) ){
218 blob_zero(&fileCksum);
219 }
220 if( blob_compare(&fileCksum, &origCksum) ){
221 chnged = 1;
 
 
 
222 }
223 blob_reset(&origCksum);
224 blob_reset(&fileCksum);
225 }
226 if( currentMtime!=oldMtime || chnged!=oldChnged ){
227 db_multi_exec("UPDATE vfile SET mtime=%lld, chnged=%d WHERE id=%d",
228 currentMtime, chnged, id);
229 }
230 }
231 db_finalize(&q);
232 if( nErr ) fossil_fatal("abort due to prior errors");
233 db_end_transaction(0);
234
--- src/vfile.c
+++ src/vfile.c
@@ -124,40 +124,30 @@
124 manifest_destroy(p);
125 db_end_transaction(0);
126 }
127
128 /*
129 ** Check the file signature of the disk image for every VFILE of vid.
130 **
131 ** Set the VFILE.CHNGED field on every file that has changed. Also
132 ** set VFILE.CHNGED on every folder that contains a file or folder
133 ** that has changed.
134 **
135 ** If VFILE.DELETED is null or if VFILE.RID is zero, then we can assume
136 ** the file has changed without having the check the on-disk image.
137 **
138 ** If the size of the file has changed, then we assume that it has
139 ** changed. If the mtime of the file has not changed and useSha1sum is false
140 ** and the mtime-changes setting is true (the default) then we assume that
141 ** the file has not changed. If the mtime has changed, we go ahead and
142 ** double-check that the file has changed by looking at its SHA1 sum.
 
 
 
 
 
 
 
 
 
 
143 */
144 void vfile_check_signature(int vid, int notFileIsFatal, int useSha1sum){
145 int nErr = 0;
146 Stmt q;
147 Blob fileCksum, origCksum;
148 int checkMtime = useSha1sum==0 && db_get_boolean("mtime-changes", 1);
149
150 db_begin_transaction();
151 db_prepare(&q, "SELECT id, %Q || pathname,"
152 " vfile.mrid, deleted, chnged, uuid, size, mtime"
153 " FROM vfile LEFT JOIN blob ON vfile.mrid=blob.rid"
@@ -167,67 +157,55 @@
157 const char *zName;
158 int chnged = 0;
159 int oldChnged;
160 i64 oldMtime;
161 i64 currentMtime;
 
 
162
163 id = db_column_int(&q, 0);
164 zName = db_column_text(&q, 1);
165 rid = db_column_int(&q, 2);
166 isDeleted = db_column_int(&q, 3);
167 oldChnged = db_column_int(&q, 4);
168 oldMtime = db_column_int64(&q, 7);
169 if( isDeleted ){
 
 
 
 
170 chnged = 1;
171 }else if( !file_wd_isfile_or_link(zName) && file_wd_size(0)>=0 ){
172 if( notFileIsFatal ){
173 fossil_warning("not an ordinary file: %s", zName);
174 nErr++;
175 }
176 chnged = 1;
177 }else if( oldChnged>=2 ){
178 chnged = oldChnged;
179 }else if( rid==0 ){
180 chnged = 1;
181 }
182 if( chnged!=1 ){
183 i64 origSize = db_column_int64(&q, 6);
184 currentMtime = file_wd_mtime(0);
185 if( origSize!=file_wd_size(0) ){
186 /* A file size change is definitive - the file has changed. No
187 ** need to check the sha1sum */
188 chnged = 1;
189 }
190 }
191 if( chnged!=1 && (checkMtime==0 || currentMtime!=oldMtime) ){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
192 db_ephemeral_blob(&q, 5, &origCksum);
193 if( sha1sum_file(zName, &fileCksum) ){
194 blob_zero(&fileCksum);
195 }
196 if( blob_compare(&fileCksum, &origCksum) ){
197 chnged = 1;
198 }else if( currentMtime!=oldMtime ){
199 db_multi_exec("UPDATE vfile SET mtime=%lld WHERE id=%d",
200 currentMtime, id);
201 }
202 blob_reset(&origCksum);
203 blob_reset(&fileCksum);
204 }
205 if( chnged!=oldChnged && (chnged || !checkMtime) ){
206 db_multi_exec("UPDATE vfile SET chnged=%d WHERE id=%d", chnged, id);
 
207 }
208 }
209 db_finalize(&q);
210 if( nErr ) fossil_fatal("abort due to prior errors");
211 db_end_transaction(0);
212

Keyboard Shortcuts

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