1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
|
const char *zTo; /* Target version number */
const char *zCheckin; /* Check-in version number */
const char *zBranch; /* Branch to diff */
const char *zDiffCmd = 0; /* External diff command. NULL for internal diff */
const char *zBinGlob = 0; /* Treat file names matching this as binary */
int fIncludeBinary = 0; /* Include binary files for external diff */
int againstUndo = 0; /* Diff against files in the undo buffer */
u64 diffFlags = 0; /* Flags to control the DIFF */
FileDirList *pFileDir = 0; /* Restrict the diff to these files */
DiffConfig DCfg; /* Diff configuration object */
if( find_option("tk",0,0)!=0 || has_option("tclsh") ){
diff_tk("diff", 2);
return;
}
isGDiff = g.argv[1][0]=='g';
isInternDiff = find_option("internal","i",0)!=0;
zFrom = find_option("from", "r", 1);
zTo = find_option("to", 0, 1);
zCheckin = find_option("checkin", 0, 1);
zBranch = find_option("branch", 0, 1);
againstUndo = find_option("undo",0,0)!=0;
diffFlags = diff_options(&DCfg);
verboseFlag = find_option("verbose","v",0)!=0;
if( !verboseFlag ){
verboseFlag = find_option("new-file","N",0)!=0; /* deprecated */
}
if( verboseFlag ) diffFlags |= DIFF_VERBOSE;
if( againstUndo && ( zFrom!=0 || zTo!=0 || zCheckin!=0 || zBranch!=0) ){
fossil_fatal("cannot use --undo together with --from, --to, --checkin,"
" or --branch");
}
if( zBranch ){
if( zTo || zFrom || zCheckin ){
fossil_fatal("cannot use --from, --to, or --checkin with --branch");
|
<
|
|
|
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
|
const char *zTo; /* Target version number */
const char *zCheckin; /* Check-in version number */
const char *zBranch; /* Branch to diff */
const char *zDiffCmd = 0; /* External diff command. NULL for internal diff */
const char *zBinGlob = 0; /* Treat file names matching this as binary */
int fIncludeBinary = 0; /* Include binary files for external diff */
int againstUndo = 0; /* Diff against files in the undo buffer */
FileDirList *pFileDir = 0; /* Restrict the diff to these files */
DiffConfig DCfg; /* Diff configuration object */
if( find_option("tk",0,0)!=0 || has_option("tclsh") ){
diff_tk("diff", 2);
return;
}
isGDiff = g.argv[1][0]=='g';
isInternDiff = find_option("internal","i",0)!=0;
zFrom = find_option("from", "r", 1);
zTo = find_option("to", 0, 1);
zCheckin = find_option("checkin", 0, 1);
zBranch = find_option("branch", 0, 1);
againstUndo = find_option("undo",0,0)!=0;
diff_options(&DCfg, isGDiff);
verboseFlag = find_option("verbose","v",0)!=0;
if( !verboseFlag ){
verboseFlag = find_option("new-file","N",0)!=0; /* deprecated */
}
if( verboseFlag ) DCfg.diffFlags |= DIFF_VERBOSE;
if( againstUndo && ( zFrom!=0 || zTo!=0 || zCheckin!=0 || zBranch!=0) ){
fossil_fatal("cannot use --undo together with --from, --to, --checkin,"
" or --branch");
}
if( zBranch ){
if( zTo || zFrom || zCheckin ){
fossil_fatal("cannot use --from, --to, or --checkin with --branch");
|
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
|
db_must_be_within_tree();
}else if( zFrom==0 ){
fossil_fatal("must use --from if --to is present");
}else{
db_find_and_open_repository(0, 0);
}
if( !isInternDiff
&& (diffFlags & DIFF_HTML)==0 /* External diff can't generate HTML */
){
zDiffCmd = find_option("command", 0, 1);
if( zDiffCmd==0 ) zDiffCmd = diff_command_external(isGDiff);
}
zBinGlob = diff_get_binary_glob();
fIncludeBinary = diff_include_binary_files();
determine_exec_relative_option(1);
|
|
|
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
|
db_must_be_within_tree();
}else if( zFrom==0 ){
fossil_fatal("must use --from if --to is present");
}else{
db_find_and_open_repository(0, 0);
}
if( !isInternDiff
&& (DCfg.diffFlags & DIFF_HTML)==0 /* External diff can't generate HTML */
){
zDiffCmd = find_option("command", 0, 1);
if( zDiffCmd==0 ) zDiffCmd = diff_command_external(isGDiff);
}
zBinGlob = diff_get_binary_glob();
fIncludeBinary = diff_include_binary_files();
determine_exec_relative_option(1);
|
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
|
"SELECT uuid FROM blob, plink"
" WHERE plink.cid=%d AND plink.isprim AND plink.pid=blob.rid",
ridTo);
if( zFrom==0 ){
fossil_fatal("check-in %s has no parent", zTo);
}
}
diff_begin(diffFlags);
if( againstUndo ){
if( db_lget_int("undo_available",0)==0 ){
fossil_print("No undo or redo is available\n");
return;
}
diff_against_undo(zDiffCmd, zBinGlob, fIncludeBinary,
diffFlags, pFileDir);
}else if( zTo==0 ){
diff_against_disk(zFrom, zDiffCmd, zBinGlob, fIncludeBinary,
diffFlags, pFileDir, 0);
}else{
diff_two_versions(zFrom, zTo, zDiffCmd, zBinGlob, fIncludeBinary,
diffFlags, pFileDir);
}
if( pFileDir ){
int i;
for(i=0; pFileDir[i].zName; i++){
if( pFileDir[i].nUsed==0
&& strcmp(pFileDir[0].zName,".")!=0
&& !file_isdir(g.argv[i+2], ExtFILE)
){
fossil_fatal("not found: '%s'", g.argv[i+2]);
}
fossil_free(pFileDir[i].zName);
}
fossil_free(pFileDir);
}
diff_end(diffFlags, 0);
if ( diffFlags & DIFF_NUMSTAT ){
fossil_print("%10d %10d TOTAL over %d changed files\n",
g.diffCnt[1], g.diffCnt[2], g.diffCnt[0]);
}
}
/*
** WEBPAGE: vpatch
|
|
|
|
|
|
|
|
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
|
"SELECT uuid FROM blob, plink"
" WHERE plink.cid=%d AND plink.isprim AND plink.pid=blob.rid",
ridTo);
if( zFrom==0 ){
fossil_fatal("check-in %s has no parent", zTo);
}
}
diff_begin(DCfg.diffFlags);
if( againstUndo ){
if( db_lget_int("undo_available",0)==0 ){
fossil_print("No undo or redo is available\n");
return;
}
diff_against_undo(zDiffCmd, zBinGlob, fIncludeBinary,
DCfg.diffFlags, pFileDir);
}else if( zTo==0 ){
diff_against_disk(zFrom, zDiffCmd, zBinGlob, fIncludeBinary,
DCfg.diffFlags, pFileDir, 0);
}else{
diff_two_versions(zFrom, zTo, zDiffCmd, zBinGlob, fIncludeBinary,
DCfg.diffFlags, pFileDir);
}
if( pFileDir ){
int i;
for(i=0; pFileDir[i].zName; i++){
if( pFileDir[i].nUsed==0
&& strcmp(pFileDir[0].zName,".")!=0
&& !file_isdir(g.argv[i+2], ExtFILE)
){
fossil_fatal("not found: '%s'", g.argv[i+2]);
}
fossil_free(pFileDir[i].zName);
}
fossil_free(pFileDir);
}
diff_end(DCfg.diffFlags, 0);
if ( DCfg.diffFlags & DIFF_NUMSTAT ){
fossil_print("%10d %10d TOTAL over %d changed files\n",
g.diffCnt[1], g.diffCnt[2], g.diffCnt[0]);
}
}
/*
** WEBPAGE: vpatch
|