107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
|
/*
** Print the "Index:" message that patches wants to see at the top of a diff.
*/
void diff_print_index(const char *zFile, u64 diffFlags, Blob *diffBlob){
if( (diffFlags & (DIFF_SIDEBYSIDE|DIFF_BRIEF|DIFF_NUMSTAT))==0 ){
char *z = mprintf("Index: %s\n%.66c\n", zFile, '=');
if (!diffBlob)
fossil_print("%s", z);
else
blob_appendf(diffBlob, "%s", z);
fossil_free(z);
}
}
/*
** Print the +++/--- filename lines for a diff operation.
*/
|
|
|
>
|
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
/*
** Print the "Index:" message that patches wants to see at the top of a diff.
*/
void diff_print_index(const char *zFile, u64 diffFlags, Blob *diffBlob){
if( (diffFlags & (DIFF_SIDEBYSIDE|DIFF_BRIEF|DIFF_NUMSTAT))==0 ){
char *z = mprintf("Index: %s\n%.66c\n", zFile, '=');
if( !diffBlob ){
fossil_print("%s", z);
}else{
blob_appendf(diffBlob, "%s", z);
}
fossil_free(z);
}
}
/*
** Print the +++/--- filename lines for a diff operation.
*/
|
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
|
z = mprintf("%.*c %.*s %.*c versus %.*c %.*s %.*c\n",
(w-n1+10)/2, '=', n1, zLeft, (w-n1+1)/2, '=',
(w-n2)/2, '=', n2, zRight, (w-n2+1)/2, '=');
}
}else{
z = mprintf("--- %s\n+++ %s\n", zLeft, zRight);
}
if (!diffBlob)
fossil_print("%s", z);
else
blob_appendf(diffBlob, "%s", z);
fossil_free(z);
}
/*
** Show the difference between two files, one in memory and one on disk.
**
** The difference is the set of edits needed to transform pFile1 into
|
|
|
>
|
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
|
z = mprintf("%.*c %.*s %.*c versus %.*c %.*s %.*c\n",
(w-n1+10)/2, '=', n1, zLeft, (w-n1+1)/2, '=',
(w-n2)/2, '=', n2, zRight, (w-n2+1)/2, '=');
}
}else{
z = mprintf("--- %s\n+++ %s\n", zLeft, zRight);
}
if( !diffBlob ){
fossil_print("%s", z);
}else{
blob_appendf(diffBlob, "%s", z);
}
fossil_free(z);
}
/*
** Show the difference between two files, one in memory and one on disk.
**
** The difference is the set of edits needed to transform pFile1 into
|
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
|
if( fSwapDiff ){
text_diff(&file2, pFile1, &out, 0, diffFlags);
}else{
text_diff(pFile1, &file2, &out, 0, diffFlags);
}
if( blob_size(&out) ){
if( diffFlags & DIFF_NUMSTAT ){
if (!diffBlob)
fossil_print("%s %s\n", blob_str(&out), zName);
else
blob_appendf(diffBlob, "%s %s\n", blob_str(&out), zName);
}else{
if (!diffBlob) {
diff_print_filenames(zName, zName2, diffFlags, 0);
fossil_print("%s\n", blob_str(&out));
} else {
diff_print_filenames(zName, zName2, diffFlags, diffBlob);
blob_appendf(diffBlob, "%s\n", blob_str(&out));
}
}
}
blob_reset(&out);
}
|
|
|
>
|
|
|
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
|
if( fSwapDiff ){
text_diff(&file2, pFile1, &out, 0, diffFlags);
}else{
text_diff(pFile1, &file2, &out, 0, diffFlags);
}
if( blob_size(&out) ){
if( diffFlags & DIFF_NUMSTAT ){
if( !diffBlob ){
fossil_print("%s %s\n", blob_str(&out), zName);
}else{
blob_appendf(diffBlob, "%s %s\n", blob_str(&out), zName);
}
}else{
if( !diffBlob ){
diff_print_filenames(zName, zName2, diffFlags, 0);
fossil_print("%s\n", blob_str(&out));
}else{
diff_print_filenames(zName, zName2, diffFlags, diffBlob);
blob_appendf(diffBlob, "%s\n", blob_str(&out));
}
}
}
blob_reset(&out);
}
|