Fossil SCM

Add -n|--dry-run options to commands which already have --test or --nochange.

jan.nijtmans 2013-04-21 21:59 trunk
Commit 0b866397a8e994c73ee0cc4b4439f692da5c2fdb
+9 -6
--- src/add.c
+++ src/add.c
@@ -453,29 +453,32 @@
453453
**
454454
** This command can be used to track third party software.
455455
**
456456
** Options:
457457
** --case-sensitive <BOOL> override case-sensitive setting
458
-** --dotfiles include files beginning with a dot (".")
459
-** --ignore <CSG> ignore files matching patterns from the
458
+** --dotfiles include files beginning with a dot (".")
459
+** --ignore <CSG> ignore files matching patterns from the
460460
** comma separated list of glob patterns.
461
-** --test If given, display instead of run actions
461
+** -n|--dry-run If given, display instead of run actions
462462
**
463463
** See also: add, rm
464464
*/
465465
void addremove_cmd(void){
466466
Blob path;
467467
const char *zIgnoreFlag = find_option("ignore",0,1);
468468
unsigned scanFlags = find_option("dotfiles",0,0)!=0 ? SCAN_ALL : 0;
469
- int isTest = find_option("test",0,0)!=0;
469
+ int dryRunFlag = find_option("dry-run","n",0)!=0;
470470
int n;
471471
Stmt q;
472472
int vid;
473473
int nAdd = 0;
474474
int nDelete = 0;
475475
Glob *pIgnore;
476476
477
+ if( !dryRunFlag ){
478
+ dryRunFlag = find_option("test",0,0)!=0; /* deprecated */
479
+ }
477480
capture_case_sensitive_option();
478481
db_must_be_within_tree();
479482
if( zIgnoreFlag==0 ){
480483
zIgnoreFlag = db_get("ignore-glob", 0);
481484
}
@@ -512,11 +515,11 @@
512515
const char * zPath;
513516
514517
zFile = db_column_text(&q, 0);
515518
zPath = db_column_text(&q, 1);
516519
if( !file_wd_isfile_or_link(zPath) ){
517
- if( !isTest ){
520
+ if( !dryRunFlag ){
518521
db_multi_exec("UPDATE vfile SET deleted=1 WHERE pathname=%Q", zFile);
519522
}
520523
fossil_print("DELETED %s\n", zFile);
521524
nDelete++;
522525
}
@@ -523,11 +526,11 @@
523526
}
524527
db_finalize(&q);
525528
/* show command summary */
526529
fossil_print("added %d files, deleted %d files\n", nAdd, nDelete);
527530
528
- db_end_transaction(isTest);
531
+ db_end_transaction(dryRunFlag);
529532
}
530533
531534
532535
/*
533536
** Rename a single file.
534537
--- src/add.c
+++ src/add.c
@@ -453,29 +453,32 @@
453 **
454 ** This command can be used to track third party software.
455 **
456 ** Options:
457 ** --case-sensitive <BOOL> override case-sensitive setting
458 ** --dotfiles include files beginning with a dot (".")
459 ** --ignore <CSG> ignore files matching patterns from the
460 ** comma separated list of glob patterns.
461 ** --test If given, display instead of run actions
462 **
463 ** See also: add, rm
464 */
465 void addremove_cmd(void){
466 Blob path;
467 const char *zIgnoreFlag = find_option("ignore",0,1);
468 unsigned scanFlags = find_option("dotfiles",0,0)!=0 ? SCAN_ALL : 0;
469 int isTest = find_option("test",0,0)!=0;
470 int n;
471 Stmt q;
472 int vid;
473 int nAdd = 0;
474 int nDelete = 0;
475 Glob *pIgnore;
476
 
 
 
477 capture_case_sensitive_option();
478 db_must_be_within_tree();
479 if( zIgnoreFlag==0 ){
480 zIgnoreFlag = db_get("ignore-glob", 0);
481 }
@@ -512,11 +515,11 @@
512 const char * zPath;
513
514 zFile = db_column_text(&q, 0);
515 zPath = db_column_text(&q, 1);
516 if( !file_wd_isfile_or_link(zPath) ){
517 if( !isTest ){
518 db_multi_exec("UPDATE vfile SET deleted=1 WHERE pathname=%Q", zFile);
519 }
520 fossil_print("DELETED %s\n", zFile);
521 nDelete++;
522 }
@@ -523,11 +526,11 @@
523 }
524 db_finalize(&q);
525 /* show command summary */
526 fossil_print("added %d files, deleted %d files\n", nAdd, nDelete);
527
528 db_end_transaction(isTest);
529 }
530
531
532 /*
533 ** Rename a single file.
534
--- src/add.c
+++ src/add.c
@@ -453,29 +453,32 @@
453 **
454 ** This command can be used to track third party software.
455 **
456 ** Options:
457 ** --case-sensitive <BOOL> override case-sensitive setting
458 ** --dotfiles include files beginning with a dot (".")
459 ** --ignore <CSG> ignore files matching patterns from the
460 ** comma separated list of glob patterns.
461 ** -n|--dry-run If given, display instead of run actions
462 **
463 ** See also: add, rm
464 */
465 void addremove_cmd(void){
466 Blob path;
467 const char *zIgnoreFlag = find_option("ignore",0,1);
468 unsigned scanFlags = find_option("dotfiles",0,0)!=0 ? SCAN_ALL : 0;
469 int dryRunFlag = find_option("dry-run","n",0)!=0;
470 int n;
471 Stmt q;
472 int vid;
473 int nAdd = 0;
474 int nDelete = 0;
475 Glob *pIgnore;
476
477 if( !dryRunFlag ){
478 dryRunFlag = find_option("test",0,0)!=0; /* deprecated */
479 }
480 capture_case_sensitive_option();
481 db_must_be_within_tree();
482 if( zIgnoreFlag==0 ){
483 zIgnoreFlag = db_get("ignore-glob", 0);
484 }
@@ -512,11 +515,11 @@
515 const char * zPath;
516
517 zFile = db_column_text(&q, 0);
518 zPath = db_column_text(&q, 1);
519 if( !file_wd_isfile_or_link(zPath) ){
520 if( !dryRunFlag ){
521 db_multi_exec("UPDATE vfile SET deleted=1 WHERE pathname=%Q", zFile);
522 }
523 fossil_print("DELETED %s\n", zFile);
524 nDelete++;
525 }
@@ -523,11 +526,11 @@
526 }
527 db_finalize(&q);
528 /* show command summary */
529 fossil_print("added %d files, deleted %d files\n", nAdd, nDelete);
530
531 db_end_transaction(dryRunFlag);
532 }
533
534
535 /*
536 ** Rename a single file.
537
+9 -10
--- src/allrepo.c
+++ src/allrepo.c
@@ -109,20 +109,19 @@
109109
char *zFossil;
110110
char *zQFilename;
111111
Blob extra;
112112
int useCheckouts = 0;
113113
int quiet = 0;
114
- int testRun = 0;
114
+ int dryRunFlag = 0;
115115
int stopOnError = find_option("dontstop",0,0)==0;
116116
int rc;
117117
Bag outOfDate;
118118
119
- /* The undocumented --test option causes no changes to occur to any
120
- ** repository, but instead show what would have happened. Intended for
121
- ** test and debugging use.
122
- */
123
- testRun = find_option("test",0,0)!=0;
119
+ dryRunFlag = find_option("dry-run","n",0)!=0;
120
+ if( !dryRunFlag ){
121
+ dryRunFlag = find_option("test",0,0)!=0; /* deprecated */
122
+ }
124123
125124
if( g.argc<3 ){
126125
usage("changes|list|ls|pull|push|rebuild|sync");
127126
}
128127
n = strlen(g.argv[2]);
@@ -169,11 +168,11 @@
169168
verify_all_options();
170169
db_begin_transaction();
171170
for(j=3; j<g.argc; j++){
172171
char *zSql = mprintf("DELETE FROM global_config"
173172
" WHERE name GLOB 'repo:%q'", g.argv[j]);
174
- if( testRun ){
173
+ if( dryRunFlag ){
175174
fossil_print("%s\n", zSql);
176175
}else{
177176
db_multi_exec("%s", zSql);
178177
}
179178
fossil_free(zSql);
@@ -218,15 +217,15 @@
218217
continue;
219218
}
220219
zQFilename = quoteFilename(zFilename);
221220
zSyscmd = mprintf("%s %s %s%s",
222221
zFossil, zCmd, zQFilename, blob_str(&extra));
223
- if( !quiet || testRun ){
222
+ if( !quiet || dryRunFlag ){
224223
fossil_print("%s\n", zSyscmd);
225224
fflush(stdout);
226225
}
227
- rc = testRun ? 0 : fossil_system(zSyscmd);
226
+ rc = dryRunFlag ? 0 : fossil_system(zSyscmd);
228227
free(zSyscmd);
229228
free(zQFilename);
230229
if( stopOnError && rc ){
231230
break;
232231
}
@@ -245,13 +244,13 @@
245244
for(rowid=bag_first(&outOfDate); rowid>0; rowid=bag_next(&outOfDate,rowid)){
246245
blob_appendf(&sql, "%s%d", zSep, rowid);
247246
zSep = ",";
248247
}
249248
blob_appendf(&sql, ")");
250
- if( testRun ){
249
+ if( dryRunFlag ){
251250
fossil_print("%s\n", blob_str(&sql));
252251
}else{
253252
db_multi_exec(blob_str(&sql));
254253
}
255254
blob_reset(&sql);
256255
}
257256
}
258257
--- src/allrepo.c
+++ src/allrepo.c
@@ -109,20 +109,19 @@
109 char *zFossil;
110 char *zQFilename;
111 Blob extra;
112 int useCheckouts = 0;
113 int quiet = 0;
114 int testRun = 0;
115 int stopOnError = find_option("dontstop",0,0)==0;
116 int rc;
117 Bag outOfDate;
118
119 /* The undocumented --test option causes no changes to occur to any
120 ** repository, but instead show what would have happened. Intended for
121 ** test and debugging use.
122 */
123 testRun = find_option("test",0,0)!=0;
124
125 if( g.argc<3 ){
126 usage("changes|list|ls|pull|push|rebuild|sync");
127 }
128 n = strlen(g.argv[2]);
@@ -169,11 +168,11 @@
169 verify_all_options();
170 db_begin_transaction();
171 for(j=3; j<g.argc; j++){
172 char *zSql = mprintf("DELETE FROM global_config"
173 " WHERE name GLOB 'repo:%q'", g.argv[j]);
174 if( testRun ){
175 fossil_print("%s\n", zSql);
176 }else{
177 db_multi_exec("%s", zSql);
178 }
179 fossil_free(zSql);
@@ -218,15 +217,15 @@
218 continue;
219 }
220 zQFilename = quoteFilename(zFilename);
221 zSyscmd = mprintf("%s %s %s%s",
222 zFossil, zCmd, zQFilename, blob_str(&extra));
223 if( !quiet || testRun ){
224 fossil_print("%s\n", zSyscmd);
225 fflush(stdout);
226 }
227 rc = testRun ? 0 : fossil_system(zSyscmd);
228 free(zSyscmd);
229 free(zQFilename);
230 if( stopOnError && rc ){
231 break;
232 }
@@ -245,13 +244,13 @@
245 for(rowid=bag_first(&outOfDate); rowid>0; rowid=bag_next(&outOfDate,rowid)){
246 blob_appendf(&sql, "%s%d", zSep, rowid);
247 zSep = ",";
248 }
249 blob_appendf(&sql, ")");
250 if( testRun ){
251 fossil_print("%s\n", blob_str(&sql));
252 }else{
253 db_multi_exec(blob_str(&sql));
254 }
255 blob_reset(&sql);
256 }
257 }
258
--- src/allrepo.c
+++ src/allrepo.c
@@ -109,20 +109,19 @@
109 char *zFossil;
110 char *zQFilename;
111 Blob extra;
112 int useCheckouts = 0;
113 int quiet = 0;
114 int dryRunFlag = 0;
115 int stopOnError = find_option("dontstop",0,0)==0;
116 int rc;
117 Bag outOfDate;
118
119 dryRunFlag = find_option("dry-run","n",0)!=0;
120 if( !dryRunFlag ){
121 dryRunFlag = find_option("test",0,0)!=0; /* deprecated */
122 }
 
