Fossil SCM

Add the "fossil all changes" command to show all check-outs with uncommitted changes. Also add the "fossil all list --ckout" option to show all current checkouts rather than all repositories.

drh 2012-04-28 22:42 trunk
Commit 42f4d14771b0a7a7b3266febf7c4f011929ee1a0
3 files changed +80 -43 +11 +6 -2
+80 -43
--- src/allrepo.c
+++ src/allrepo.c
@@ -63,11 +63,15 @@
6363
** Available operations are:
6464
**
6565
** ignore Arguments are repositories that should be ignored
6666
** by subsequent list, pull, push, rebuild, and sync.
6767
**
68
-** list | ls Display the location of all repositories
68
+** list | ls Display the location of all repositories.
69
+** The --ckout option causes all local checkouts to be
70
+** list instead.
71
+**
72
+** changes Shows all local checkouts that have uncommitted changes
6973
**
7074
** pull Run a "pull" operation on all repositories
7175
**
7276
** push Run a "push" on all repositories
7377
**
@@ -85,22 +89,32 @@
8589
Stmt q;
8690
const char *zCmd;
8791
char *zSyscmd;
8892
char *zFossil;
8993
char *zQFilename;
90
- int nMissing;
94
+ int useCheckouts = 0;
95
+ int quiet = 0;
96
+ int testRun = 0;
9197
int stopOnError = find_option("dontstop",0,0)==0;
9298
int rc;
99
+ Bag outOfDate;
93100
101
+ /* The undocumented --test option causes no changes to occur to any
102
+ ** repository, but instead show what would have happened. Intended for
103
+ ** test and debugging use.
104
+ */
105
+ testRun = find_option("test",0,0)!=0;
106
+
94107
if( g.argc<3 ){
95
- usage("list|ls|pull|push|rebuild|sync");
108
+ usage("changes|list|ls|pull|push|rebuild|sync");
96109
}
97110
n = strlen(g.argv[2]);
98111
db_open_config(1);
99112
zCmd = g.argv[2];
100113
if( strncmp(zCmd, "list", n)==0 || strncmp(zCmd,"ls",n)==0 ){
101114
zCmd = "list";
115
+ useCheckouts = find_option("ckout","c",0)!=0;
102116
}else if( strncmp(zCmd, "push", n)==0 ){
103117
zCmd = "push -autourl -R";
104118
}else if( strncmp(zCmd, "pull", n)==0 ){
105119
zCmd = "pull -autourl -R";
106120
}else if( strncmp(zCmd, "rebuild", n)==0 ){
@@ -107,77 +121,100 @@
107121
zCmd = "rebuild";
108122
}else if( strncmp(zCmd, "sync", n)==0 ){
109123
zCmd = "sync -autourl -R";
110124
}else if( strncmp(zCmd, "test-integrity", n)==0 ){
111125
zCmd = "test-integrity";
126
+ }else if( strncmp(zCmd, "changes", n)==0 ){
127
+ zCmd = "changes --quiet --header --chdir";
128
+ useCheckouts = 1;
129
+ stopOnError = 0;
130
+ quiet = 1;
112131
}else if( strncmp(zCmd, "ignore", n)==0 ){
113132
int j;
133
+ verify_all_options();
114134
db_begin_transaction();
115135
for(j=3; j<g.argc; j++){
116
- db_multi_exec("DELETE FROM global_config WHERE name GLOB 'repo:%q'",
117
- g.argv[j]);
136
+ char *zSql = mprintf("DELETE FROM global_config"
137
+ " WHERE name GLOB 'repo:%q'", g.argv[j]);
138
+ if( testRun ){
139
+ fossil_print("%s\n", zSql);
140
+ }else{
141
+ db_multi_exec("%s", zSql);
142
+ }
143
+ fossil_free(zSql);
118144
}
119145
db_end_transaction(0);
120146
return;
121147
}else{
122148
fossil_fatal("\"all\" subcommand should be one of: "
123
- "ignore list ls push pull rebuild sync");
149
+ "changes ignore list ls push pull rebuild sync");
124150
}
151
+ verify_all_options();
125152
zFossil = quoteFilename(fossil_nameofexe());
126
- nMissing = 0;
127
- db_prepare(&q,
128
- "SELECT DISTINCT substr(name, 6) COLLATE nocase"
129
- " FROM global_config"
130
- " WHERE substr(name, 1, 5)=='repo:' ORDER BY 1"
131
- );
153
+ if( useCheckouts ){
154
+ db_prepare(&q,
155
+ "SELECT substr(name, 7) COLLATE nocase, max(rowid)"
156
+ " FROM global_config"
157
+ " WHERE substr(name, 1, 6)=='ckout:'"
158
+ " GROUP BY 1 ORDER BY 1"
159
+ );
160
+ }else{
161
+ db_prepare(&q,
162
+ "SELECT substr(name, 6) COLLATE nocase, max(rowid)"
163
+ " FROM global_config"
164
+ " WHERE substr(name, 1, 5)=='repo:'"
165
+ " GROUP BY 1 ORDER BY 1"
166
+ );
167
+ }
168
+ bag_init(&outOfDate);
132169
while( db_step(&q)==SQLITE_ROW ){
133170
const char *zFilename = db_column_text(&q, 0);
134
- if( file_access(zFilename, 0) ){
135
- nMissing++;
171
+ int rowid = db_column_int(&q, 1);
172
+ if( file_access(zFilename, 0) || !file_is_canonical(zFilename) ){
173
+ bag_insert(&outOfDate, rowid);
174
+ continue;
175
+ }
176
+ if( useCheckouts && file_isdir(zFilename)!=1 ){
177
+ bag_insert(&outOfDate, rowid);
136178
continue;
137179
}
138
- if( !file_is_canonical(zFilename) ) nMissing++;
139180
if( zCmd[0]=='l' ){
140181
fossil_print("%s\n", zFilename);
141182
continue;
142183
}
143184
zQFilename = quoteFilename(zFilename);
144185
zSyscmd = mprintf("%s %s %s", zFossil, zCmd, zQFilename);
145
- fossil_print("%s\n", zSyscmd);
146
- fflush(stdout);
147
- rc = fossil_system(zSyscmd);
186
+ if( !quiet || testRun ){
187
+ fossil_print("%s\n", zSyscmd);
188
+ fflush(stdout);
189
+ }
190
+ rc = testRun ? 0 : fossil_system(zSyscmd);
148191
free(zSyscmd);
149192
free(zQFilename);
150193
if( stopOnError && rc ){
151
- nMissing = 0;
152194
break;
153195
}
154196
}
197
+ db_finalize(&q);
155198
156199
/* If any repositories whose names appear in the ~/.fossil file could not
157200
** be found, remove those names from the ~/.fossil file.
158201
*/
159
- if( nMissing ){
160
- db_begin_transaction();
161
- db_reset(&q);
162
- while( db_step(&q)==SQLITE_ROW ){
163
- const char *zFilename = db_column_text(&q, 0);
164
- if( file_access(zFilename, 0) ){
165
- char *zRepo = mprintf("repo:%s", zFilename);
166
- db_unset(zRepo, 1);
167
- free(zRepo);
168
- }else if( !file_is_canonical(zFilename) ){
169
- Blob cname;
170
- char *zRepo = mprintf("repo:%s", zFilename);
171
- db_unset(zRepo, 1);
172
- free(zRepo);
173
- file_canonical_name(zFilename, &cname, 0);
174
- zRepo = mprintf("repo:%s", blob_str(&cname));
175
- db_set(zRepo, "1", 1);
176
- free(zRepo);
177
- }
178
- }
179
- db_reset(&q);
180
- db_end_transaction(0);
181
- }
182
- db_finalize(&q);
202
+ if( bag_count(&outOfDate)>0 ){
203
+ Blob sql;
204
+ char *zSep = "(";
205
+ int rowid;
206
+ blob_zero(&sql);
207
+ blob_appendf(&sql, "DELETE FROM global_config WHERE rowid IN ");
208
+ for(rowid=bag_first(&outOfDate); rowid>0; rowid=bag_next(&outOfDate,rowid)){
209
+ blob_appendf(&sql, "%s%d", zSep, rowid);
210
+ zSep = ",";
211
+ }
212
+ blob_appendf(&sql, ")");
213
+ if( testRun ){
214
+ fossil_print("%s\n", blob_str(&sql));
215
+ }else{
216
+ db_multi_exec(blob_str(&sql));
217
+ }
218
+ blob_reset(&sql);
219
+ }
183220
}
184221
--- src/allrepo.c
+++ src/allrepo.c
@@ -63,11 +63,15 @@
63 ** Available operations are:
64 **
65 ** ignore Arguments are repositories that should be ignored
66 ** by subsequent list, pull, push, rebuild, and sync.
67 **
68 ** list | ls Display the location of all repositories
 
 
 
 
69 **
70 ** pull Run a "pull" operation on all repositories
71 **
72 ** push Run a "push" on all repositories
73 **
@@ -85,22 +89,32 @@
85 Stmt q;
86 const char *zCmd;
87 char *zSyscmd;
88 char *zFossil;
89 char *zQFilename;
90 int nMissing;
 
 
91 int stopOnError = find_option("dontstop",0,0)==0;
92 int rc;
 
