138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
|
const char *zLeft, /* Name of the left file */
const char *zRight, /* Name of the right file */
DiffConfig *pCfg, /* Diff configuration */
Blob *diffBlob /* Write to this blob, or stdout of this is NULL */
){
char *z = 0;
u64 diffFlags = pCfg->diffFlags;
if( diffFlags & (DIFF_BRIEF|DIFF_RAW|DIFF_JSON) ){
/* no-op */
}else if( diffFlags & DIFF_DEBUG ){
fossil_print("FILE-LEFT %s\nFILE-RIGHT %s\n",
zLeft, zRight);
}else if( diffFlags & DIFF_WEBPAGE ){
if( fossil_strcmp(zLeft,zRight)==0 ){
z = mprintf("<h1>%h</h1>\n", zLeft);
}else{
z = mprintf("<h1>%h ⇆ %h</h1>\n", zLeft, zRight);
}
}else if( diffFlags & DIFF_TCL ){
Blob *pOut;
Blob x;
if( diffBlob ){
pOut = diffBlob;
}else{
blob_init(&x, 0, 0);
pOut = &x;
}
blob_append(pOut, "FILE ", 5);
blob_append_tcl_literal(pOut, zLeft, (int)strlen(zLeft));
blob_append_char(pOut, ' ');
blob_append_tcl_literal(pOut, zRight, (int)strlen(zRight));
blob_append_char(pOut, '\n');
if( !diffBlob ){
fossil_print("%s", blob_str(pOut));
blob_reset(&x);
}
return;
}else if( diffFlags & DIFF_SIDEBYSIDE ){
int w = diff_width(pCfg);
|
|
|
>
|
|
|
|
|
>
>
>
>
>
>
>
>
>
>
|
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
|
const char *zLeft, /* Name of the left file */
const char *zRight, /* Name of the right file */
DiffConfig *pCfg, /* Diff configuration */
Blob *diffBlob /* Write to this blob, or stdout of this is NULL */
){
char *z = 0;
u64 diffFlags = pCfg->diffFlags;
if( diffFlags & (DIFF_BRIEF|DIFF_RAW) ){
/* no-op */
}else if( diffFlags & DIFF_DEBUG ){
fossil_print("FILE-LEFT %s\nFILE-RIGHT %s\n",
zLeft, zRight);
}else if( diffFlags & DIFF_WEBPAGE ){
if( fossil_strcmp(zLeft,zRight)==0 ){
z = mprintf("<h1>%h</h1>\n", zLeft);
}else{
z = mprintf("<h1>%h ⇆ %h</h1>\n", zLeft, zRight);
}
}else if( diffFlags & (DIFF_TCL|DIFF_JSON) ){
Blob *pOut;
Blob x;
if( diffBlob ){
pOut = diffBlob;
}else{
blob_init(&x, 0, 0);
pOut = &x;
}
if( diffFlags & DIFF_TCL ){
blob_append(pOut, "FILE ", 5);
blob_append_tcl_literal(pOut, zLeft, (int)strlen(zLeft));
blob_append_char(pOut, ' ');
blob_append_tcl_literal(pOut, zRight, (int)strlen(zRight));
blob_append_char(pOut, '\n');
}else{
blob_trim(pOut);
blob_append(pOut, (pCfg->nFile==0 ? "[{" : ",\n{"), -1);
pCfg->nFile++;
blob_append(pOut, "\n \"leftname\":", -1);
blob_append_json_literal(pOut, zLeft, (int)strlen(zLeft));
blob_append(pOut, ",\n \"rightname\":", -1);
blob_append_json_literal(pOut, zRight, (int)strlen(zRight));
blob_append(pOut, ",\n \"diff\":\n", -1);
}
if( !diffBlob ){
fossil_print("%s", blob_str(pOut));
blob_reset(&x);
}
return;
}else if( diffFlags & DIFF_SIDEBYSIDE ){
int w = diff_width(pCfg);
|
375
376
377
378
379
380
381
382
383
384
385
386
387
388
|
fossil_system(zCmd);
fossil_free(zCmd);
diffOut = 0;
sqlite3_sleep(FOSSIL_BROWSER_DIFF_DELAY);
file_delete(tempDiffFilename);
sqlite3_free(tempDiffFilename);
tempDiffFilename = 0;
}
}
/*
** 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
|
>
>
>
|
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
|
fossil_system(zCmd);
fossil_free(zCmd);
diffOut = 0;
sqlite3_sleep(FOSSIL_BROWSER_DIFF_DELAY);
file_delete(tempDiffFilename);
sqlite3_free(tempDiffFilename);
tempDiffFilename = 0;
}
if( (pCfg->diffFlags & DIFF_JSON)!=0 && pCfg->nFile>0 ){
fossil_print("]\n");
}
}
/*
** 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
|