123
124 if( g.argc<3 ){
125 usage("changes|list|ls|pull|push|rebuild|sync");
126 }
127 n = strlen(g.argv[2]);
@@ -169,11 +168,11 @@
168 verify_all_options();
169 db_begin_transaction();
170 for(j=3; j<g.argc; j++){
171 char *zSql = mprintf("DELETE FROM global_config"
172 " WHERE name GLOB 'repo:%q'", g.argv[j]);
173 if( dryRunFlag ){
174 fossil_print("%s\n", zSql);
175 }else{
176 db_multi_exec("%s", zSql);
177 }
178 fossil_free(zSql);
@@ -218,15 +217,15 @@
217 continue;
218 }
219 zQFilename = quoteFilename(zFilename);
220 zSyscmd = mprintf("%s %s %s%s",
221 zFossil, zCmd, zQFilename, blob_str(&extra));
222 if( !quiet || dryRunFlag ){
223 fossil_print("%s\n", zSyscmd);
224 fflush(stdout);
225 }
226 rc = dryRunFlag ? 0 : fossil_system(zSyscmd);
227 free(zSyscmd);
228 free(zQFilename);
229 if( stopOnError && rc ){
230 break;
231 }
@@ -245,13 +244,13 @@
244 for(rowid=bag_first(&outOfDate); rowid>0; rowid=bag_next(&outOfDate,rowid)){
245 blob_appendf(&sql, "%s%d", zSep, rowid);
246 zSep = ",";
247 }
248 blob_appendf(&sql, ")");
249 if( dryRunFlag ){
250 fossil_print("%s\n", blob_str(&sql));
251 }else{
252 db_multi_exec(blob_str(&sql));
253 }
254 blob_reset(&sql);
255 }
256 }
257
+16 -8
--- src/checkin.c
+++ src/checkin.c
@@ -395,13 +395,14 @@
395395
** is used if the --ignore option is omitted.
396396
**
397397
** Options:
398398
** --case-sensitive <BOOL> override case-sensitive setting
399399
** --dotfiles include files beginning with a dot (".")
400
-** --force Remove files without prompting
400
+** -f|--force Remove files without prompting
401401
** --ignore <CSG> ignore files matching patterns from the
402402
** comma separated list of glob patterns.
403
+** -n|--dry-run If given, display instead of run actions
403404
** --temp Remove only Fossil-generated temporary files
404405
**
405406
** See also: addremove, extra, status
406407
*/
407408
void clean_cmd(void){
@@ -410,17 +411,20 @@
410411
const char *zIgnoreFlag;
411412
Blob path, repo;
412413
Stmt q;
413414
int n;
414415
Glob *pIgnore;
415
- int testFlag = 0;
416
+ int dryRunFlag = 0;
416417
417418
allFlag = find_option("force","f",0)!=0;
418419
if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL;
419420
if( find_option("temp",0,0)!=0 ) scanFlags |= SCAN_TEMP;
420421
zIgnoreFlag = find_option("ignore",0,1);
421
- testFlag = find_option("test",0,0)!=0;
422
+ dryRunFlag = find_option("dry-run","n",0)!=0;
423
+ if( !dryRunFlag ){
424
+ dryRunFlag = find_option("test",0,0)!=0; /* deprecated */
425
+ }
422426
capture_case_sensitive_option();
423427
db_must_be_within_tree();
424428
if( zIgnoreFlag==0 ){
425429
zIgnoreFlag = db_get("ignore-glob", 0);
426430
}
@@ -440,11 +444,11 @@
440444
if( file_tree_name(g.zRepositoryName, &repo, 0) ){
441445
db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo);
442446
}
443447
db_multi_exec("DELETE FROM sfile WHERE x IN (SELECT pathname FROM vfile)");
444448
while( db_step(&q)==SQLITE_ROW ){
445
- if( testFlag ){
449
+ if( dryRunFlag ){
446450
fossil_print("%s\n", db_column_text(&q,0));
447451
continue;
448452
}else if( !allFlag ){
449453
Blob ans;
450454
char cReply;
@@ -1125,10 +1129,11 @@
11251129
** --branchcolor COLOR apply given COLOR to the branch
11261130
** --comment|-m COMMENT-TEXT use COMMENT-TEXT as commit comment
11271131
** --delta use a delta manifest in the commit process
11281132
** --message-file|-M FILE read the commit comment from given file
11291133
** --mimetype MIMETYPE mimetype of check-in comment
1134
+** -n|--dry-run If given, display instead of run actions
11301135
** --no-warnings omit all warnings about file contents
11311136
** --nosign do not attempt to sign this commit with gpg
11321137
** --private do not sync changes and their descendants
11331138
** --tag TAG-NAME assign given tag TAG-NAME to the checkin
11341139
**
@@ -1154,11 +1159,11 @@
11541159
int allowFork = 0; /* Allow the commit to fork */
11551160
int allowOlder = 0; /* Allow a commit older than its ancestor */
11561161
char *zManifestFile; /* Name of the manifest file */
11571162
int useCksum; /* True if checksums should be computed and verified */
11581163
int outputManifest; /* True to output "manifest" and "manifest.uuid" */
1159
- int testRun; /* True for a test run. Debugging only */
1164
+ int dryRunFlag; /* True for a test run. Debugging only */
11601165
CheckinInfo sCiInfo; /* Information about this check-in */
11611166
const char *zComFile; /* Read commit message from this file */
11621167
int nTag = 0; /* Number of --tag arguments */
11631168
const char *zTag; /* A single --tag argument */
11641169
Blob manifest; /* Manifest in baseline form */
@@ -1178,11 +1183,14 @@
11781183
forceDelta = find_option("delta",0,0)!=0;
11791184
forceBaseline = find_option("baseline",0,0)!=0;
11801185
if( forceDelta && forceBaseline ){
11811186
fossil_fatal("cannot use --delta and --baseline together");
11821187
}
1183
- testRun = find_option("test",0,0)!=0;
1188
+ dryRunFlag = find_option("dry-run","n",0)!=0;
1189
+ if( !dryRunFlag ){
1190
+ dryRunFlag = find_option("test",0,0)!=0; /* deprecated */
1191
+ }
11841192
zComment = find_option("comment","m",1);
11851193
forceFlag = find_option("force", "f", 0)!=0;
11861194
allowConflict = find_option("allow-conflict",0,0)!=0;
11871195
allowEmpty = find_option("allow-empty",0,0)!=0;
11881196
allowFork = find_option("allow-fork",0,0)!=0;
@@ -1522,11 +1530,11 @@
15221530
}
15231531
15241532
/* If the --test option is specified, output the manifest file
15251533
** and rollback the transaction.
15261534
*/
1527
- if( testRun ){
1535
+ if( dryRunFlag ){
15281536
blob_write_to_file(&manifest, "");
15291537
}
15301538
15311539
if( outputManifest ){
15321540
zManifestFile = mprintf("%smanifest", g.zLocalRoot);
@@ -1601,11 +1609,11 @@
16011609
/* Clear the undo/redo stack */
16021610
undo_reset();
16031611
16041612
/* Commit */
16051613
db_multi_exec("DELETE FROM vvar WHERE name='ci-comment'");
1606
- if( testRun ){
1614
+ if( dryRunFlag ){
16071615
db_end_transaction(1);
16081616
exit(1);
16091617
}
16101618
db_end_transaction(0);
16111619
16121620
--- src/checkin.c
+++ src/checkin.c
@@ -395,13 +395,14 @@
395 ** is used if the --ignore option is omitted.
396 **
397 ** Options:
398 ** --case-sensitive <BOOL> override case-sensitive setting
399 ** --dotfiles include files beginning with a dot (".")
400 ** --force Remove files without prompting
401 ** --ignore <CSG> ignore files matching patterns from the
402 ** comma separated list of glob patterns.
 
403 ** --temp Remove only Fossil-generated temporary files
404 **
405 ** See also: addremove, extra, status
406 */
407 void clean_cmd(void){
@@ -410,17 +411,20 @@
410 const char *zIgnoreFlag;
411 Blob path, repo;
412 Stmt q;
413 int n;
414 Glob *pIgnore;
415 int testFlag = 0;
416
417 allFlag = find_option("force","f",0)!=0;
418 if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL;
419 if( find_option("temp",0,0)!=0 ) scanFlags |= SCAN_TEMP;
420 zIgnoreFlag = find_option("ignore",0,1);
421 testFlag = find_option("test",0,0)!=0;
 
 
 
422 capture_case_sensitive_option();
423 db_must_be_within_tree();
424 if( zIgnoreFlag==0 ){
425 zIgnoreFlag = db_get("ignore-glob", 0);
426 }
@@ -440,11 +444,11 @@
440 if( file_tree_name(g.zRepositoryName, &repo, 0) ){
441 db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo);
442 }
443 db_multi_exec("DELETE FROM sfile WHERE x IN (SELECT pathname FROM vfile)");
444 while( db_step(&q)==SQLITE_ROW ){
445 if( testFlag ){
446 fossil_print("%s\n", db_column_text(&q,0));
447 continue;
448 }else if( !allFlag ){
449 Blob ans;
450 char cReply;
@@ -1125,10 +1129,11 @@
1125 ** --branchcolor COLOR apply given COLOR to the branch
1126 ** --comment|-m COMMENT-TEXT use COMMENT-TEXT as commit comment
1127 ** --delta use a delta manifest in the commit process
1128 ** --message-file|-M FILE read the commit comment from given file
1129 ** --mimetype MIMETYPE mimetype of check-in comment
 
1130 ** --no-warnings omit all warnings about file contents
1131 ** --nosign do not attempt to sign this commit with gpg
1132 ** --private do not sync changes and their descendants
1133 ** --tag TAG-NAME assign given tag TAG-NAME to the checkin
1134 **
@@ -1154,11 +1159,11 @@
1154 int allowFork = 0; /* Allow the commit to fork */
1155 int allowOlder = 0; /* Allow a commit older than its ancestor */
1156 char *zManifestFile; /* Name of the manifest file */
1157 int useCksum; /* True if checksums should be computed and verified */
1158 int outputManifest; /* True to output "manifest" and "manifest.uuid" */
1159 int testRun; /* True for a test run. Debugging only */
1160 CheckinInfo sCiInfo; /* Information about this check-in */
1161 const char *zComFile; /* Read commit message from this file */
1162 int nTag = 0; /* Number of --tag arguments */
1163 const char *zTag; /* A single --tag argument */
1164 Blob manifest; /* Manifest in baseline form */
@@ -1178,11 +1183,14 @@
1178 forceDelta = find_option("delta",0,0)!=0;
1179 forceBaseline = find_option("baseline",0,0)!=0;
1180 if( forceDelta && forceBaseline ){
1181 fossil_fatal("cannot use --delta and --baseline together");
1182 }
1183 testRun = find_option("test",0,0)!=0;
 
 
 
1184 zComment = find_option("comment","m",1);
1185 forceFlag = find_option("force", "f", 0)!=0;
1186 allowConflict = find_option("allow-conflict",0,0)!=0;
1187 allowEmpty = find_option("allow-empty",0,0)!=0;
1188 allowFork = find_option("allow-fork",0,0)!=0;
@@ -1522,11 +1530,11 @@
1522 }
1523
1524 /* If the --test option is specified, output the manifest file
1525 ** and rollback the transaction.
1526 */
1527 if( testRun ){
1528 blob_write_to_file(&manifest, "");
1529 }
1530
1531 if( outputManifest ){
1532 zManifestFile = mprintf("%smanifest", g.zLocalRoot);
@@ -1601,11 +1609,11 @@
1601 /* Clear the undo/redo stack */
1602 undo_reset();
1603
1604 /* Commit */
1605 db_multi_exec("DELETE FROM vvar WHERE name='ci-comment'");
1606 if( testRun ){
1607 db_end_transaction(1);
1608 exit(1);
1609 }
1610 db_end_transaction(0);
1611
1612
--- src/checkin.c
+++ src/checkin.c
@@ -395,13 +395,14 @@
395 ** is used if the --ignore option is omitted.
396 **
397 ** Options:
398 ** --case-sensitive <BOOL> override case-sensitive setting
399 ** --dotfiles include files beginning with a dot (".")
400 ** -f|--force Remove files without prompting
401 ** --ignore <CSG> ignore files matching patterns from the
402 ** comma separated list of glob patterns.
403 ** -n|--dry-run If given, display instead of run actions
404 ** --temp Remove only Fossil-generated temporary files
405 **
406 ** See also: addremove, extra, status
407 */
408 void clean_cmd(void){
@@ -410,17 +411,20 @@
411 const char *zIgnoreFlag;
412 Blob path, repo;
413 Stmt q;
414 int n;
415 Glob *pIgnore;
416 int dryRunFlag = 0;
417
418 allFlag = find_option("force","f",0)!=0;
419 if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL;
420 if( find_option("temp",0,0)!=0 ) scanFlags |= SCAN_TEMP;
421 zIgnoreFlag = find_option("ignore",0,1);
422 dryRunFlag = find_option("dry-run","n",0)!=0;
423 if( !dryRunFlag ){
424 dryRunFlag = find_option("test",0,0)!=0; /* deprecated */
425 }
426 capture_case_sensitive_option();
427 db_must_be_within_tree();
428 if( zIgnoreFlag==0 ){
429 zIgnoreFlag = db_get("ignore-glob", 0);
430 }
@@ -440,11 +444,11 @@
444 if( file_tree_name(g.zRepositoryName, &repo, 0) ){
445 db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo);
446 }
447 db_multi_exec("DELETE FROM sfile WHERE x IN (SELECT pathname FROM vfile)");
448 while( db_step(&q)==SQLITE_ROW ){
449 if( dryRunFlag ){
450 fossil_print("%s\n", db_column_text(&q,0));
451 continue;
452 }else if( !allFlag ){
453 Blob ans;
454 char cReply;
@@ -1125,10 +1129,11 @@
1129 ** --branchcolor COLOR apply given COLOR to the branch
1130 ** --comment|-m COMMENT-TEXT use COMMENT-TEXT as commit comment
1131 ** --delta use a delta manifest in the commit process
1132 ** --message-file|-M FILE read the commit comment from given file
1133 ** --mimetype MIMETYPE mimetype of check-in comment
1134 ** -n|--dry-run If given, display instead of run actions
1135 ** --no-warnings omit all warnings about file contents
1136 ** --nosign do not attempt to sign this commit with gpg
1137 ** --private do not sync changes and their descendants
1138 ** --tag TAG-NAME assign given tag TAG-NAME to the checkin
1139 **
@@ -1154,11 +1159,11 @@
1159 int allowFork = 0; /* Allow the commit to fork */
1160 int allowOlder = 0; /* Allow a commit older than its ancestor */
1161 char *zManifestFile; /* Name of the manifest file */
1162 int useCksum; /* True if checksums should be computed and verified */
1163 int outputManifest; /* True to output "manifest" and "manifest.uuid" */
1164 int dryRunFlag; /* True for a test run. Debugging only */
1165 CheckinInfo sCiInfo; /* Information about this check-in */
1166 const char *zComFile; /* Read commit message from this file */
1167 int nTag = 0; /* Number of --tag arguments */
1168 const char *zTag; /* A single --tag argument */
1169 Blob manifest; /* Manifest in baseline form */
@@ -1178,11 +1183,14 @@
1183 forceDelta = find_option("delta",0,0)!=0;
1184 forceBaseline = find_option("baseline",0,0)!=0;
1185 if( forceDelta && forceBaseline ){
1186 fossil_fatal("cannot use --delta and --baseline together");
1187 }
1188 dryRunFlag = find_option("dry-run","n",0)!=0;
1189 if( !dryRunFlag ){
1190 dryRunFlag = find_option("test",0,0)!=0; /* deprecated */
1191 }
1192 zComment = find_option("comment","m",1);
1193 forceFlag = find_option("force", "f", 0)!=0;
1194 allowConflict = find_option("allow-conflict",0,0)!=0;
1195 allowEmpty = find_option("allow-empty",0,0)!=0;
1196 allowFork = find_option("allow-fork",0,0)!=0;
@@ -1522,11 +1530,11 @@
1530 }
1531
1532 /* If the --test option is specified, output the manifest file
1533 ** and rollback the transaction.
1534 */
1535 if( dryRunFlag ){
1536 blob_write_to_file(&manifest, "");
1537 }
1538
1539 if( outputManifest ){
1540 zManifestFile = mprintf("%smanifest", g.zLocalRoot);
@@ -1601,11 +1609,11 @@
1609 /* Clear the undo/redo stack */
1610 undo_reset();
1611
1612 /* Commit */
1613 db_multi_exec("DELETE FROM vvar WHERE name='ci-comment'");
1614 if( dryRunFlag ){
1615 db_end_transaction(1);
1616 exit(1);
1617 }
1618 db_end_transaction(0);
1619
1620
+16 -14
--- src/merge.c
+++ src/merge.c
@@ -91,23 +91,22 @@
9191
** files whose names differ only in case are taken
9292
** to be the same file.
9393
**
9494
** --detail Show additional details of the merge
9595
**
96
-** --force | -f Force the merge even if it would be a no-op.
96
+** -f|--force Force the merge even if it would be a no-op.
9797
**
98
-** --nochange | -n Dryrun: do not actually make any changes; just
99
-** show what would have happened.
98
+** -n|--dry-run If given, display instead of run actions
10099
*/
101100
void merge_cmd(void){
102101
int vid; /* Current version "V" */
103102
int mid; /* Version we are merging from "M" */
104103
int pid; /* The pivot version - most recent common ancestor P */
105104
int detailFlag; /* True if the --detail option is present */
106105
int pickFlag; /* True if the --cherrypick option is present */
107106
int backoutFlag; /* True if the --backout option is present */
108
- int nochangeFlag; /* True if the --nochange or -n option is present */
107
+ int dryRunFlag; /* True if the --dry-run or -n option is present */
109108
int forceFlag; /* True if the --force or -f option is present */
110109
const char *zBinGlob; /* The value of --binary */
111110
const char *zPivot; /* The value of --baseline */
112111
int debugFlag; /* True if --debug is present */
113112
int nChng; /* Number of file name changes */
@@ -129,11 +128,14 @@
129128
detailFlag = find_option("detail",0,0)!=0;
130129
pickFlag = find_option("cherrypick",0,0)!=0;
131130
backoutFlag = find_option("backout",0,0)!=0;
132131
debugFlag = find_option("debug",0,0)!=0;
133132
zBinGlob = find_option("binary",0,1);
134
- nochangeFlag = find_option("nochange","n",0)!=0;
133
+ dryRunFlag = find_option("dry-run","n",0)!=0;
134
+ if( !dryRunFlag ){
135
+ dryRunFlag = find_option("nochange",0,0)!=0; /* deprecated */
136
+ }
135137
forceFlag = find_option("force","f",0)!=0;
136138
zPivot = find_option("baseline",0,1);
137139
capture_case_sensitive_option();
138140
verify_all_options();
139141
db_must_be_within_tree();
@@ -252,11 +254,11 @@
252254
print_checkin_description(mid, 12, "merge-from:");
253255
print_checkin_description(pid, 12, "baseline:");
254256
}
255257
vfile_check_signature(vid, CKSIG_ENOTFILE);
256258
db_begin_transaction();
257
- if( !nochangeFlag ) undo_begin();
259
+ if( !dryRunFlag ) undo_begin();
258260
load_vfile_from_rid(mid);
259261
load_vfile_from_rid(pid);
260262
if( debugFlag ){
261263
char *z;
262264
z = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", pid);
@@ -443,11 +445,11 @@
443445
nOverwrite++;
444446
}else{
445447
fossil_print("ADDED %s\n", zName);
446448
}
447449
fossil_free(zFullName);
448
- if( !nochangeFlag ){
450
+ if( !dryRunFlag ){
449451
undo_save(zName);
450452
vfile_to_disk(0, idm, 0, 0);
451453
}
452454
}
453455
db_finalize(&q);
@@ -466,11 +468,11 @@
466468
int ridm = db_column_int(&q, 1);
467469
const char *zName = db_column_text(&q, 2);
468470
int islinkm = db_column_int(&q, 3);
469471
/* Copy content from idm over into idv. Overwrite idv. */
470472
fossil_print("UPDATE %s\n", zName);
471
- if( !nochangeFlag ){
473
+ if( !dryRunFlag ){
472474
undo_save(zName);
473475
db_multi_exec(
474476
"UPDATE vfile SET mtime=0, mrid=%d, chnged=2, islink=%d "
475477
" WHERE id=%d", ridm, islinkm, idv
476478
);
@@ -518,15 +520,15 @@
518520
content_get(ridm, &m);
519521
if( isBinary ){
520522
rc = -1;
521523
blob_zero(&r);
522524
}else{
523
- unsigned mergeFlags = nochangeFlag ? MERGE_DRYRUN : 0;
525
+ unsigned mergeFlags = dryRunFlag ? MERGE_DRYRUN : 0;
524526
rc = merge_3way(&p, zFullPath, &m, &r, mergeFlags);
525527
}
526528
if( rc>=0 ){
527
- if( !nochangeFlag ){
529
+ if( !dryRunFlag ){
528530
blob_write_to_file(&r, zFullPath);
529531
file_wd_setexe(zFullPath, isExe);
530532
}
531533
db_multi_exec("UPDATE vfile SET mtime=0 WHERE id=%d", idv);
532534
if( rc>0 ){
@@ -565,11 +567,11 @@
565567
}
566568
undo_save(zName);
567569
db_multi_exec(
568570
"UPDATE vfile SET deleted=1 WHERE id=%d", idv
569571
);
570
- if( !nochangeFlag ){
572
+ if( !dryRunFlag ){
571573
char *zFullPath = mprintf("%s%s", g.zLocalRoot, zName);
572574
file_delete(zFullPath);
573575
free(zFullPath);
574576
}
575577
}
@@ -593,11 +595,11 @@
593595
undo_save(zNewName);
594596
db_multi_exec(
595597
"UPDATE vfile SET pathname=%Q, origname=coalesce(origname,pathname)"
596598
" WHERE id=%d AND vid=%d", zNewName, idv, vid
597599
);
598
- if( !nochangeFlag ){
600
+ if( !dryRunFlag ){
599601
char *zFullOldPath = mprintf("%s%s", g.zLocalRoot, zOldName);
600602
char *zFullNewPath = mprintf("%s%s", g.zLocalRoot, zNewName);
601603
if( file_wd_islink(zFullOldPath) ){
602604
symlink_copy(zFullOldPath, zFullNewPath);
603605
}else{
@@ -618,11 +620,11 @@
618620
}
619621
if( nOverwrite ){
620622
fossil_warning("WARNING: %d unmanaged files were overwritten",
621623
nOverwrite);
622624
}
623
- if( nochangeFlag ){
625
+ if( dryRunFlag ){
624626
fossil_warning("REMINDER: this was a dry run -"
625627
" no file were actually changed.");
626628
}
627629
628630
/*
@@ -643,7 +645,7 @@
643645
db_multi_exec("INSERT OR IGNORE INTO vmerge(id,merge) VALUES(-2,%d)",pid);
644646
}else{
645647
db_multi_exec("INSERT OR IGNORE INTO vmerge(id,merge) VALUES(0,%d)", mid);
646648
}
647649
undo_finish();
648
- db_end_transaction(nochangeFlag);
650
+ db_end_transaction(dryRunFlag);
649651
}
650652
--- src/merge.c
+++ src/merge.c
@@ -91,23 +91,22 @@
91 ** files whose names differ only in case are taken
92 ** to be the same file.
93 **
94 ** --detail Show additional details of the merge
95 **
96 ** --force | -f Force the merge even if it would be a no-op.
97 **
98 ** --nochange | -n Dryrun: do not actually make any changes; just
99 ** show what would have happened.
100 */
101 void merge_cmd(void){
102 int vid; /* Current version "V" */
103 int mid; /* Version we are merging from "M" */
104 int pid; /* The pivot version - most recent common ancestor P */
105 int detailFlag; /* True if the --detail option is present */
106 int pickFlag; /* True if the --cherrypick option is present */
107 int backoutFlag; /* True if the --backout option is present */
108 int nochangeFlag; /* True if the --nochange or -n option is present */
109 int forceFlag; /* True if the --force or -f option is present */
110 const char *zBinGlob; /* The value of --binary */
111 const char *zPivot; /* The value of --baseline */
112 int debugFlag; /* True if --debug is present */
113 int nChng; /* Number of file name changes */
@@ -129,11 +128,14 @@
129 detailFlag = find_option("detail",0,0)!=0;
130 pickFlag = find_option("cherrypick",0,0)!=0;
131 backoutFlag = find_option("backout",0,0)!=0;
132 debugFlag = find_option("debug",0,0)!=0;
133 zBinGlob = find_option("binary",0,1);
134 nochangeFlag = find_option("nochange","n",0)!=0;
 
 
 
135 forceFlag = find_option("force","f",0)!=0;
136 zPivot = find_option("baseline",0,1);
137 capture_case_sensitive_option();
138 verify_all_options();
139 db_must_be_within_tree();
@@ -252,11 +254,11 @@
252 print_checkin_description(mid, 12, "merge-from:");
253 print_checkin_description(pid, 12, "baseline:");
254 }
255 vfile_check_signature(vid, CKSIG_ENOTFILE);
256 db_begin_transaction();
257 if( !nochangeFlag ) undo_begin();
258 load_vfile_from_rid(mid);
259 load_vfile_from_rid(pid);
260 if( debugFlag ){
261 char *z;
262 z = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", pid);
@@ -443,11 +445,11 @@
443 nOverwrite++;
444 }else{
445 fossil_print("ADDED %s\n", zName);
446 }
447 fossil_free(zFullName);
448 if( !nochangeFlag ){
449 undo_save(zName);
450 vfile_to_disk(0, idm, 0, 0);
451 }
452 }
453 db_finalize(&q);
@@ -466,11 +468,11 @@
466 int ridm = db_column_int(&q, 1);
467 const char *zName = db_column_text(&q, 2);
468 int islinkm = db_column_int(&q, 3);
469 /* Copy content from idm over into idv. Overwrite idv. */
470 fossil_print("UPDATE %s\n", zName);
471 if( !nochangeFlag ){
472 undo_save(zName);
473 db_multi_exec(
474 "UPDATE vfile SET mtime=0, mrid=%d, chnged=2, islink=%d "
475 " WHERE id=%d", ridm, islinkm, idv
476 );
@@ -518,15 +520,15 @@
518 content_get(ridm, &m);
519 if( isBinary ){
520 rc = -1;
521 blob_zero(&r);
522 }else{
523 unsigned mergeFlags = nochangeFlag ? MERGE_DRYRUN : 0;
524 rc = merge_3way(&p, zFullPath, &m, &r, mergeFlags);
525 }
526 if( rc>=0 ){
527 if( !nochangeFlag ){
528 blob_write_to_file(&r, zFullPath);
529 file_wd_setexe(zFullPath, isExe);
530 }
531 db_multi_exec("UPDATE vfile SET mtime=0 WHERE id=%d", idv);
532 if( rc>0 ){
@@ -565,11 +567,11 @@
565 }
566 undo_save(zName);
567 db_multi_exec(
568 "UPDATE vfile SET deleted=1 WHERE id=%d", idv
569 );
570 if( !nochangeFlag ){
571 char *zFullPath = mprintf("%s%s", g.zLocalRoot, zName);
572 file_delete(zFullPath);
573 free(zFullPath);
574 }
575 }
@@ -593,11 +595,11 @@
593 undo_save(zNewName);
594 db_multi_exec(
595 "UPDATE vfile SET pathname=%Q, origname=coalesce(origname,pathname)"
596 " WHERE id=%d AND vid=%d", zNewName, idv, vid
597 );
598 if( !nochangeFlag ){
599 char *zFullOldPath = mprintf("%s%s", g.zLocalRoot, zOldName);
600 char *zFullNewPath = mprintf("%s%s", g.zLocalRoot, zNewName);
601 if( file_wd_islink(zFullOldPath) ){
602 symlink_copy(zFullOldPath, zFullNewPath);
603 }else{
@@ -618,11 +620,11 @@
618 }
619 if( nOverwrite ){
620 fossil_warning("WARNING: %d unmanaged files were overwritten",
621 nOverwrite);
622 }
623 if( nochangeFlag ){
624 fossil_warning("REMINDER: this was a dry run -"
625 " no file were actually changed.");
626 }
627
628 /*
@@ -643,7 +645,7 @@
643 db_multi_exec("INSERT OR IGNORE INTO vmerge(id,merge) VALUES(-2,%d)",pid);
644 }else{
645 db_multi_exec("INSERT OR IGNORE INTO vmerge(id,merge) VALUES(0,%d)", mid);
646 }
647 undo_finish();
648 db_end_transaction(nochangeFlag);
649 }
650
--- src/merge.c
+++ src/merge.c
@@ -91,23 +91,22 @@
91 ** files whose names differ only in case are taken
92 ** to be the same file.
93 **
94 ** --detail Show additional details of the merge
95 **
96 ** -f|--force Force the merge even if it would be a no-op.
97 **
98 ** -n|--dry-run If given, display instead of run actions
 
99 */
100 void merge_cmd(void){
101 int vid; /* Current version "V" */
102 int mid; /* Version we are merging from "M" */
103 int pid; /* The pivot version - most recent common ancestor P */
104 int detailFlag; /* True if the --detail option is present */
105 int pickFlag; /* True if the --cherrypick option is present */
106 int backoutFlag; /* True if the --backout option is present */
107 int dryRunFlag; /* True if the --dry-run or -n option is present */
108 int forceFlag; /* True if the --force or -f option is present */
109 const char *zBinGlob; /* The value of --binary */
110 const char *zPivot; /* The value of --baseline */
111 int debugFlag; /* True if --debug is present */
112 int nChng; /* Number of file name changes */
@@ -129,11 +128,14 @@
128 detailFlag = find_option("detail",0,0)!=0;
129 pickFlag = find_option("cherrypick",0,0)!=0;
130 backoutFlag = find_option("backout",0,0)!=0;
131 debugFlag = find_option("debug",0,0)!=0;
132 zBinGlob = find_option("binary",0,1);
133 dryRunFlag = find_option("dry-run","n",0)!=0;
134 if( !dryRunFlag ){
135 dryRunFlag = find_option("nochange",0,0)!=0; /* deprecated */
136 }
137 forceFlag = find_option("force","f",0)!=0;
138 zPivot = find_option("baseline",0,1);
139 capture_case_sensitive_option();
140 verify_all_options();
141 db_must_be_within_tree();
@@ -252,11 +254,11 @@
254 print_checkin_description(mid, 12, "merge-from:");
255 print_checkin_description(pid, 12, "baseline:");
256 }
257 vfile_check_signature(vid, CKSIG_ENOTFILE);
258 db_begin_transaction();
259 if( !dryRunFlag ) undo_begin();
260 load_vfile_from_rid(mid);
261 load_vfile_from_rid(pid);
262 if( debugFlag ){
263 char *z;
264 z = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", pid);
@@ -443,11 +445,11 @@
445 nOverwrite++;
446 }else{
447 fossil_print("ADDED %s\n", zName);
448 }
449 fossil_free(zFullName);
450 if( !dryRunFlag ){
451 undo_save(zName);
452 vfile_to_disk(0, idm, 0, 0);
453 }
454 }
455 db_finalize(&q);
@@ -466,11 +468,11 @@
468 int ridm = db_column_int(&q, 1);
469 const char *zName = db_column_text(&q, 2);
470 int islinkm = db_column_int(&q, 3);
471 /* Copy content from idm over into idv. Overwrite idv. */
472 fossil_print("UPDATE %s\n", zName);
473 if( !dryRunFlag ){
474 undo_save(zName);
475 db_multi_exec(
476 "UPDATE vfile SET mtime=0, mrid=%d, chnged=2, islink=%d "
477 " WHERE id=%d", ridm, islinkm, idv
478 );
@@ -518,15 +520,15 @@
520 content_get(ridm, &m);
521 if( isBinary ){
522 rc = -1;
523 blob_zero(&r);
524 }else{
525 unsigned mergeFlags = dryRunFlag ? MERGE_DRYRUN : 0;
526 rc = merge_3way(&p, zFullPath, &m, &r, mergeFlags);
527 }
528 if( rc>=0 ){
529 if( !dryRunFlag ){
530 blob_write_to_file(&r, zFullPath);
531 file_wd_setexe(zFullPath, isExe);
532 }
533 db_multi_exec("UPDATE vfile SET mtime=0 WHERE id=%d", idv);
534 if( rc>0 ){
@@ -565,11 +567,11 @@
567 }
568 undo_save(zName);
569 db_multi_exec(
570 "UPDATE vfile SET deleted=1 WHERE id=%d", idv
571 );
572 if( !dryRunFlag ){
573 char *zFullPath = mprintf("%s%s", g.zLocalRoot, zName);
574 file_delete(zFullPath);
575 free(zFullPath);
576 }
577 }
@@ -593,11 +595,11 @@
595 undo_save(zNewName);
596 db_multi_exec(
597 "UPDATE vfile SET pathname=%Q, origname=coalesce(origname,pathname)"
598 " WHERE id=%d AND vid=%d", zNewName, idv, vid
599 );
600 if( !dryRunFlag ){
601 char *zFullOldPath = mprintf("%s%s", g.zLocalRoot, zOldName);
602 char *zFullNewPath = mprintf("%s%s", g.zLocalRoot, zNewName);
603 if( file_wd_islink(zFullOldPath) ){
604 symlink_copy(zFullOldPath, zFullNewPath);
605 }else{
@@ -618,11 +620,11 @@
620 }
621 if( nOverwrite ){
622 fossil_warning("WARNING: %d unmanaged files were overwritten",
623 nOverwrite);
624 }
625 if( dryRunFlag ){
626 fossil_warning("REMINDER: this was a dry run -"
627 " no file were actually changed.");
628 }
629
630 /*
@@ -643,7 +645,7 @@
645 db_multi_exec("INSERT OR IGNORE INTO vmerge(id,merge) VALUES(-2,%d)",pid);
646 }else{
647 db_multi_exec("INSERT OR IGNORE INTO vmerge(id,merge) VALUES(0,%d)", mid);
648 }
649 undo_finish();
650 db_end_transaction(dryRunFlag);
651 }
652
+19 -16
--- src/update.c
+++ src/update.c
@@ -87,21 +87,21 @@
8787
** files in addition to those file that actually do change.
8888
**
8989
** Options:
9090
** --debug print debug information on stdout
9191
** --latest acceptable in place of VERSION, update to latest version
92
-** -n|--nochange do not perform changes but show what would be done
92
+** -n|--dry-run If given, display instead of run actions
9393
** -v|--verbose print status information about all files
9494
**
9595
** See also: revert
9696
*/
9797
void update_cmd(void){
9898
int vid; /* Current version */
9999
int tid=0; /* Target version - version we are changing to */
100100
Stmt q;
101101
int latestFlag; /* --latest. Pick the latest version if true */
102
- int nochangeFlag; /* -n or --nochange. Do a dry run */
102
+ int dryRunFlag; /* -n or --dry-run. Do a dry run */
103103
int verboseFlag; /* -v or --verbose. Output extra information */
104104
int debugFlag; /* --debug option */
105105
int setmtimeFlag; /* --setmtime. Set mtimes on files */
106106
int nChng; /* Number of file renames */
107107
int *aChng; /* Array of file renames */
@@ -114,26 +114,29 @@
114114
if( !internalUpdate ){
115115
undo_capture_command_line();
116116
url_proxy_options();
117117
}
118118
latestFlag = find_option("latest",0, 0)!=0;
119
- nochangeFlag = find_option("nochange","n",0)!=0;
119
+ dryRunFlag = find_option("dry-run","n",0)!=0;
120
+ if( !dryRunFlag ){
121
+ dryRunFlag = find_option("nochange",0,0)!=0; /* deprecated */
122
+ }
120123
verboseFlag = find_option("verbose","v",0)!=0;
121124
debugFlag = find_option("debug",0,0)!=0;
122125
setmtimeFlag = find_option("setmtime",0,0)!=0;
123126
db_must_be_within_tree();
124127
vid = db_lget_int("checkout", 0);
125128
if( vid==0 ){
126129
fossil_fatal("cannot find current version");
127130
}
128
- if( !nochangeFlag && !internalUpdate ){
131
+ if( !dryRunFlag && !internalUpdate ){
129132
autosync(SYNC_PULL + SYNC_VERBOSE*verboseFlag);
130133
}
131134
132135
/* Create any empty directories now, as well as after the update,
133136
** so changes in settings are reflected now */
134
- if( !nochangeFlag ) ensure_empty_dirs_created();
137
+ if( !dryRunFlag ) ensure_empty_dirs_created();
135138
136139
if( internalUpdate ){
137140
tid = internalUpdate;
138141
}else if( g.argc>=3 ){
139142
if( fossil_strcmp(g.argv[2], "current")==0 ){
@@ -199,11 +202,11 @@
199202
fossil_panic("Internal Error: unable to find a version to update to.");
200203
}
201204
202205
db_begin_transaction();
203206
vfile_check_signature(vid, CKSIG_ENOTFILE);
204
- if( !nochangeFlag && !internalUpdate ) undo_begin();
207
+ if( !dryRunFlag && !internalUpdate ) undo_begin();
205208
load_vfile_from_rid(tid);
206209
207210
/*
208211
** The record.fn field is used to match files against each other. The
209212
** FV table contains one row for each each unique filename in
@@ -389,27 +392,27 @@
389392
nOverwrite++;
390393
}else{
391394
fossil_print("ADD %s\n", zName);
392395
}
393396
undo_save(zName);
394
- if( !nochangeFlag ) vfile_to_disk(0, idt, 0, 0);
397
+ if( !dryRunFlag ) vfile_to_disk(0, idt, 0, 0);
395398
}else if( idt>0 && idv>0 && ridt!=ridv && (chnged==0 || deleted) ){
396399
/* The file is unedited. Change it to the target version */
397400
undo_save(zName);
398401
if( deleted ){
399402
fossil_print("UPDATE %s - change to unmanged file\n", zName);
400403
}else{
401404
fossil_print("UPDATE %s\n", zName);
402405
}
403
- if( !nochangeFlag ) vfile_to_disk(0, idt, 0, 0);
406
+ if( !dryRunFlag ) vfile_to_disk(0, idt, 0, 0);
404407
}else if( idt>0 && idv>0 && file_wd_size(zFullPath)<0 ){
405408
/* The file missing from the local check-out. Restore it to the
406409
** version that appears in the target. */
407410
fossil_print("UPDATE %s%s\n", zName,
408411
deleted?" - change to unmanaged file":"");
409412
undo_save(zName);
410
- if( !nochangeFlag ) vfile_to_disk(0, idt, 0, 0);
413
+ if( !dryRunFlag ) vfile_to_disk(0, idt, 0, 0);
411414
}else if( idt==0 && idv>0 ){
412415
if( ridv==0 ){
413416
/* Added in current checkout. Continue to hold the file as
414417
** as an addition */
415418
db_multi_exec("UPDATE vfile SET vid=%d WHERE id=%d", tid, idv);
@@ -420,11 +423,11 @@
420423
zName);
421424
nConflict++;
422425
}else{
423426
fossil_print("REMOVE %s\n", zName);
424427
undo_save(zName);
425
- if( !nochangeFlag ) file_delete(zFullPath);
428
+ if( !dryRunFlag ) file_delete(zFullPath);
426429
}
427430
}else if( idt>0 && idv>0 && ridt!=ridv && chnged ){
428431
/* Merge the changes in the current tree into the target version */
429432
Blob r, t, v;
430433
int rc;
@@ -435,34 +438,34 @@
435438
}
436439
if( islinkv || islinkt /* || file_wd_islink(zFullPath) */ ){
437440
fossil_print("***** Cannot merge symlink %s\n", zNewName);
438441
nConflict++;
439442
}else{
440
- unsigned mergeFlags = nochangeFlag ? MERGE_DRYRUN : 0;
443
+ unsigned mergeFlags = dryRunFlag ? MERGE_DRYRUN : 0;
441444
undo_save(zName);
442445
content_get(ridt, &t);
443446
content_get(ridv, &v);
444447
rc = merge_3way(&v, zFullPath, &t, &r, mergeFlags);
445448
if( rc>=0 ){
446
- if( !nochangeFlag ){
449
+ if( !dryRunFlag ){
447450
blob_write_to_file(&r, zFullNewPath);
448451
file_wd_setexe(zFullNewPath, isexe);
449452
}
450453
if( rc>0 ){
451454
fossil_print("***** %d merge conflicts in %s\n", rc, zNewName);
452455
nConflict++;
453456
}
454457
}else{
455
- if( !nochangeFlag ){
458
+ if( !dryRunFlag ){
456459
blob_write_to_file(&t, zFullNewPath);
457460
file_wd_setexe(zFullNewPath, isexe);
458461
}
459462
fossil_print("***** Cannot merge binary file %s\n", zNewName);
460463
nConflict++;
461464
}
462465
}
463
- if( nameChng && !nochangeFlag ) file_delete(zFullPath);
466
+ if( nameChng && !dryRunFlag ) file_delete(zFullPath);
464467
blob_reset(&v);
465468
blob_reset(&t);
466469
blob_reset(&r);
467470
}else{
468471
nUpdate--;
@@ -491,11 +494,11 @@
491494
nUpdate, nUpdate>1 ? "s" : "");
492495
}
493496
494497
/* Report on conflicts
495498
*/
496
- if( !nochangeFlag ){
499
+ if( !dryRunFlag ){
497500
Stmt q;
498501
int nMerge = 0;
499502
db_prepare(&q, "SELECT uuid, id FROM vmerge JOIN blob ON merge=rid"
500503
" WHERE id<=0");
501504
while( db_step(&q)==SQLITE_ROW ){
@@ -528,11 +531,11 @@
528531
}
529532
530533
/*
531534
** Clean up the mid and pid VFILE entries. Then commit the changes.
532535
*/
533
- if( nochangeFlag ){
536
+ if( dryRunFlag ){
534537
db_end_transaction(1); /* With --nochange, rollback changes */
535538
}else{
536539
ensure_empty_dirs_created();
537540
if( g.argc<=3 ){
538541
/* All files updated. Shift the current checkout to the target. */
539542
--- src/update.c
+++ src/update.c
@@ -87,21 +87,21 @@
87 ** files in addition to those file that actually do change.
88 **
89 ** Options:
90 ** --debug print debug information on stdout
91 ** --latest acceptable in place of VERSION, update to latest version
92 ** -n|--nochange do not perform changes but show what would be done
93 ** -v|--verbose print status information about all files
94 **
95 ** See also: revert
96 */
97 void update_cmd(void){
98 int vid; /* Current version */
99 int tid=0; /* Target version - version we are changing to */
100 Stmt q;
101 int latestFlag; /* --latest. Pick the latest version if true */
102 int nochangeFlag; /* -n or --nochange. Do a dry run */
103 int verboseFlag; /* -v or --verbose. Output extra information */
104 int debugFlag; /* --debug option */
105 int setmtimeFlag; /* --setmtime. Set mtimes on files */
106 int nChng; /* Number of file renames */
107 int *aChng; /* Array of file renames */
@@ -114,26 +114,29 @@
114 if( !internalUpdate ){
115 undo_capture_command_line();
116 url_proxy_options();
117 }
118 latestFlag = find_option("latest",0, 0)!=0;
119 nochangeFlag = find_option("nochange","n",0)!=0;
 
 
 
120 verboseFlag = find_option("verbose","v",0)!=0;
121 debugFlag = find_option("debug",0,0)!=0;
122 setmtimeFlag = find_option("setmtime",0,0)!=0;
123 db_must_be_within_tree();
124 vid = db_lget_int("checkout", 0);
125 if( vid==0 ){
126 fossil_fatal("cannot find current version");
127 }
128 if( !nochangeFlag && !internalUpdate ){
129 autosync(SYNC_PULL + SYNC_VERBOSE*verboseFlag);
130 }
131
132 /* Create any empty directories now, as well as after the update,
133 ** so changes in settings are reflected now */
134 if( !nochangeFlag ) ensure_empty_dirs_created();
135
136 if( internalUpdate ){
137 tid = internalUpdate;
138 }else if( g.argc>=3 ){
139 if( fossil_strcmp(g.argv[2], "current")==0 ){
@@ -199,11 +202,11 @@
199 fossil_panic("Internal Error: unable to find a version to update to.");
200 }
201
202 db_begin_transaction();
203 vfile_check_signature(vid, CKSIG_ENOTFILE);
204 if( !nochangeFlag && !internalUpdate ) undo_begin();
205 load_vfile_from_rid(tid);
206
207 /*
208 ** The record.fn field is used to match files against each other. The
209 ** FV table contains one row for each each unique filename in
@@ -389,27 +392,27 @@
389 nOverwrite++;
390 }else{
391 fossil_print("ADD %s\n", zName);
392 }
393 undo_save(zName);
394 if( !nochangeFlag ) vfile_to_disk(0, idt, 0, 0);
395 }else if( idt>0 && idv>0 && ridt!=ridv && (chnged==0 || deleted) ){
396 /* The file is unedited. Change it to the target version */
397 undo_save(zName);
398 if( deleted ){
399 fossil_print("UPDATE %s - change to unmanged file\n", zName);
400 }else{
401 fossil_print("UPDATE %s\n", zName);
402 }
403 if( !nochangeFlag ) vfile_to_disk(0, idt, 0, 0);
404 }else if( idt>0 && idv>0 && file_wd_size(zFullPath)<0 ){
405 /* The file missing from the local check-out. Restore it to the
406 ** version that appears in the target. */
407 fossil_print("UPDATE %s%s\n", zName,
408 deleted?" - change to unmanaged file":"");
409 undo_save(zName);
410 if( !nochangeFlag ) vfile_to_disk(0, idt, 0, 0);
411 }else if( idt==0 && idv>0 ){
412 if( ridv==0 ){
413 /* Added in current checkout. Continue to hold the file as
414 ** as an addition */
415 db_multi_exec("UPDATE vfile SET vid=%d WHERE id=%d", tid, idv);
@@ -420,11 +423,11 @@
420 zName);
421 nConflict++;
422 }else{
423 fossil_print("REMOVE %s\n", zName);
424 undo_save(zName);
425 if( !nochangeFlag ) file_delete(zFullPath);
426 }
427 }else if( idt>0 && idv>0 && ridt!=ridv && chnged ){
428 /* Merge the changes in the current tree into the target version */
429 Blob r, t, v;
430 int rc;
@@ -435,34 +438,34 @@
435 }
436 if( islinkv || islinkt /* || file_wd_islink(zFullPath) */ ){
437 fossil_print("***** Cannot merge symlink %s\n", zNewName);
438 nConflict++;
439 }else{
440 unsigned mergeFlags = nochangeFlag ? MERGE_DRYRUN : 0;
441 undo_save(zName);
442 content_get(ridt, &t);
443 content_get(ridv, &v);
444 rc = merge_3way(&v, zFullPath, &t, &r, mergeFlags);
445 if( rc>=0 ){
446 if( !nochangeFlag ){
447 blob_write_to_file(&r, zFullNewPath);
448 file_wd_setexe(zFullNewPath, isexe);
449 }
450 if( rc>0 ){
451 fossil_print("***** %d merge conflicts in %s\n", rc, zNewName);
452 nConflict++;
453 }
454 }else{
455 if( !nochangeFlag ){
456 blob_write_to_file(&t, zFullNewPath);
457 file_wd_setexe(zFullNewPath, isexe);
458 }
459 fossil_print("***** Cannot merge binary file %s\n", zNewName);
460 nConflict++;
461 }
462 }
463 if( nameChng && !nochangeFlag ) file_delete(zFullPath);
464 blob_reset(&v);
465 blob_reset(&t);
466 blob_reset(&r);
467 }else{
468 nUpdate--;
@@ -491,11 +494,11 @@
491 nUpdate, nUpdate>1 ? "s" : "");
492 }
493
494 /* Report on conflicts
495 */
496 if( !nochangeFlag ){
497 Stmt q;
498 int nMerge = 0;
499 db_prepare(&q, "SELECT uuid, id FROM vmerge JOIN blob ON merge=rid"
500 " WHERE id<=0");
501 while( db_step(&q)==SQLITE_ROW ){
@@ -528,11 +531,11 @@
528 }
529
530 /*
531 ** Clean up the mid and pid VFILE entries. Then commit the changes.
532 */
533 if( nochangeFlag ){
534 db_end_transaction(1); /* With --nochange, rollback changes */
535 }else{
536 ensure_empty_dirs_created();
537 if( g.argc<=3 ){
538 /* All files updated. Shift the current checkout to the target. */
539
--- src/update.c
+++ src/update.c
@@ -87,21 +87,21 @@
87 ** files in addition to those file that actually do change.
88 **
89 ** Options:
90 ** --debug print debug information on stdout
91 ** --latest acceptable in place of VERSION, update to latest version
92 ** -n|--dry-run If given, display instead of run actions
93 ** -v|--verbose print status information about all files
94 **
95 ** See also: revert
96 */
97 void update_cmd(void){
98 int vid; /* Current version */
99 int tid=0; /* Target version - version we are changing to */
100 Stmt q;
101 int latestFlag; /* --latest. Pick the latest version if true */
102 int dryRunFlag; /* -n or --dry-run. Do a dry run */
103 int verboseFlag; /* -v or --verbose. Output extra information */
104 int debugFlag; /* --debug option */
105 int setmtimeFlag; /* --setmtime. Set mtimes on files */
106 int nChng; /* Number of file renames */
107 int *aChng; /* Array of file renames */
@@ -114,26 +114,29 @@
114 if( !internalUpdate ){
115 undo_capture_command_line();
116 url_proxy_options();
117 }
118 latestFlag = find_option("latest",0, 0)!=0;
119 dryRunFlag = find_option("dry-run","n",0)!=0;
120 if( !dryRunFlag ){
121 dryRunFlag = find_option("nochange",0,0)!=0; /* deprecated */
122 }
123 verboseFlag = find_option("verbose","v",0)!=0;
124 debugFlag = find_option("debug",0,0)!=0;
125 setmtimeFlag = find_option("setmtime",0,0)!=0;
126 db_must_be_within_tree();
127 vid = db_lget_int("checkout", 0);
128 if( vid==0 ){
129 fossil_fatal("cannot find current version");
130 }
131 if( !dryRunFlag && !internalUpdate ){
132 autosync(SYNC_PULL + SYNC_VERBOSE*verboseFlag);
133 }
134
135 /* Create any empty directories now, as well as after the update,
136 ** so changes in settings are reflected now */
137 if( !dryRunFlag ) ensure_empty_dirs_created();
138
139 if( internalUpdate ){
140 tid = internalUpdate;
141 }else if( g.argc>=3 ){
142 if( fossil_strcmp(g.argv[2], "current")==0 ){
@@ -199,11 +202,11 @@
202 fossil_panic("Internal Error: unable to find a version to update to.");
203 }
204
205 db_begin_transaction();
206 vfile_check_signature(vid, CKSIG_ENOTFILE);
207 if( !dryRunFlag && !internalUpdate ) undo_begin();
208 load_vfile_from_rid(tid);
209
210 /*
211 ** The record.fn field is used to match files against each other. The
212 ** FV table contains one row for each each unique filename in
@@ -389,27 +392,27 @@
392 nOverwrite++;
393 }else{
394 fossil_print("ADD %s\n", zName);
395 }
396 undo_save(zName);
397 if( !dryRunFlag ) vfile_to_disk(0, idt, 0, 0);
398 }else if( idt>0 && idv>0 && ridt!=ridv && (chnged==0 || deleted) ){
399 /* The file is unedited. Change it to the target version */
400 undo_save(zName);
401 if( deleted ){
402 fossil_print("UPDATE %s - change to unmanged file\n", zName);
403 }else{
404 fossil_print("UPDATE %s\n", zName);
405 }
406 if( !dryRunFlag ) vfile_to_disk(0, idt, 0, 0);
407 }else if( idt>0 && idv>0 && file_wd_size(zFullPath)<0 ){
408 /* The file missing from the local check-out. Restore it to the
409 ** version that appears in the target. */
410 fossil_print("UPDATE %s%s\n", zName,
411 deleted?" - change to unmanaged file":"");
412 undo_save(zName);
413 if( !dryRunFlag ) vfile_to_disk(0, idt, 0, 0);
414 }else if( idt==0 && idv>0 ){
415 if( ridv==0 ){
416 /* Added in current checkout. Continue to hold the file as
417 ** as an addition */
418 db_multi_exec("UPDATE vfile SET vid=%d WHERE id=%d", tid, idv);
@@ -420,11 +423,11 @@
423 zName);
424 nConflict++;
425 }else{
426 fossil_print("REMOVE %s\n", zName);
427 undo_save(zName);
428 if( !dryRunFlag ) file_delete(zFullPath);
429 }
430 }else if( idt>0 && idv>0 && ridt!=ridv && chnged ){
431 /* Merge the changes in the current tree into the target version */
432 Blob r, t, v;
433 int rc;
@@ -435,34 +438,34 @@
438 }
439 if( islinkv || islinkt /* || file_wd_islink(zFullPath) */ ){
440 fossil_print("***** Cannot merge symlink %s\n", zNewName);
441 nConflict++;
442 }else{
443 unsigned mergeFlags = dryRunFlag ? MERGE_DRYRUN : 0;
444 undo_save(zName);
445 content_get(ridt, &t);
446 content_get(ridv, &v);
447 rc = merge_3way(&v, zFullPath, &t, &r, mergeFlags);
448 if( rc>=0 ){
449 if( !dryRunFlag ){
450 blob_write_to_file(&r, zFullNewPath);
451 file_wd_setexe(zFullNewPath, isexe);
452 }
453 if( rc>0 ){
454 fossil_print("***** %d merge conflicts in %s\n", rc, zNewName);
455 nConflict++;
456 }
457 }else{
458 if( !dryRunFlag ){
459 blob_write_to_file(&t, zFullNewPath);
460 file_wd_setexe(zFullNewPath, isexe);
461 }
462 fossil_print("***** Cannot merge binary file %s\n", zNewName);
463 nConflict++;
464 }
465 }
466 if( nameChng && !dryRunFlag ) file_delete(zFullPath);
467 blob_reset(&v);
468 blob_reset(&t);
469 blob_reset(&r);
470 }else{
471 nUpdate--;
@@ -491,11 +494,11 @@
494 nUpdate, nUpdate>1 ? "s" : "");
495 }
496
497 /* Report on conflicts
498 */
499 if( !dryRunFlag ){
500 Stmt q;
501 int nMerge = 0;
502 db_prepare(&q, "SELECT uuid, id FROM vmerge JOIN blob ON merge=rid"
503 " WHERE id<=0");
504 while( db_step(&q)==SQLITE_ROW ){
@@ -528,11 +531,11 @@
531 }
532
533 /*
534 ** Clean up the mid and pid VFILE entries. Then commit the changes.
535 */
536 if( dryRunFlag ){
537 db_end_transaction(1); /* With --nochange, rollback changes */
538 }else{
539 ensure_empty_dirs_created();
540 if( g.argc<=3 ){
541 /* All files updated. Shift the current checkout to the target. */
542

Keyboard Shortcuts

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