93
 
 
 
 
 
 
94 if( g.argc<3 ){
95 usage("list|ls|pull|push|rebuild|sync");
96 }
97 n = strlen(g.argv[2]);
98 db_open_config(1);
99 zCmd = g.argv[2];
100 if( strncmp(zCmd, "list", n)==0 || strncmp(zCmd,"ls",n)==0 ){
101 zCmd = "list";
 
102 }else if( strncmp(zCmd, "push", n)==0 ){
103 zCmd = "push -autourl -R";
104 }else if( strncmp(zCmd, "pull", n)==0 ){
105 zCmd = "pull -autourl -R";
106 }else if( strncmp(zCmd, "rebuild", n)==0 ){
@@ -107,77 +121,100 @@
107 zCmd = "rebuild";
108 }else if( strncmp(zCmd, "sync", n)==0 ){
109 zCmd = "sync -autourl -R";
110 }else if( strncmp(zCmd, "test-integrity", n)==0 ){
111 zCmd = "test-integrity";
 
 
 
 
 
112 }else if( strncmp(zCmd, "ignore", n)==0 ){
113 int j;
 
114 db_begin_transaction();
115 for(j=3; j<g.argc; j++){
116 db_multi_exec("DELETE FROM global_config WHERE name GLOB 'repo:%q'",
117 g.argv[j]);
 
 
 
 
 
 
118 }
119 db_end_transaction(0);
120 return;
121 }else{
122 fossil_fatal("\"all\" subcommand should be one of: "
123 "ignore list ls push pull rebuild sync");
124 }
 
