Fossil SCM

Online help for several commands edited - as found in allrepo.c, bisect.c, branch.c and checkin.c. Note: "commit" still to be edited

Arjen Markus 2011-04-26 06:37 arjen-doc-updates
Commit e66fe70c7f7063af47f3a25aa502b7eaa13d4cf5
+10 -2
--- src/allrepo.c
+++ src/allrepo.c
@@ -54,10 +54,13 @@
5454
** Usage: %fossil all (list|ls|pull|push|rebuild|sync)
5555
**
5656
** The ~/.fossil file records the location of all repositories for a
5757
** user. This command performs certain operations on all repositories
5858
** that can be useful before or after a period of disconnected operation.
59
+**
60
+** The rebuild subcommand is especially useful if the repositories were built
61
+** with an older version of fossil.
5962
**
6063
** On Win32 systems, the file is named "_fossil" and is located in
6164
** %LOCALAPPDATA%, %APPDATA% or %HOMEPATH%.
6265
**
6366
** Available operations are:
@@ -77,10 +80,15 @@
7780
**
7881
** Respositories are automatically added to the set of known repositories
7982
** when one of the following commands against the repository: clone, info,
8083
** pull, push, or sync. Even previously ignored repositories are added back
8184
** to the list of repositories by these commands.
85
+**
86
+**
87
+** SUMMARY: fossil all subcommand|subcommand repository1 ?repository2 ...?
88
+** Subcommands: list, ls, pull push, rebuild or sync
89
+** Or: ignore repository1 ...
8290
*/
8391
void all_cmd(void){
8492
int n;
8593
Stmt q;
8694
const char *zCmd;
@@ -88,11 +96,11 @@
8896
char *zFossil;
8997
char *zQFilename;
9098
int nMissing;
9199
int stopOnError = find_option("dontstop",0,0)==0;
92100
int rc;
93
-
101
+
94102
if( g.argc<3 ){
95103
usage("list|ls|pull|push|rebuild|sync");
96104
}
97105
n = strlen(g.argv[2]);
98106
db_open_config(1);
@@ -150,11 +158,11 @@
150158
if( stopOnError && rc ){
151159
nMissing = 0;
152160
break;
153161
}
154162
}
155
-
163
+
156164
/* If any repositories whose names appear in the ~/.fossil file could not
157165
** be found, remove those names from the ~/.fossil file.
158166
*/
159167
if( nMissing ){
160168
db_begin_transaction();
161169
--- src/allrepo.c
+++ src/allrepo.c
@@ -54,10 +54,13 @@
54 ** Usage: %fossil all (list|ls|pull|push|rebuild|sync)
55 **
56 ** The ~/.fossil file records the location of all repositories for a
57 ** user. This command performs certain operations on all repositories
58 ** that can be useful before or after a period of disconnected operation.
 
 
 
59 **
60 ** On Win32 systems, the file is named "_fossil" and is located in
61 ** %LOCALAPPDATA%, %APPDATA% or %HOMEPATH%.
62 **
63 ** Available operations are:
@@ -77,10 +80,15 @@
77 **
78 ** Respositories are automatically added to the set of known repositories
79 ** when one of the following commands against the repository: clone, info,
80 ** pull, push, or sync. Even previously ignored repositories are added back
81 ** to the list of repositories by these commands.
 
 
 
 
 
82 */
83 void all_cmd(void){
84 int n;
85 Stmt q;
86 const char *zCmd;
@@ -88,11 +96,11 @@
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);
@@ -150,11 +158,11 @@
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
--- src/allrepo.c
+++ src/allrepo.c
@@ -54,10 +54,13 @@
54 ** Usage: %fossil all (list|ls|pull|push|rebuild|sync)
55 **
56 ** The ~/.fossil file records the location of all repositories for a
57 ** user. This command performs certain operations on all repositories
58 ** that can be useful before or after a period of disconnected operation.
59 **
60 ** The rebuild subcommand is especially useful if the repositories were built
61 ** with an older version of fossil.
62 **
63 ** On Win32 systems, the file is named "_fossil" and is located in
64 ** %LOCALAPPDATA%, %APPDATA% or %HOMEPATH%.
65 **
66 ** Available operations are:
@@ -77,10 +80,15 @@
80 **
81 ** Respositories are automatically added to the set of known repositories
82 ** when one of the following commands against the repository: clone, info,
83 ** pull, push, or sync. Even previously ignored repositories are added back
84 ** to the list of repositories by these commands.
85 **
86 **
87 ** SUMMARY: fossil all subcommand|subcommand repository1 ?repository2 ...?
88 ** Subcommands: list, ls, pull push, rebuild or sync
89 ** Or: ignore repository1 ...
90 */
91 void all_cmd(void){
92 int n;
93 Stmt q;
94 const char *zCmd;
@@ -88,11 +96,11 @@
96 char *zFossil;
97 char *zQFilename;
98 int nMissing;
99 int stopOnError = find_option("dontstop",0,0)==0;
100 int rc;
101
102 if( g.argc<3 ){
103 usage("list|ls|pull|push|rebuild|sync");
104 }
105 n = strlen(g.argv[2]);
106 db_open_config(1);
@@ -150,11 +158,11 @@
158 if( stopOnError && rc ){
159 nMissing = 0;
160 break;
161 }
162 }
163
164 /* If any repositories whose names appear in the ~/.fossil file could not
165 ** be found, remove those names from the ~/.fossil file.
166 */
167 if( nMissing ){
168 db_begin_transaction();
169
+8 -1
--- src/bisect.c
+++ src/bisect.c
@@ -91,11 +91,13 @@
9191
/*
9292
** COMMAND: bisect
9393
**
9494
** Usage: %fossil bisect SUBCOMMAND ...
9595
**
96
-** Run various subcommands useful for searching for bugs.
96
+** Run various subcommands useful for searching for bugs. It does so
97
+** by marking versions as "good" and "bad" and allowing you to "interpolate"
98
+** as it were between these two versions.
9799
**
98100
** fossil bisect bad ?VERSION?
99101
**
100102
** Identify version VERSION as non-working. If VERSION is omitted,
101103
** the current checkout is marked as non-working.
@@ -121,10 +123,15 @@
121123
** and allows a bisect session to start over from the beginning.
122124
**
123125
** fossil bisect vlist
124126
**
125127
** List the versions in between "bad" and "good".
128
+**
129
+** SUMMARY: fossil bisect subcommand ...
130
+** Subcommands: bad, good ?VERSION?
131
+** Or: next, reset, vlist
132
+** Or: options ?NAME? ?VALUE?
126133
*/
127134
void bisect_cmd(void){
128135
int n;
129136
const char *zCmd;
130137
db_must_be_within_tree();
131138
--- src/bisect.c
+++ src/bisect.c
@@ -91,11 +91,13 @@
91 /*
92 ** COMMAND: bisect
93 **
94 ** Usage: %fossil bisect SUBCOMMAND ...
95 **
96 ** Run various subcommands useful for searching for bugs.
 
 
97 **
98 ** fossil bisect bad ?VERSION?
99 **
100 ** Identify version VERSION as non-working. If VERSION is omitted,
101 ** the current checkout is marked as non-working.
@@ -121,10 +123,15 @@
121 ** and allows a bisect session to start over from the beginning.
122 **
123 ** fossil bisect vlist
124 **
125 ** List the versions in between "bad" and "good".
 
 
 
 
 
126 */
127 void bisect_cmd(void){
128 int n;
129 const char *zCmd;
130 db_must_be_within_tree();
131
--- src/bisect.c
+++ src/bisect.c
@@ -91,11 +91,13 @@
91 /*
92 ** COMMAND: bisect
93 **
94 ** Usage: %fossil bisect SUBCOMMAND ...
95 **
96 ** Run various subcommands useful for searching for bugs. It does so
97 ** by marking versions as "good" and "bad" and allowing you to "interpolate"
98 ** as it were between these two versions.
99 **
100 ** fossil bisect bad ?VERSION?
101 **
102 ** Identify version VERSION as non-working. If VERSION is omitted,
103 ** the current checkout is marked as non-working.
@@ -121,10 +123,15 @@
123 ** and allows a bisect session to start over from the beginning.
124 **
125 ** fossil bisect vlist
126 **
127 ** List the versions in between "bad" and "good".
128 **
129 ** SUMMARY: fossil bisect subcommand ...
130 ** Subcommands: bad, good ?VERSION?
131 ** Or: next, reset, vlist
132 ** Or: options ?NAME? ?VALUE?
133 */
134 void bisect_cmd(void){
135 int n;
136 const char *zCmd;
137 db_must_be_within_tree();
138
+11 -6
--- src/branch.c
+++ src/branch.c
@@ -40,23 +40,23 @@
4040
Manifest *pParent; /* Parsed parent manifest */
4141
Blob mcksum; /* Self-checksum on the manifest */
4242
const char *zDateOvrd; /* Override date string */
4343
const char *zUserOvrd; /* Override user name */
4444
int isPrivate = 0; /* True if the branch should be private */
45
-
45
+
4646
noSign = find_option("nosign","",0)!=0;
4747
zColor = find_option("bgcolor","c",1);
4848
isPrivate = find_option("private",0,0)!=0;
4949
zDateOvrd = find_option("date-override",0,1);
5050
zUserOvrd = find_option("user-override",0,1);
5151
verify_all_options();
5252
if( g.argc<5 ){
5353
usage("new BRANCH-NAME CHECK-IN ?-bgcolor COLOR?");
5454
}
55
- db_find_and_open_repository(0, 0);
55
+ db_find_and_open_repository(0, 0);
5656
noSign = db_get_int("omitsign", 0)|noSign;
57
-
57
+
5858
/* fossil branch new name */
5959
zBranch = g.argv[3];
6060
if( zBranch==0 || zBranch[0]==0 ){
6161
fossil_panic("branch name cannot be empty");
6262
}
@@ -132,11 +132,11 @@
132132
while( db_step(&q)==SQLITE_ROW ){
133133
const char *zTag = db_column_text(&q, 0);
134134
blob_appendf(&branch, "T -%F *\n", zTag);
135135
}
136136
db_finalize(&q);
137
-
137
+
138138
blob_appendf(&branch, "U %F\n", zUserOvrd ? zUserOvrd : g.zLogin);
139139
md5sum_blob(&branch, &mcksum);
140140
blob_appendf(&branch, "Z %b\n", &mcksum);
141141
if( !noSign && clearsign(&branch, &branch) ){
142142
Blob ans;
@@ -172,11 +172,11 @@
172172
}
173173
174174
175175
/* Commit */
176176
db_end_transaction(0);
177
-
177
+
178178
/* Do an autosync push, if requested */
179179
autosync(AUTOSYNC_PUSH);
180180
}
181181
182182
/*
@@ -196,10 +196,15 @@
196196
** %fossil branch list
197197
** %fossil branch ls
198198
**
199199
** List all branches
200200
**
201
+**
202
+** SUMMARY: fossil branch subcommand ...
203
+** Subcommands: new branchname basis ?-R|-repository file? ?--bgcolor color?
204
+** ?--private?
205
+** Or: list, ls
201206
*/
202207
void branch_cmd(void){
203208
int n;
204209
const char *zCmd = "list";
205210
db_find_and_open_repository(0, 0);
@@ -322,11 +327,11 @@
322327
** to the end of the line.
323328
*/
324329
static void brtimeline_extra(int rid){
325330
Stmt q;
326331
if( !g.okHistory ) return;
327
- db_prepare(&q,
332
+ db_prepare(&q,
328333
"SELECT substr(tagname,5) FROM tagxref, tag"
329334
" WHERE tagxref.rid=%d"
330335
" AND tagxref.tagid=tag.tagid"
331336
" AND tagxref.tagtype>0"
332337
" AND tag.tagname GLOB 'sym-*'",
333338
--- src/branch.c
+++ src/branch.c
@@ -40,23 +40,23 @@
40 Manifest *pParent; /* Parsed parent manifest */
41 Blob mcksum; /* Self-checksum on the manifest */
42 const char *zDateOvrd; /* Override date string */
43 const char *zUserOvrd; /* Override user name */
44 int isPrivate = 0; /* True if the branch should be private */
45
46 noSign = find_option("nosign","",0)!=0;
47 zColor = find_option("bgcolor","c",1);
48 isPrivate = find_option("private",0,0)!=0;
49 zDateOvrd = find_option("date-override",0,1);
50 zUserOvrd = find_option("user-override",0,1);
51 verify_all_options();
52 if( g.argc<5 ){
53 usage("new BRANCH-NAME CHECK-IN ?-bgcolor COLOR?");
54 }
55 db_find_and_open_repository(0, 0);
56 noSign = db_get_int("omitsign", 0)|noSign;
57
58 /* fossil branch new name */
59 zBranch = g.argv[3];
60 if( zBranch==0 || zBranch[0]==0 ){
61 fossil_panic("branch name cannot be empty");
62 }
@@ -132,11 +132,11 @@
132 while( db_step(&q)==SQLITE_ROW ){
133 const char *zTag = db_column_text(&q, 0);
134 blob_appendf(&branch, "T -%F *\n", zTag);
135 }
136 db_finalize(&q);
137
138 blob_appendf(&branch, "U %F\n", zUserOvrd ? zUserOvrd : g.zLogin);
139 md5sum_blob(&branch, &mcksum);
140 blob_appendf(&branch, "Z %b\n", &mcksum);
141 if( !noSign && clearsign(&branch, &branch) ){
142 Blob ans;
@@ -172,11 +172,11 @@
172 }
173
174
175 /* Commit */
176 db_end_transaction(0);
177
178 /* Do an autosync push, if requested */
179 autosync(AUTOSYNC_PUSH);
180 }
181
182 /*
@@ -196,10 +196,15 @@
196 ** %fossil branch list
197 ** %fossil branch ls
198 **
199 ** List all branches
200 **
 
 
 
 
 
201 */
202 void branch_cmd(void){
203 int n;
204 const char *zCmd = "list";
205 db_find_and_open_repository(0, 0);
@@ -322,11 +327,11 @@
322 ** to the end of the line.
323 */
324 static void brtimeline_extra(int rid){
325 Stmt q;
326 if( !g.okHistory ) return;
327 db_prepare(&q,
328 "SELECT substr(tagname,5) FROM tagxref, tag"
329 " WHERE tagxref.rid=%d"
330 " AND tagxref.tagid=tag.tagid"
331 " AND tagxref.tagtype>0"
332 " AND tag.tagname GLOB 'sym-*'",
333
--- src/branch.c
+++ src/branch.c
@@ -40,23 +40,23 @@
40 Manifest *pParent; /* Parsed parent manifest */
41 Blob mcksum; /* Self-checksum on the manifest */
42 const char *zDateOvrd; /* Override date string */
43 const char *zUserOvrd; /* Override user name */
44 int isPrivate = 0; /* True if the branch should be private */
45
46 noSign = find_option("nosign","",0)!=0;
47 zColor = find_option("bgcolor","c",1);
48 isPrivate = find_option("private",0,0)!=0;
49 zDateOvrd = find_option("date-override",0,1);
50 zUserOvrd = find_option("user-override",0,1);
51 verify_all_options();
52 if( g.argc<5 ){
53 usage("new BRANCH-NAME CHECK-IN ?-bgcolor COLOR?");
54 }
55 db_find_and_open_repository(0, 0);
56 noSign = db_get_int("omitsign", 0)|noSign;
57
58 /* fossil branch new name */
59 zBranch = g.argv[3];
60 if( zBranch==0 || zBranch[0]==0 ){
61 fossil_panic("branch name cannot be empty");
62 }
@@ -132,11 +132,11 @@
132 while( db_step(&q)==SQLITE_ROW ){
133 const char *zTag = db_column_text(&q, 0);
134 blob_appendf(&branch, "T -%F *\n", zTag);
135 }
136 db_finalize(&q);
137
138 blob_appendf(&branch, "U %F\n", zUserOvrd ? zUserOvrd : g.zLogin);
139 md5sum_blob(&branch, &mcksum);
140 blob_appendf(&branch, "Z %b\n", &mcksum);
141 if( !noSign && clearsign(&branch, &branch) ){
142 Blob ans;
@@ -172,11 +172,11 @@
172 }
173
174
175 /* Commit */
176 db_end_transaction(0);
177
178 /* Do an autosync push, if requested */
179 autosync(AUTOSYNC_PUSH);
180 }
181
182 /*
@@ -196,10 +196,15 @@
196 ** %fossil branch list
197 ** %fossil branch ls
198 **
199 ** List all branches
200 **
201 **
202 ** SUMMARY: fossil branch subcommand ...
203 ** Subcommands: new branchname basis ?-R|-repository file? ?--bgcolor color?
204 ** ?--private?
205 ** Or: list, ls
206 */
207 void branch_cmd(void){
208 int n;
209 const char *zCmd = "list";
210 db_find_and_open_repository(0, 0);
@@ -322,11 +327,11 @@
327 ** to the end of the line.
328 */
329 static void brtimeline_extra(int rid){
330 Stmt q;
331 if( !g.okHistory ) return;
332 db_prepare(&q,
333 "SELECT substr(tagname,5) FROM tagxref, tag"
334 " WHERE tagxref.rid=%d"
335 " AND tagxref.tagid=tag.tagid"
336 " AND tagxref.tagtype>0"
337 " AND tag.tagname GLOB 'sym-*'",
338
+45 -26
--- src/checkin.c
+++ src/checkin.c
@@ -37,11 +37,11 @@
3737
int missingIsFatal /* MISSING and NOT_A_FILE are fatal errors */
3838
){
3939
Stmt q;
4040
int nPrefix = strlen(zPrefix);
4141
int nErr = 0;
42
- db_prepare(&q,
42
+ db_prepare(&q,
4343
"SELECT pathname, deleted, chnged, rid, coalesce(origname!=pathname,0)"
4444
" FROM vfile "
4545
" WHERE file_is_selected(id)"
4646
" AND (chnged OR deleted OR rid=0 OR pathname!=origname) ORDER BY 1"
4747
);
@@ -107,10 +107,13 @@
107107
**
108108
** Options:
109109
**
110110
** --sha1sum Verify file status using SHA1 hashing rather
111111
** than relying on file mtimes.
112
+**
113
+**
114
+** SUMMARY: fossil changes ?--sha1sum?
112115
*/
113116
void changes_cmd(void){
114117
Blob report;
115118
int vid;
116119
int useSha1sum = find_option("sha1sum", 0, 0)!=0;
@@ -131,10 +134,13 @@
131134
**
132135
** Options:
133136
**
134137
** --sha1sum Verify file status using SHA1 hashing rather
135138
** than relying on file mtimes.
139
+**
140
+**
141
+** SUMMARY: fossil status ?--sha1sum?
136142
*/
137143
void status_cmd(void){
138144
int vid;
139145
db_must_be_within_tree();
140146
/* 012345678901234 */
@@ -153,10 +159,13 @@
153159
**
154160
** Usage: %fossil ls [-l]
155161
**
156162
** Show the names of all files in the current checkout. The -l provides
157163
** extra information about each file.
164
+**
165
+**
166
+** SUMMARY: fossil ls ?-l?
158167
*/
159168
void ls_cmd(void){
160169
int vid;
161170
Stmt q;
162171
int isBrief;
@@ -257,19 +266,23 @@
257266
258267
/*
259268
** COMMAND: extras
260269
** Usage: %fossil extras ?--dotfiles? ?--ignore GLOBPATTERN?
261270
**
262
-** Print a list of all files in the source tree that are not part of
271
+** Print a list of all files in the source tree that are NOT part of
263272
** the current checkout. See also the "clean" command.
264273
**
265274
** Files and subdirectories whose names begin with "." are normally
266275
** ignored but can be included by adding the --dotfiles option.
267276
**
268277
** The GLOBPATTERN is a comma-separated list of GLOB expressions for
269278
** files that are ignored. The GLOBPATTERN specified by the "ignore-glob"
270
-** is used if the --ignore option is omitted.
279
+** setting is used if the --ignore option is omitted. (See the settings
280
+** command for more information.)
281
+**
282
+**
283
+** SUMMARY: fossil extras ?-dotfiles? ?--ignore globpattern?
271284
*/
272285
void extra_cmd(void){
273286
Blob path;
274287
Blob repo;
275288
Stmt q;
@@ -285,11 +298,11 @@
285298
blob_init(&path, g.zLocalRoot, n-1);
286299
if( zIgnoreFlag==0 ){
287300
zIgnoreFlag = db_get("ignore-glob", 0);
288301
}
289302
vfile_scan(0, &path, blob_size(&path), allFlag);
290
- db_prepare(&q,
303
+ db_prepare(&q,
291304
"SELECT x FROM sfile"
292305
" WHERE x NOT IN (%s)"
293306
" AND NOT %s"
294307
" ORDER BY 1",
295308
fossil_all_reserved_names(),
@@ -308,23 +321,29 @@
308321
** COMMAND: clean
309322
** Usage: %fossil clean ?--force? ?--dotfiles? ?--ignore GLOBPATTERN?
310323
**
311324
** Delete all "extra" files in the source tree. "Extra" files are
312325
** files that are not officially part of the checkout. See also
313
-** the "extra" command. This operation cannot be undone.
326
+** the "extras" command.
327
+**
328
+** TAKE CARE: This operation cannot be undone!
314329
**
315330
** You will be prompted before removing each file. If you are
316331
** sure you wish to remove all "extra" files you can specify the
317
-** optional --force flag and no prompts will be issued.
332
+** --force flag and no prompts will be issued.
318333
**
319334
** Files and subdirectories whose names begin with "." are
320335
** normally ignored. They are included if the "--dotfiles" option
321336
** is used.
322337
**
323338
** The GLOBPATTERN is a comma-separated list of GLOB expressions for
324339
** files that are ignored. The GLOBPATTERN specified by the "ignore-glob"
325
-** is used if the --ignore option is omitted.
340
+** setting is used if the --ignore option is omitted. (See the settings
341
+** command for more information.)
342
+**
343
+**
344
+** SUMMARY: fossil clean ?--force? ?--dotfiles? ?--ignore globpattern?
326345
*/
327346
void clean_cmd(void){
328347
int allFlag;
329348
int dotfilesFlag;
330349
const char *zIgnoreFlag;
@@ -340,11 +359,11 @@
340359
}
341360
db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY)");
342361
n = strlen(g.zLocalRoot);
343362
blob_init(&path, g.zLocalRoot, n-1);
344363
vfile_scan(0, &path, blob_size(&path), dotfilesFlag);
345
- db_prepare(&q,
364
+ db_prepare(&q,
346365
"SELECT %Q || x FROM sfile"
347366
" WHERE x NOT IN (%s) AND NOT %s"
348367
" ORDER BY 1",
349368
g.zLocalRoot, fossil_all_reserved_names(), glob_expr("x",zIgnoreFlag)
350369
);
@@ -517,15 +536,15 @@
517536
}
518537
}
519538
520539
/*
521540
** Return true if the check-in with RID=rid is a leaf.
522
-** A leaf has no children in the same branch.
541
+** A leaf has no children in the same branch.
523542
*/
524543
int is_a_leaf(int rid){
525544
int rc;
526
- static const char zSql[] =
545
+ static const char zSql[] =
527546
@ SELECT 1 FROM plink
528547
@ WHERE pid=%d
529548
@ AND coalesce((SELECT value FROM tagxref
530549
@ WHERE tagid=%d AND rid=plink.pid), 'trunk')
531550
@ =coalesce((SELECT value FROM tagxref
@@ -559,11 +578,11 @@
559578
#endif
560579
}
561580
562581
/*
563582
** zDate should be a valid date string. Convert this string into the
564
-** format YYYY-MM-DDTHH:MM:SS. If the string is not a valid date,
583
+** format YYYY-MM-DDTHH:MM:SS. If the string is not a valid date,
565584
** print a fatal error and quit.
566585
*/
567586
char *date_in_standard_format(const char *zInputDate){
568587
char *zDate;
569588
zDate = db_text(0, "SELECT strftime('%%Y-%%m-%%dT%%H:%%M:%%f',%Q)",
@@ -641,11 +660,11 @@
641660
const char *zPerm;
642661
int cmp;
643662
#if !defined(_WIN32)
644663
/* For unix, extract the "executable" permission bit directly from
645664
** the filesystem. On windows, the "executable" bit is retained
646
- ** unchanged from the original.
665
+ ** unchanged from the original.
647666
*/
648667
blob_resize(&filename, nBasename);
649668
blob_append(&filename, zName, -1);
650669
isexe = file_isexe(blob_str(&filename));
651670
#endif
@@ -733,11 +752,11 @@
733752
while( db_step(&q)==SQLITE_ROW ){
734753
const char *zTag = db_column_text(&q, 0);
735754
blob_appendf(pOut, "T -%F *\n", zTag);
736755
}
737756
db_finalize(&q);
738
- }
757
+ }
739758
blob_appendf(pOut, "U %F\n", zUserOvrd ? zUserOvrd : g.zLogin);
740759
md5sum_blob(pOut, &mcksum);
741760
blob_appendf(pOut, "Z %b\n", &mcksum);
742761
if( pnFBcard ) *pnFBcard = nFBcard;
743762
}
@@ -776,11 +795,11 @@
776795
}
777796
if( nCrNl ){
778797
char c;
779798
file_relative_name(zFilename, &fname);
780799
blob_zero(&ans);
781
- zMsg = mprintf("%s contains CR/NL line endings; commit anyhow (y/N/a)?",
800
+ zMsg = mprintf("%s contains CR/NL line endings; commit anyhow (y/N/a)?",
782801
blob_str(&fname));
783802
prompt_user(zMsg, &ans);
784803
fossil_free(zMsg);
785804
c = blob_str(&ans)[0];
786805
if( c=='a' ){
@@ -800,11 +819,11 @@
800819
**
801820
** Usage: %fossil commit ?OPTIONS? ?FILE...?
802821
**
803822
** Create a new version containing all of the changes in the current
804823
** checkout. You will be prompted to enter a check-in comment unless
805
-** the comment has been specified on the command-line using "-m" or a
824
+** the comment has been specified on the command-line using "-m" or a
806825
** file containing the comment using -M. The editor defined in the
807826
** "editor" fossil option (see %fossil help set) will be used, or from
808827
** the "VISUAL" or "EDITOR" environment variables (in that order) if
809828
** no editor is set.
810829
**
@@ -834,11 +853,11 @@
834853
** --force|-f
835854
** --private
836855
** --baseline
837856
** --delta
838857
** --tag TAG-NAME
839
-**
858
+**
840859
*/
841860
void commit_cmd(void){
842861
int hasChanges; /* True if unsaved changes exist */
843862
int vid; /* blob-id of parent version */
844863
int nrid; /* blob-id of a modified file */
@@ -866,11 +885,11 @@
866885
Blob muuid; /* Manifest uuid */
867886
Blob cksum1, cksum2; /* Before and after commit checksums */
868887
Blob cksum1b; /* Checksum recorded in the manifest */
869888
int szD; /* Size of the delta manifest */
870889
int szB; /* Size of the baseline manifest */
871
-
890
+
872891
url_proxy_options();
873892
noSign = find_option("nosign",0,0)!=0;
874893
forceDelta = find_option("delta",0,0)!=0;
875894
forceBaseline = find_option("baseline",0,0)!=0;
876895
if( forceDelta && forceBaseline ){
@@ -960,11 +979,11 @@
960979
** Check that the user exists.
961980
*/
962981
if( !db_exists("SELECT 1 FROM user WHERE login=%Q", g.zLogin) ){
963982
fossil_fatal("no such user: %s", g.zLogin);
964983
}
965
-
984
+
966985
hasChanges = unsaved_changes();
967986
db_begin_transaction();
968987
db_record_repository_filename(0);
969988
if( hasChanges==0 && !isAMerge && !forceFlag ){
970989
fossil_fatal("nothing has changed");
@@ -975,11 +994,11 @@
975994
*/
976995
if( g.aCommitFile ){
977996
Blob unmodified;
978997
memset(&unmodified, 0, sizeof(Blob));
979998
blob_init(&unmodified, 0, 0);
980
- db_blob(&unmodified,
999
+ db_blob(&unmodified,
9811000
"SELECT pathname FROM vfile"
9821001
" WHERE chnged = 0 AND origname IS NULL AND file_is_selected(id)"
9831002
);
9841003
if( strlen(blob_str(&unmodified)) ){
9851004
fossil_fatal("file %s has not changed", blob_str(&unmodified));
@@ -993,11 +1012,11 @@
9931012
if( zBranch==0 && forceFlag==0 && g.markPrivate==0 && !is_a_leaf(vid) ){
9941013
fossil_fatal("would fork. \"update\" first or use -f or --force.");
9951014
}
9961015
9971016
/*
998
- ** Do not allow a commit against a closed leaf
1017
+ ** Do not allow a commit against a closed leaf
9991018
*/
10001019
if( db_exists("SELECT 1 FROM tagxref"
10011020
" WHERE tagid=%d AND rid=%d AND tagtype>0",
10021021
TAG_CLOSED, vid) ){
10031022
fossil_fatal("cannot commit against a closed leaf");
@@ -1026,11 +1045,11 @@
10261045
db_multi_exec("REPLACE INTO vvar VALUES('ci-comment',%B)", &comment);
10271046
db_end_transaction(0);
10281047
db_begin_transaction();
10291048
}
10301049
1031
- /* Step 1: Insert records for all modified files into the blob
1050
+ /* Step 1: Insert records for all modified files into the blob
10321051
** table. If there were arguments passed to this command, only
10331052
** the identified fils are inserted (if they have been modified).
10341053
*/
10351054
db_prepare(&q,
10361055
"SELECT id, %Q || pathname, mrid, %s FROM vfile "
@@ -1128,11 +1147,11 @@
11281147
fossil_exit(1);
11291148
}
11301149
}
11311150
11321151
/* If the --test option is specified, output the manifest file
1133
- ** and rollback the transaction.
1152
+ ** and rollback the transaction.
11341153
*/
11351154
if( testRun ){
11361155
blob_write_to_file(&manifest, "");
11371156
}
11381157
@@ -1160,11 +1179,11 @@
11601179
blob_write_to_file(&muuid, zManifestFile);
11611180
free(zManifestFile);
11621181
blob_reset(&muuid);
11631182
}
11641183
1165
-
1184
+
11661185
/* Update the vfile and vmerge tables */
11671186
db_multi_exec(
11681187
"DELETE FROM vfile WHERE (vid!=%d OR deleted) AND file_is_selected(id);"
11691188
"DELETE FROM vmerge WHERE file_is_selected(id) OR id=0;"
11701189
"UPDATE vfile SET vid=%d;"
@@ -1184,11 +1203,11 @@
11841203
vfile_compare_repository_to_disk(nvid);
11851204
fossil_fatal("working checkout does not match what would have ended "
11861205
"up in the repository: %b versus %b",
11871206
&cksum1, &cksum2);
11881207
}
1189
-
1208
+
11901209
/* Verify that the manifest checksum matches the expected checksum */
11911210
vfile_aggregate_checksum_manifest(nvid, &cksum2, &cksum1b);
11921211
if( blob_compare(&cksum1, &cksum1b) ){
11931212
fossil_fatal("manifest checksum self-test failed: "
11941213
"%b versus %b", &cksum1, &cksum1b);
@@ -1196,11 +1215,11 @@
11961215
if( blob_compare(&cksum1, &cksum2) ){
11971216
fossil_fatal(
11981217
"working checkout does not match manifest after commit: "
11991218
"%b versus %b", &cksum1, &cksum2);
12001219
}
1201
-
1220
+
12021221
/* Verify that the commit did not modify any disk images. */
12031222
vfile_aggregate_checksum_disk(nvid, &cksum2);
12041223
if( blob_compare(&cksum1, &cksum2) ){
12051224
fossil_fatal("working checkout before and after commit does not match");
12061225
}
@@ -1216,11 +1235,11 @@
12161235
exit(1);
12171236
}
12181237
db_end_transaction(0);
12191238
12201239
if( !g.markPrivate ){
1221
- autosync(AUTOSYNC_PUSH);
1240
+ autosync(AUTOSYNC_PUSH);
12221241
}
12231242
if( count_nonbranch_children(vid)>1 ){
12241243
printf("**** warning: a fork has occurred *****\n");
12251244
}
12261245
}
12271246
--- src/checkin.c
+++ src/checkin.c
@@ -37,11 +37,11 @@
37 int missingIsFatal /* MISSING and NOT_A_FILE are fatal errors */
38 ){
39 Stmt q;
40 int nPrefix = strlen(zPrefix);
41 int nErr = 0;
42 db_prepare(&q,
43 "SELECT pathname, deleted, chnged, rid, coalesce(origname!=pathname,0)"
44 " FROM vfile "
45 " WHERE file_is_selected(id)"
46 " AND (chnged OR deleted OR rid=0 OR pathname!=origname) ORDER BY 1"
47 );
@@ -107,10 +107,13 @@
107 **
108 ** Options:
109 **
110 ** --sha1sum Verify file status using SHA1 hashing rather
111 ** than relying on file mtimes.
 
 
 
112 */
113 void changes_cmd(void){
114 Blob report;
115 int vid;
116 int useSha1sum = find_option("sha1sum", 0, 0)!=0;
@@ -131,10 +134,13 @@
131 **
132 ** Options:
133 **
134 ** --sha1sum Verify file status using SHA1 hashing rather
135 ** than relying on file mtimes.
 
 
 
136 */
137 void status_cmd(void){
138 int vid;
139 db_must_be_within_tree();
140 /* 012345678901234 */
@@ -153,10 +159,13 @@
153 **
154 ** Usage: %fossil ls [-l]
155 **
156 ** Show the names of all files in the current checkout. The -l provides
157 ** extra information about each file.
 
 
 
158 */
159 void ls_cmd(void){
160 int vid;
161 Stmt q;
162 int isBrief;
@@ -257,19 +266,23 @@
257
258 /*
259 ** COMMAND: extras
260 ** Usage: %fossil extras ?--dotfiles? ?--ignore GLOBPATTERN?
261 **
262 ** Print a list of all files in the source tree that are not part of
263 ** the current checkout. See also the "clean" command.
264 **
265 ** Files and subdirectories whose names begin with "." are normally
266 ** ignored but can be included by adding the --dotfiles option.
267 **
268 ** The GLOBPATTERN is a comma-separated list of GLOB expressions for
269 ** files that are ignored. The GLOBPATTERN specified by the "ignore-glob"
270 ** is used if the --ignore option is omitted.
 
 
 
 
271 */
272 void extra_cmd(void){
273 Blob path;
274 Blob repo;
275 Stmt q;
@@ -285,11 +298,11 @@
285 blob_init(&path, g.zLocalRoot, n-1);
286 if( zIgnoreFlag==0 ){
287 zIgnoreFlag = db_get("ignore-glob", 0);
288 }
289 vfile_scan(0, &path, blob_size(&path), allFlag);
290 db_prepare(&q,
291 "SELECT x FROM sfile"
292 " WHERE x NOT IN (%s)"
293 " AND NOT %s"
294 " ORDER BY 1",
295 fossil_all_reserved_names(),
@@ -308,23 +321,29 @@
308 ** COMMAND: clean
309 ** Usage: %fossil clean ?--force? ?--dotfiles? ?--ignore GLOBPATTERN?
310 **
311 ** Delete all "extra" files in the source tree. "Extra" files are
312 ** files that are not officially part of the checkout. See also
313 ** the "extra" command. This operation cannot be undone.
 
 
314 **
315 ** You will be prompted before removing each file. If you are
316 ** sure you wish to remove all "extra" files you can specify the
317 ** optional --force flag and no prompts will be issued.
318 **
319 ** Files and subdirectories whose names begin with "." are
320 ** normally ignored. They are included if the "--dotfiles" option
321 ** is used.
322 **
323 ** The GLOBPATTERN is a comma-separated list of GLOB expressions for
324 ** files that are ignored. The GLOBPATTERN specified by the "ignore-glob"
325 ** is used if the --ignore option is omitted.
 
 
 
 
326 */
327 void clean_cmd(void){
328 int allFlag;
329 int dotfilesFlag;
330 const char *zIgnoreFlag;
@@ -340,11 +359,11 @@
340 }
341 db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY)");
342 n = strlen(g.zLocalRoot);
343 blob_init(&path, g.zLocalRoot, n-1);
344 vfile_scan(0, &path, blob_size(&path), dotfilesFlag);
345 db_prepare(&q,
346 "SELECT %Q || x FROM sfile"
347 " WHERE x NOT IN (%s) AND NOT %s"
348 " ORDER BY 1",
349 g.zLocalRoot, fossil_all_reserved_names(), glob_expr("x",zIgnoreFlag)
350 );
@@ -517,15 +536,15 @@
517 }
518 }
519
520 /*
521 ** Return true if the check-in with RID=rid is a leaf.
522 ** A leaf has no children in the same branch.
523 */
524 int is_a_leaf(int rid){
525 int rc;
526 static const char zSql[] =
527 @ SELECT 1 FROM plink
528 @ WHERE pid=%d
529 @ AND coalesce((SELECT value FROM tagxref
530 @ WHERE tagid=%d AND rid=plink.pid), 'trunk')
531 @ =coalesce((SELECT value FROM tagxref
@@ -559,11 +578,11 @@
559 #endif
560 }
561
562 /*
563 ** zDate should be a valid date string. Convert this string into the
564 ** format YYYY-MM-DDTHH:MM:SS. If the string is not a valid date,
565 ** print a fatal error and quit.
566 */
567 char *date_in_standard_format(const char *zInputDate){
568 char *zDate;
569 zDate = db_text(0, "SELECT strftime('%%Y-%%m-%%dT%%H:%%M:%%f',%Q)",
@@ -641,11 +660,11 @@
641 const char *zPerm;
642 int cmp;
643 #if !defined(_WIN32)
644 /* For unix, extract the "executable" permission bit directly from
645 ** the filesystem. On windows, the "executable" bit is retained
646 ** unchanged from the original.
647 */
648 blob_resize(&filename, nBasename);
649 blob_append(&filename, zName, -1);
650 isexe = file_isexe(blob_str(&filename));
651 #endif
@@ -733,11 +752,11 @@
733 while( db_step(&q)==SQLITE_ROW ){
734 const char *zTag = db_column_text(&q, 0);
735 blob_appendf(pOut, "T -%F *\n", zTag);
736 }
737 db_finalize(&q);
738 }
739 blob_appendf(pOut, "U %F\n", zUserOvrd ? zUserOvrd : g.zLogin);
740 md5sum_blob(pOut, &mcksum);
741 blob_appendf(pOut, "Z %b\n", &mcksum);
742 if( pnFBcard ) *pnFBcard = nFBcard;
743 }
@@ -776,11 +795,11 @@
776 }
777 if( nCrNl ){
778 char c;
779 file_relative_name(zFilename, &fname);
780 blob_zero(&ans);
781 zMsg = mprintf("%s contains CR/NL line endings; commit anyhow (y/N/a)?",
782 blob_str(&fname));
783 prompt_user(zMsg, &ans);
784 fossil_free(zMsg);
785 c = blob_str(&ans)[0];
786 if( c=='a' ){
@@ -800,11 +819,11 @@
800 **
801 ** Usage: %fossil commit ?OPTIONS? ?FILE...?
802 **
803 ** Create a new version containing all of the changes in the current
804 ** checkout. You will be prompted to enter a check-in comment unless
805 ** the comment has been specified on the command-line using "-m" or a
806 ** file containing the comment using -M. The editor defined in the
807 ** "editor" fossil option (see %fossil help set) will be used, or from
808 ** the "VISUAL" or "EDITOR" environment variables (in that order) if
809 ** no editor is set.
810 **
@@ -834,11 +853,11 @@
834 ** --force|-f
835 ** --private
836 ** --baseline
837 ** --delta
838 ** --tag TAG-NAME
839 **
840 */
841 void commit_cmd(void){
842 int hasChanges; /* True if unsaved changes exist */
843 int vid; /* blob-id of parent version */
844 int nrid; /* blob-id of a modified file */
@@ -866,11 +885,11 @@
866 Blob muuid; /* Manifest uuid */
867 Blob cksum1, cksum2; /* Before and after commit checksums */
868 Blob cksum1b; /* Checksum recorded in the manifest */
869 int szD; /* Size of the delta manifest */
870 int szB; /* Size of the baseline manifest */
871
872 url_proxy_options();
873 noSign = find_option("nosign",0,0)!=0;
874 forceDelta = find_option("delta",0,0)!=0;
875 forceBaseline = find_option("baseline",0,0)!=0;
876 if( forceDelta && forceBaseline ){
@@ -960,11 +979,11 @@
960 ** Check that the user exists.
961 */
962 if( !db_exists("SELECT 1 FROM user WHERE login=%Q", g.zLogin) ){
963 fossil_fatal("no such user: %s", g.zLogin);
964 }
965
966 hasChanges = unsaved_changes();
967 db_begin_transaction();
968 db_record_repository_filename(0);
969 if( hasChanges==0 && !isAMerge && !forceFlag ){
970 fossil_fatal("nothing has changed");
@@ -975,11 +994,11 @@
975 */
976 if( g.aCommitFile ){
977 Blob unmodified;
978 memset(&unmodified, 0, sizeof(Blob));
979 blob_init(&unmodified, 0, 0);
980 db_blob(&unmodified,
981 "SELECT pathname FROM vfile"
982 " WHERE chnged = 0 AND origname IS NULL AND file_is_selected(id)"
983 );
984 if( strlen(blob_str(&unmodified)) ){
985 fossil_fatal("file %s has not changed", blob_str(&unmodified));
@@ -993,11 +1012,11 @@
993 if( zBranch==0 && forceFlag==0 && g.markPrivate==0 && !is_a_leaf(vid) ){
994 fossil_fatal("would fork. \"update\" first or use -f or --force.");
995 }
996
997 /*
998 ** Do not allow a commit against a closed leaf
999 */
1000 if( db_exists("SELECT 1 FROM tagxref"
1001 " WHERE tagid=%d AND rid=%d AND tagtype>0",
1002 TAG_CLOSED, vid) ){
1003 fossil_fatal("cannot commit against a closed leaf");
@@ -1026,11 +1045,11 @@
1026 db_multi_exec("REPLACE INTO vvar VALUES('ci-comment',%B)", &comment);
1027 db_end_transaction(0);
1028 db_begin_transaction();
1029 }
1030
1031 /* Step 1: Insert records for all modified files into the blob
1032 ** table. If there were arguments passed to this command, only
1033 ** the identified fils are inserted (if they have been modified).
1034 */
1035 db_prepare(&q,
1036 "SELECT id, %Q || pathname, mrid, %s FROM vfile "
@@ -1128,11 +1147,11 @@
1128 fossil_exit(1);
1129 }
1130 }
1131
1132 /* If the --test option is specified, output the manifest file
1133 ** and rollback the transaction.
1134 */
1135 if( testRun ){
1136 blob_write_to_file(&manifest, "");
1137 }
1138
@@ -1160,11 +1179,11 @@
1160 blob_write_to_file(&muuid, zManifestFile);
1161 free(zManifestFile);
1162 blob_reset(&muuid);
1163 }
1164
1165
1166 /* Update the vfile and vmerge tables */
1167 db_multi_exec(
1168 "DELETE FROM vfile WHERE (vid!=%d OR deleted) AND file_is_selected(id);"
1169 "DELETE FROM vmerge WHERE file_is_selected(id) OR id=0;"
1170 "UPDATE vfile SET vid=%d;"
@@ -1184,11 +1203,11 @@
1184 vfile_compare_repository_to_disk(nvid);
1185 fossil_fatal("working checkout does not match what would have ended "
1186 "up in the repository: %b versus %b",
1187 &cksum1, &cksum2);
1188 }
1189
1190 /* Verify that the manifest checksum matches the expected checksum */
1191 vfile_aggregate_checksum_manifest(nvid, &cksum2, &cksum1b);
1192 if( blob_compare(&cksum1, &cksum1b) ){
1193 fossil_fatal("manifest checksum self-test failed: "
1194 "%b versus %b", &cksum1, &cksum1b);
@@ -1196,11 +1215,11 @@
1196 if( blob_compare(&cksum1, &cksum2) ){
1197 fossil_fatal(
1198 "working checkout does not match manifest after commit: "
1199 "%b versus %b", &cksum1, &cksum2);
1200 }
1201
1202 /* Verify that the commit did not modify any disk images. */
1203 vfile_aggregate_checksum_disk(nvid, &cksum2);
1204 if( blob_compare(&cksum1, &cksum2) ){
1205 fossil_fatal("working checkout before and after commit does not match");
1206 }
@@ -1216,11 +1235,11 @@
1216 exit(1);
1217 }
1218 db_end_transaction(0);
1219
1220 if( !g.markPrivate ){
1221 autosync(AUTOSYNC_PUSH);
1222 }
1223 if( count_nonbranch_children(vid)>1 ){
1224 printf("**** warning: a fork has occurred *****\n");
1225 }
1226 }
1227
--- src/checkin.c
+++ src/checkin.c
@@ -37,11 +37,11 @@
37 int missingIsFatal /* MISSING and NOT_A_FILE are fatal errors */
38 ){
39 Stmt q;
40 int nPrefix = strlen(zPrefix);
41 int nErr = 0;
42 db_prepare(&q,
43 "SELECT pathname, deleted, chnged, rid, coalesce(origname!=pathname,0)"
44 " FROM vfile "
45 " WHERE file_is_selected(id)"
46 " AND (chnged OR deleted OR rid=0 OR pathname!=origname) ORDER BY 1"
47 );
@@ -107,10 +107,13 @@
107 **
108 ** Options:
109 **
110 ** --sha1sum Verify file status using SHA1 hashing rather
111 ** than relying on file mtimes.
112 **
113 **
114 ** SUMMARY: fossil changes ?--sha1sum?
115 */
116 void changes_cmd(void){
117 Blob report;
118 int vid;
119 int useSha1sum = find_option("sha1sum", 0, 0)!=0;
@@ -131,10 +134,13 @@
134 **
135 ** Options:
136 **
137 ** --sha1sum Verify file status using SHA1 hashing rather
138 ** than relying on file mtimes.
139 **
140 **
141 ** SUMMARY: fossil status ?--sha1sum?
142 */
143 void status_cmd(void){
144 int vid;
145 db_must_be_within_tree();
146 /* 012345678901234 */
@@ -153,10 +159,13 @@
159 **
160 ** Usage: %fossil ls [-l]
161 **
162 ** Show the names of all files in the current checkout. The -l provides
163 ** extra information about each file.
164 **
165 **
166 ** SUMMARY: fossil ls ?-l?
167 */
168 void ls_cmd(void){
169 int vid;
170 Stmt q;
171 int isBrief;
@@ -257,19 +266,23 @@
266
267 /*
268 ** COMMAND: extras
269 ** Usage: %fossil extras ?--dotfiles? ?--ignore GLOBPATTERN?
270 **
271 ** Print a list of all files in the source tree that are NOT part of
272 ** the current checkout. See also the "clean" command.
273 **
274 ** Files and subdirectories whose names begin with "." are normally
275 ** ignored but can be included by adding the --dotfiles option.
276 **
277 ** The GLOBPATTERN is a comma-separated list of GLOB expressions for
278 ** files that are ignored. The GLOBPATTERN specified by the "ignore-glob"
279 ** setting is used if the --ignore option is omitted. (See the settings
280 ** command for more information.)
281 **
282 **
283 ** SUMMARY: fossil extras ?-dotfiles? ?--ignore globpattern?
284 */
285 void extra_cmd(void){
286 Blob path;
287 Blob repo;
288 Stmt q;
@@ -285,11 +298,11 @@
298 blob_init(&path, g.zLocalRoot, n-1);
299 if( zIgnoreFlag==0 ){
300 zIgnoreFlag = db_get("ignore-glob", 0);
301 }
302 vfile_scan(0, &path, blob_size(&path), allFlag);
303 db_prepare(&q,
304 "SELECT x FROM sfile"
305 " WHERE x NOT IN (%s)"
306 " AND NOT %s"
307 " ORDER BY 1",
308 fossil_all_reserved_names(),
@@ -308,23 +321,29 @@
321 ** COMMAND: clean
322 ** Usage: %fossil clean ?--force? ?--dotfiles? ?--ignore GLOBPATTERN?
323 **
324 ** Delete all "extra" files in the source tree. "Extra" files are
325 ** files that are not officially part of the checkout. See also
326 ** the "extras" command.
327 **
328 ** TAKE CARE: This operation cannot be undone!
329 **
330 ** You will be prompted before removing each file. If you are
331 ** sure you wish to remove all "extra" files you can specify the
332 ** --force flag and no prompts will be issued.
333 **
334 ** Files and subdirectories whose names begin with "." are
335 ** normally ignored. They are included if the "--dotfiles" option
336 ** is used.
337 **
338 ** The GLOBPATTERN is a comma-separated list of GLOB expressions for
339 ** files that are ignored. The GLOBPATTERN specified by the "ignore-glob"
340 ** setting is used if the --ignore option is omitted. (See the settings
341 ** command for more information.)
342 **
343 **
344 ** SUMMARY: fossil clean ?--force? ?--dotfiles? ?--ignore globpattern?
345 */
346 void clean_cmd(void){
347 int allFlag;
348 int dotfilesFlag;
349 const char *zIgnoreFlag;
@@ -340,11 +359,11 @@
359 }
360 db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY)");
361 n = strlen(g.zLocalRoot);
362 blob_init(&path, g.zLocalRoot, n-1);
363 vfile_scan(0, &path, blob_size(&path), dotfilesFlag);
364 db_prepare(&q,
365 "SELECT %Q || x FROM sfile"
366 " WHERE x NOT IN (%s) AND NOT %s"
367 " ORDER BY 1",
368 g.zLocalRoot, fossil_all_reserved_names(), glob_expr("x",zIgnoreFlag)
369 );
@@ -517,15 +536,15 @@
536 }
537 }
538
539 /*
540 ** Return true if the check-in with RID=rid is a leaf.
541 ** A leaf has no children in the same branch.
542 */
543 int is_a_leaf(int rid){
544 int rc;
545 static const char zSql[] =
546 @ SELECT 1 FROM plink
547 @ WHERE pid=%d
548 @ AND coalesce((SELECT value FROM tagxref
549 @ WHERE tagid=%d AND rid=plink.pid), 'trunk')
550 @ =coalesce((SELECT value FROM tagxref
@@ -559,11 +578,11 @@
578 #endif
579 }
580
581 /*
582 ** zDate should be a valid date string. Convert this string into the
583 ** format YYYY-MM-DDTHH:MM:SS. If the string is not a valid date,
584 ** print a fatal error and quit.
585 */
586 char *date_in_standard_format(const char *zInputDate){
587 char *zDate;
588 zDate = db_text(0, "SELECT strftime('%%Y-%%m-%%dT%%H:%%M:%%f',%Q)",
@@ -641,11 +660,11 @@
660 const char *zPerm;
661 int cmp;
662 #if !defined(_WIN32)
663 /* For unix, extract the "executable" permission bit directly from
664 ** the filesystem. On windows, the "executable" bit is retained
665 ** unchanged from the original.
666 */
667 blob_resize(&filename, nBasename);
668 blob_append(&filename, zName, -1);
669 isexe = file_isexe(blob_str(&filename));
670 #endif
@@ -733,11 +752,11 @@
752 while( db_step(&q)==SQLITE_ROW ){
753 const char *zTag = db_column_text(&q, 0);
754 blob_appendf(pOut, "T -%F *\n", zTag);
755 }
756 db_finalize(&q);
757 }
758 blob_appendf(pOut, "U %F\n", zUserOvrd ? zUserOvrd : g.zLogin);
759 md5sum_blob(pOut, &mcksum);
760 blob_appendf(pOut, "Z %b\n", &mcksum);
761 if( pnFBcard ) *pnFBcard = nFBcard;
762 }
@@ -776,11 +795,11 @@
795 }
796 if( nCrNl ){
797 char c;
798 file_relative_name(zFilename, &fname);
799 blob_zero(&ans);
800 zMsg = mprintf("%s contains CR/NL line endings; commit anyhow (y/N/a)?",
801 blob_str(&fname));
802 prompt_user(zMsg, &ans);
803 fossil_free(zMsg);
804 c = blob_str(&ans)[0];
805 if( c=='a' ){
@@ -800,11 +819,11 @@
819 **
820 ** Usage: %fossil commit ?OPTIONS? ?FILE...?
821 **
822 ** Create a new version containing all of the changes in the current
823 ** checkout. You will be prompted to enter a check-in comment unless
824 ** the comment has been specified on the command-line using "-m" or a
825 ** file containing the comment using -M. The editor defined in the
826 ** "editor" fossil option (see %fossil help set) will be used, or from
827 ** the "VISUAL" or "EDITOR" environment variables (in that order) if
828 ** no editor is set.
829 **
@@ -834,11 +853,11 @@
853 ** --force|-f
854 ** --private
855 ** --baseline
856 ** --delta
857 ** --tag TAG-NAME
858 **
859 */
860 void commit_cmd(void){
861 int hasChanges; /* True if unsaved changes exist */
862 int vid; /* blob-id of parent version */
863 int nrid; /* blob-id of a modified file */
@@ -866,11 +885,11 @@
885 Blob muuid; /* Manifest uuid */
886 Blob cksum1, cksum2; /* Before and after commit checksums */
887 Blob cksum1b; /* Checksum recorded in the manifest */
888 int szD; /* Size of the delta manifest */
889 int szB; /* Size of the baseline manifest */
890
891 url_proxy_options();
892 noSign = find_option("nosign",0,0)!=0;
893 forceDelta = find_option("delta",0,0)!=0;
894 forceBaseline = find_option("baseline",0,0)!=0;
895 if( forceDelta && forceBaseline ){
@@ -960,11 +979,11 @@
979 ** Check that the user exists.
980 */
981 if( !db_exists("SELECT 1 FROM user WHERE login=%Q", g.zLogin) ){
982 fossil_fatal("no such user: %s", g.zLogin);
983 }
984
985 hasChanges = unsaved_changes();
986 db_begin_transaction();
987 db_record_repository_filename(0);
988 if( hasChanges==0 && !isAMerge && !forceFlag ){
989 fossil_fatal("nothing has changed");
@@ -975,11 +994,11 @@
994 */
995 if( g.aCommitFile ){
996 Blob unmodified;
997 memset(&unmodified, 0, sizeof(Blob));
998 blob_init(&unmodified, 0, 0);
999 db_blob(&unmodified,
1000 "SELECT pathname FROM vfile"
1001 " WHERE chnged = 0 AND origname IS NULL AND file_is_selected(id)"
1002 );
1003 if( strlen(blob_str(&unmodified)) ){
1004 fossil_fatal("file %s has not changed", blob_str(&unmodified));
@@ -993,11 +1012,11 @@
1012 if( zBranch==0 && forceFlag==0 && g.markPrivate==0 && !is_a_leaf(vid) ){
1013 fossil_fatal("would fork. \"update\" first or use -f or --force.");
1014 }
1015
1016 /*
1017 ** Do not allow a commit against a closed leaf
1018 */
1019 if( db_exists("SELECT 1 FROM tagxref"
1020 " WHERE tagid=%d AND rid=%d AND tagtype>0",
1021 TAG_CLOSED, vid) ){
1022 fossil_fatal("cannot commit against a closed leaf");
@@ -1026,11 +1045,11 @@
1045 db_multi_exec("REPLACE INTO vvar VALUES('ci-comment',%B)", &comment);
1046 db_end_transaction(0);
1047 db_begin_transaction();
1048 }
1049
1050 /* Step 1: Insert records for all modified files into the blob
1051 ** table. If there were arguments passed to this command, only
1052 ** the identified fils are inserted (if they have been modified).
1053 */
1054 db_prepare(&q,
1055 "SELECT id, %Q || pathname, mrid, %s FROM vfile "
@@ -1128,11 +1147,11 @@
1147 fossil_exit(1);
1148 }
1149 }
1150
1151 /* If the --test option is specified, output the manifest file
1152 ** and rollback the transaction.
1153 */
1154 if( testRun ){
1155 blob_write_to_file(&manifest, "");
1156 }
1157
@@ -1160,11 +1179,11 @@
1179 blob_write_to_file(&muuid, zManifestFile);
1180 free(zManifestFile);
1181 blob_reset(&muuid);
1182 }
1183
1184
1185 /* Update the vfile and vmerge tables */
1186 db_multi_exec(
1187 "DELETE FROM vfile WHERE (vid!=%d OR deleted) AND file_is_selected(id);"
1188 "DELETE FROM vmerge WHERE file_is_selected(id) OR id=0;"
1189 "UPDATE vfile SET vid=%d;"
@@ -1184,11 +1203,11 @@
1203 vfile_compare_repository_to_disk(nvid);
1204 fossil_fatal("working checkout does not match what would have ended "
1205 "up in the repository: %b versus %b",
1206 &cksum1, &cksum2);
1207 }
1208
1209 /* Verify that the manifest checksum matches the expected checksum */
1210 vfile_aggregate_checksum_manifest(nvid, &cksum2, &cksum1b);
1211 if( blob_compare(&cksum1, &cksum1b) ){
1212 fossil_fatal("manifest checksum self-test failed: "
1213 "%b versus %b", &cksum1, &cksum1b);
@@ -1196,11 +1215,11 @@
1215 if( blob_compare(&cksum1, &cksum2) ){
1216 fossil_fatal(
1217 "working checkout does not match manifest after commit: "
1218 "%b versus %b", &cksum1, &cksum2);
1219 }
1220
1221 /* Verify that the commit did not modify any disk images. */
1222 vfile_aggregate_checksum_disk(nvid, &cksum2);
1223 if( blob_compare(&cksum1, &cksum2) ){
1224 fossil_fatal("working checkout before and after commit does not match");
1225 }
@@ -1216,11 +1235,11 @@
1235 exit(1);
1236 }
1237 db_end_transaction(0);
1238
1239 if( !g.markPrivate ){
1240 autosync(AUTOSYNC_PUSH);
1241 }
1242 if( count_nonbranch_children(vid)>1 ){
1243 printf("**** warning: a fork has occurred *****\n");
1244 }
1245 }
1246

Keyboard Shortcuts

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