125 zFossil = quoteFilename(fossil_nameofexe());
126 nMissing = 0;
127 db_prepare(&q,
128 "SELECT DISTINCT substr(name, 6) COLLATE nocase"
129 " FROM global_config"
130 " WHERE substr(name, 1, 5)=='repo:' ORDER BY 1"
131 );
 
 
 
 
 
 
 
 
 
 
132 while( db_step(&q)==SQLITE_ROW ){
133 const char *zFilename = db_column_text(&q, 0);
134 if( file_access(zFilename, 0) ){
135 nMissing++;
 
 
 
 
 
136 continue;
137 }
138 if( !file_is_canonical(zFilename) ) nMissing++;
139 if( zCmd[0]=='l' ){
140 fossil_print("%s\n", zFilename);
141 continue;
142 }
143 zQFilename = quoteFilename(zFilename);
144 zSyscmd = mprintf("%s %s %s", zFossil, zCmd, zQFilename);
145 fossil_print("%s\n", zSyscmd);
146 fflush(stdout);
147 rc = fossil_system(zSyscmd);
 
 
148 free(zSyscmd);
149 free(zQFilename);
150 if( stopOnError && rc ){
151 nMissing = 0;
152 break;
153 }
154 }
 
155
156 /* If any repositories whose names appear in the ~/.fossil file could not
157 ** be found, remove those names from the ~/.fossil file.
158 */
159 if( nMissing ){
160 db_begin_transaction();
161 db_reset(&q);
162 while( db_step(&q)==SQLITE_ROW ){
163 const char *zFilename = db_column_text(&q, 0);
164 if( file_access(zFilename, 0) ){
165 char *zRepo = mprintf("repo:%s", zFilename);
166 db_unset(zRepo, 1);
167 free(zRepo);
168 }else if( !file_is_canonical(zFilename) ){
169 Blob cname;
170 char *zRepo = mprintf("repo:%s", zFilename);
171 db_unset(zRepo, 1);
172 free(zRepo);
173 file_canonical_name(zFilename, &cname, 0);
174 zRepo = mprintf("repo:%s", blob_str(&cname));
175 db_set(zRepo, "1", 1);
176 free(zRepo);
177 }
178 }
179 db_reset(&q);
180 db_end_transaction(0);
181 }
182 db_finalize(&q);
183 }
184
--- src/allrepo.c
+++ src/allrepo.c
@@ -63,11 +63,15 @@
63 ** Available operations are:
64 **
65 ** ignore Arguments are repositories that should be ignored
66 ** by subsequent list, pull, push, rebuild, and sync.
67 **
68 ** list | ls Display the location of all repositories.
69 ** The --ckout option causes all local checkouts to be
70 ** list instead.
71 **
72 ** changes Shows all local checkouts that have uncommitted changes
73 **
74 ** pull Run a "pull" operation on all repositories
75 **
76 ** push Run a "push" on all repositories
77 **
@@ -85,22 +89,32 @@
89 Stmt q;
90 const char *zCmd;
91 char *zSyscmd;
92 char *zFossil;
93 char *zQFilename;
94 int useCheckouts = 0;
95 int quiet = 0;
96 int testRun = 0;
97 int stopOnError = find_option("dontstop",0,0)==0;
98 int rc;
99 Bag outOfDate;
100
101 /* The undocumented --test option causes no changes to occur to any
102 ** repository, but instead show what would have happened. Intended for
103 ** test and debugging use.
104 */
105 testRun = find_option("test",0,0)!=0;
106
107 if( g.argc<3 ){
108 usage("changes|list|ls|pull|push|rebuild|sync");
109 }
110 n = strlen(g.argv[2]);
111 db_open_config(1);
112 zCmd = g.argv[2];
113 if( strncmp(zCmd, "list", n)==0 || strncmp(zCmd,"ls",n)==0 ){
114 zCmd = "list";
115 useCheckouts = find_option("ckout","c",0)!=0;
116 }else if( strncmp(zCmd, "push", n)==0 ){
117 zCmd = "push -autourl -R";
118 }else if( strncmp(zCmd, "pull", n)==0 ){
119 zCmd = "pull -autourl -R";
120 }else if( strncmp(zCmd, "rebuild", n)==0 ){
@@ -107,77 +121,100 @@
121 zCmd = "rebuild";
122 }else if( strncmp(zCmd, "sync", n)==0 ){
123 zCmd = "sync -autourl -R";
124 }else if( strncmp(zCmd, "test-integrity", n)==0 ){
125 zCmd = "test-integrity";
126 }else if( strncmp(zCmd, "changes", n)==0 ){
127 zCmd = "changes --quiet --header --chdir";
128 useCheckouts = 1;
129 stopOnError = 0;
130 quiet = 1;
131 }else if( strncmp(zCmd, "ignore", n)==0 ){
132 int j;
133 verify_all_options();
134 db_begin_transaction();
135 for(j=3; j<g.argc; j++){
136 char *zSql = mprintf("DELETE FROM global_config"
137 " WHERE name GLOB 'repo:%q'", g.argv[j]);
138 if( testRun ){
139 fossil_print("%s\n", zSql);
140 }else{
141 db_multi_exec("%s", zSql);
142 }
143 fossil_free(zSql);
144 }
145 db_end_transaction(0);
146 return;
147 }else{
148 fossil_fatal("\"all\" subcommand should be one of: "
149 "changes ignore list ls push pull rebuild sync");
150 }
151 verify_all_options();
152 zFossil = quoteFilename(fossil_nameofexe());
153 if( useCheckouts ){
154 db_prepare(&q,
155 "SELECT substr(name, 7) COLLATE nocase, max(rowid)"
156 " FROM global_config"
157 " WHERE substr(name, 1, 6)=='ckout:'"
158 " GROUP BY 1 ORDER BY 1"
159 );
160 }else{
161 db_prepare(&q,
162 "SELECT substr(name, 6) COLLATE nocase, max(rowid)"
163 " FROM global_config"
164 " WHERE substr(name, 1, 5)=='repo:'"
165 " GROUP BY 1 ORDER BY 1"
166 );
167 }
168 bag_init(&outOfDate);
169 while( db_step(&q)==SQLITE_ROW ){
170 const char *zFilename = db_column_text(&q, 0);
171 int rowid = db_column_int(&q, 1);
172 if( file_access(zFilename, 0) || !file_is_canonical(zFilename) ){
173 bag_insert(&outOfDate, rowid);
174 continue;
175 }
176 if( useCheckouts && file_isdir(zFilename)!=1 ){
177 bag_insert(&outOfDate, rowid);
178 continue;
179 }
 
180 if( zCmd[0]=='l' ){
181 fossil_print("%s\n", zFilename);
182 continue;
183 }
184 zQFilename = quoteFilename(zFilename);
185 zSyscmd = mprintf("%s %s %s", zFossil, zCmd, zQFilename);
186 if( !quiet || testRun ){
187 fossil_print("%s\n", zSyscmd);
188 fflush(stdout);
189 }
190 rc = testRun ? 0 : fossil_system(zSyscmd);
191 free(zSyscmd);
192 free(zQFilename);
193 if( stopOnError && rc ){
 
194 break;
195 }
196 }
197 db_finalize(&q);
198
199 /* If any repositories whose names appear in the ~/.fossil file could not
200 ** be found, remove those names from the ~/.fossil file.
201 */
202 if( bag_count(&outOfDate)>0 ){
203 Blob sql;
204 char *zSep = "(";
205 int rowid;
206 blob_zero(&sql);
207 blob_appendf(&sql, "DELETE FROM global_config WHERE rowid IN ");
208 for(rowid=bag_first(&outOfDate); rowid>0; rowid=bag_next(&outOfDate,rowid)){
209 blob_appendf(&sql, "%s%d", zSep, rowid);
210 zSep = ",";
211 }
212 blob_appendf(&sql, ")");
213 if( testRun ){
214 fossil_print("%s\n", blob_str(&sql));
215 }else{
216 db_multi_exec(blob_str(&sql));
217 }
218 blob_reset(&sql);
219 }
 
 
 
 
 
 
220 }
221
--- src/checkin.c
+++ src/checkin.c
@@ -144,24 +144,35 @@
144144
** --abs-paths Display absolute pathnames.
145145
** --rel-paths Display pathnames relative to the current working
146146
** directory.
147147
** --sha1sum Verify file status using SHA1 hashing rather
148148
** than relying on file mtimes.
149
+** --header Identify the repository if there are changes
150
+** -v Say "no changes" if there are none
149151
**
150152
** See also: extra, ls, status
151153
*/
152154
void changes_cmd(void){
153155
Blob report;
154156
int vid;
155157
int useSha1sum = find_option("sha1sum", 0, 0)!=0;
158
+ int showHdr = find_option("header",0,0)!=0;
159
+ int verbose = find_option("verbose","v",0)!=0;
156160
int cwdRelative = 0;
157161
db_must_be_within_tree();
158162
cwdRelative = determine_cwd_relative_option();
159163
blob_zero(&report);
160164
vid = db_lget_int("checkout", 0);
161165
vfile_check_signature(vid, 0, useSha1sum);
162166
status_report(&report, "", 0, cwdRelative);
167
+ if( verbose && blob_size(&report)==0 ){
168
+ blob_append(&report, " (none)\n", -1);
169
+ }
170
+ if( showHdr && blob_size(&report)>0 ){
171
+ fossil_print("Changes for %s at %s:\n", db_get("project-name","???"),
172
+ g.zLocalRoot);
173
+ }
163174
blob_write_to_file(&report, "-");
164175
}
165176
166177
/*
167178
** COMMAND: status
168179
--- src/checkin.c
+++ src/checkin.c
@@ -144,24 +144,35 @@
144 ** --abs-paths Display absolute pathnames.
145 ** --rel-paths Display pathnames relative to the current working
146 ** directory.
147 ** --sha1sum Verify file status using SHA1 hashing rather
148 ** than relying on file mtimes.
 
 
149 **
150 ** See also: extra, ls, status
151 */
152 void changes_cmd(void){
153 Blob report;
154 int vid;
155 int useSha1sum = find_option("sha1sum", 0, 0)!=0;
 
 
156 int cwdRelative = 0;
157 db_must_be_within_tree();
158 cwdRelative = determine_cwd_relative_option();
159 blob_zero(&report);
160 vid = db_lget_int("checkout", 0);
161 vfile_check_signature(vid, 0, useSha1sum);
162 status_report(&report, "", 0, cwdRelative);
 
 
 
 
 
 
 
163 blob_write_to_file(&report, "-");
164 }
165
166 /*
167 ** COMMAND: status
168
--- src/checkin.c
+++ src/checkin.c
@@ -144,24 +144,35 @@
144 ** --abs-paths Display absolute pathnames.
145 ** --rel-paths Display pathnames relative to the current working
146 ** directory.
147 ** --sha1sum Verify file status using SHA1 hashing rather
148 ** than relying on file mtimes.
149 ** --header Identify the repository if there are changes
150 ** -v Say "no changes" if there are none
151 **
152 ** See also: extra, ls, status
153 */
154 void changes_cmd(void){
155 Blob report;
156 int vid;
157 int useSha1sum = find_option("sha1sum", 0, 0)!=0;
158 int showHdr = find_option("header",0,0)!=0;
159 int verbose = find_option("verbose","v",0)!=0;
160 int cwdRelative = 0;
161 db_must_be_within_tree();
162 cwdRelative = determine_cwd_relative_option();
163 blob_zero(&report);
164 vid = db_lget_int("checkout", 0);
165 vfile_check_signature(vid, 0, useSha1sum);
166 status_report(&report, "", 0, cwdRelative);
167 if( verbose && blob_size(&report)==0 ){
168 blob_append(&report, " (none)\n", -1);
169 }
170 if( showHdr && blob_size(&report)>0 ){
171 fossil_print("Changes for %s at %s:\n", db_get("project-name","???"),
172 g.zLocalRoot);
173 }
174 blob_write_to_file(&report, "-");
175 }
176
177 /*
178 ** COMMAND: status
179
+6 -2
--- src/main.c
+++ src/main.c
@@ -451,10 +451,11 @@
451451
" or: %s help -- for a list of common commands\n"
452452
" or: %s help COMMMAND -- for help with the named command\n",
453453
argv[0], argv[0], argv[0]);
454454
fossil_exit(1);
455455
}else{
456
+ const char *zChdir = find_option("chdir",0,1);
456457
g.isHTTP = 0;
457458
g.fQuiet = find_option("quiet", 0, 0)!=0;
458459
g.fSqlTrace = find_option("sqltrace", 0, 0)!=0;
459460
g.fSqlStats = find_option("sqlstats", 0, 0)!=0;
460461
g.fSystemTrace = find_option("systemtrace", 0, 0)!=0;
@@ -461,10 +462,13 @@
461462
if( g.fSqlTrace ) g.fSqlStats = 1;
462463
g.fSqlPrint = find_option("sqlprint", 0, 0)!=0;
463464
g.fHttpTrace = find_option("httptrace", 0, 0)!=0;
464465
g.zLogin = find_option("user", "U", 1);
465466
g.zSSLIdentity = find_option("ssl-identity", 0, 1);
467
+ if( zChdir && chdir(zChdir) ){
468
+ fossil_fatal("unable to change directories to %s", zChdir);
469
+ }
466470
if( find_option("help",0,0)!=0 ){
467471
/* --help anywhere on the command line is translated into
468472
** "fossil help argv[1] argv[2]..." */
469473
int i;
470474
char **zNewArgv = fossil_malloc( sizeof(char*)*(g.argc+2) );
@@ -556,11 +560,11 @@
556560
{
557561
if( g.cgiOutput && once ){
558562
once = 0;
559563
cgi_printf("<p class=\"generalError\">%h</p>", z);
560564
cgi_reply();
561
- }else{
565
+ }else if( !g.fQuiet ){
562566
char *zOut = mprintf("%s: %s\n", fossil_nameofexe(), z);
563567
fossil_puts(zOut, 1);
564568
}
565569
}
566570
free(z);
@@ -588,11 +592,11 @@
588592
{
589593
if( g.cgiOutput ){
590594
g.cgiOutput = 0;
591595
cgi_printf("<p class=\"generalError\">%h</p>", z);
592596
cgi_reply();
593
- }else{
597
+ }else if( !g.fQuiet ){
594598
char *zOut = mprintf("\r%s: %s\n", fossil_nameofexe(), z);
595599
fossil_puts(zOut, 1);
596600
}
597601
}
598602
free(z);
599603
--- src/main.c
+++ src/main.c
@@ -451,10 +451,11 @@
451 " or: %s help -- for a list of common commands\n"
452 " or: %s help COMMMAND -- for help with the named command\n",
453 argv[0], argv[0], argv[0]);
454 fossil_exit(1);
455 }else{
 
456 g.isHTTP = 0;
457 g.fQuiet = find_option("quiet", 0, 0)!=0;
458 g.fSqlTrace = find_option("sqltrace", 0, 0)!=0;
459 g.fSqlStats = find_option("sqlstats", 0, 0)!=0;
460 g.fSystemTrace = find_option("systemtrace", 0, 0)!=0;
@@ -461,10 +462,13 @@
461 if( g.fSqlTrace ) g.fSqlStats = 1;
462 g.fSqlPrint = find_option("sqlprint", 0, 0)!=0;
463 g.fHttpTrace = find_option("httptrace", 0, 0)!=0;
464 g.zLogin = find_option("user", "U", 1);
465 g.zSSLIdentity = find_option("ssl-identity", 0, 1);
 
 
 
466 if( find_option("help",0,0)!=0 ){
467 /* --help anywhere on the command line is translated into
468 ** "fossil help argv[1] argv[2]..." */
469 int i;
470 char **zNewArgv = fossil_malloc( sizeof(char*)*(g.argc+2) );
@@ -556,11 +560,11 @@
556 {
557 if( g.cgiOutput && once ){
558 once = 0;
559 cgi_printf("<p class=\"generalError\">%h</p>", z);
560 cgi_reply();
561 }else{
562 char *zOut = mprintf("%s: %s\n", fossil_nameofexe(), z);
563 fossil_puts(zOut, 1);
564 }
565 }
566 free(z);
@@ -588,11 +592,11 @@
588 {
589 if( g.cgiOutput ){
590 g.cgiOutput = 0;
591 cgi_printf("<p class=\"generalError\">%h</p>", z);
592 cgi_reply();
593 }else{
594 char *zOut = mprintf("\r%s: %s\n", fossil_nameofexe(), z);
595 fossil_puts(zOut, 1);
596 }
597 }
598 free(z);
599
--- src/main.c
+++ src/main.c
@@ -451,10 +451,11 @@
451 " or: %s help -- for a list of common commands\n"
452 " or: %s help COMMMAND -- for help with the named command\n",
453 argv[0], argv[0], argv[0]);
454 fossil_exit(1);
455 }else{
456 const char *zChdir = find_option("chdir",0,1);
457 g.isHTTP = 0;
458 g.fQuiet = find_option("quiet", 0, 0)!=0;
459 g.fSqlTrace = find_option("sqltrace", 0, 0)!=0;
460 g.fSqlStats = find_option("sqlstats", 0, 0)!=0;
461 g.fSystemTrace = find_option("systemtrace", 0, 0)!=0;
@@ -461,10 +462,13 @@
462 if( g.fSqlTrace ) g.fSqlStats = 1;
463 g.fSqlPrint = find_option("sqlprint", 0, 0)!=0;
464 g.fHttpTrace = find_option("httptrace", 0, 0)!=0;
465 g.zLogin = find_option("user", "U", 1);
466 g.zSSLIdentity = find_option("ssl-identity", 0, 1);
467 if( zChdir && chdir(zChdir) ){
468 fossil_fatal("unable to change directories to %s", zChdir);
469 }
470 if( find_option("help",0,0)!=0 ){
471 /* --help anywhere on the command line is translated into
472 ** "fossil help argv[1] argv[2]..." */
473 int i;
474 char **zNewArgv = fossil_malloc( sizeof(char*)*(g.argc+2) );
@@ -556,11 +560,11 @@
560 {
561 if( g.cgiOutput && once ){
562 once = 0;
563 cgi_printf("<p class=\"generalError\">%h</p>", z);
564 cgi_reply();
565 }else if( !g.fQuiet ){
566 char *zOut = mprintf("%s: %s\n", fossil_nameofexe(), z);
567 fossil_puts(zOut, 1);
568 }
569 }
570 free(z);
@@ -588,11 +592,11 @@
592 {
593 if( g.cgiOutput ){
594 g.cgiOutput = 0;
595 cgi_printf("<p class=\"generalError\">%h</p>", z);
596 cgi_reply();
597 }else if( !g.fQuiet ){
598 char *zOut = mprintf("\r%s: %s\n", fossil_nameofexe(), z);
599 fossil_puts(zOut, 1);
600 }
601 }
602 free(z);
603

Keyboard Shortcuts

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