Fossil SCM

Help message cleanup. Automatically delete cloned database files if the clone fails.

drh 2008-05-10 18:01 trunk
Commit 6b85fd173e5c90ad0c24c4146249a28ff8d2ab18
+3 -2
--- src/add.c
+++ src/add.c
@@ -31,12 +31,13 @@
3131
3232
/*
3333
** COMMAND: add
3434
**
3535
** Usage: %fossil add FILE...
36
-** Add one or more files to the current checkout such that these files
37
-** will be inserted into the repository at the next commit.
36
+**
37
+** Make arrangements to add one or more files to the current checkout
38
+** at the next commit.
3839
*/
3940
void add_cmd(void){
4041
int i;
4142
int vid;
4243
4344
--- src/add.c
+++ src/add.c
@@ -31,12 +31,13 @@
31
32 /*
33 ** COMMAND: add
34 **
35 ** Usage: %fossil add FILE...
36 ** Add one or more files to the current checkout such that these files
37 ** will be inserted into the repository at the next commit.
 
38 */
39 void add_cmd(void){
40 int i;
41 int vid;
42
43
--- src/add.c
+++ src/add.c
@@ -31,12 +31,13 @@
31
32 /*
33 ** COMMAND: add
34 **
35 ** Usage: %fossil add FILE...
36 **
37 ** Make arrangements to add one or more files to the current checkout
38 ** at the next commit.
39 */
40 void add_cmd(void){
41 int i;
42 int vid;
43
44
+8 -1
--- src/checkin.c
+++ src/checkin.c
@@ -75,10 +75,11 @@
7575
7676
/*
7777
** COMMAND: changes
7878
**
7979
** Usage: %fossil changes
80
+**
8081
** Report on the edit status of all files in the current checkout.
8182
** See also the "status" and "extra" commands.
8283
*/
8384
void changes_cmd(void){
8485
Blob report;
@@ -91,11 +92,13 @@
9192
blob_write_to_file(&report, "-");
9293
}
9394
9495
/*
9596
** COMMAND: status
97
+**
9698
** Usage: %fossil status
99
+**
97100
** Report on the status of the current checkout.
98101
*/
99102
void status_cmd(void){
100103
int vid;
101104
db_must_be_within_tree();
@@ -110,11 +113,13 @@
110113
changes_cmd();
111114
}
112115
113116
/*
114117
** COMMAND: ls
118
+**
115119
** Usage: %fossil ls
120
+**
116121
** Show the names of all files in the current checkout
117122
*/
118123
void ls_cmd(void){
119124
int vid;
120125
Stmt q;
@@ -143,10 +148,11 @@
143148
}
144149
145150
/*
146151
** COMMAND: extra
147152
** Usage: %fossil extra
153
+**
148154
** Print a list of all files in the source tree that are not part of
149155
** the current checkout. See also the "clean" command.
150156
*/
151157
void extra_cmd(void){
152158
Blob path;
@@ -166,11 +172,12 @@
166172
db_finalize(&q);
167173
}
168174
169175
/*
170176
** COMMAND: clean
171
-** Usage: %fossil clean ?-all
177
+** Usage: %fossil clean ?-all?
178
+**
172179
** Delete all "extra" files in the source tree. "Extra" files are
173180
** files that are not officially part of the checkout. See also
174181
** the "extra" command. This operation cannot be undone.
175182
**
176183
** You will be prompted before removing each file. If you are
177184
--- src/checkin.c
+++ src/checkin.c
@@ -75,10 +75,11 @@
75
76 /*
77 ** COMMAND: changes
78 **
79 ** Usage: %fossil changes
 
80 ** Report on the edit status of all files in the current checkout.
81 ** See also the "status" and "extra" commands.
82 */
83 void changes_cmd(void){
84 Blob report;
@@ -91,11 +92,13 @@
91 blob_write_to_file(&report, "-");
92 }
93
94 /*
95 ** COMMAND: status
 
96 ** Usage: %fossil status
 
97 ** Report on the status of the current checkout.
98 */
99 void status_cmd(void){
100 int vid;
101 db_must_be_within_tree();
@@ -110,11 +113,13 @@
110 changes_cmd();
111 }
112
113 /*
114 ** COMMAND: ls
 
115 ** Usage: %fossil ls
 
116 ** Show the names of all files in the current checkout
117 */
118 void ls_cmd(void){
119 int vid;
120 Stmt q;
@@ -143,10 +148,11 @@
143 }
144
145 /*
146 ** COMMAND: extra
147 ** Usage: %fossil extra
 
148 ** Print a list of all files in the source tree that are not part of
149 ** the current checkout. See also the "clean" command.
150 */
151 void extra_cmd(void){
152 Blob path;
@@ -166,11 +172,12 @@
166 db_finalize(&q);
167 }
168
169 /*
170 ** COMMAND: clean
171 ** Usage: %fossil clean ?-all
 
172 ** Delete all "extra" files in the source tree. "Extra" files are
173 ** files that are not officially part of the checkout. See also
174 ** the "extra" command. This operation cannot be undone.
175 **
176 ** You will be prompted before removing each file. If you are
177
--- src/checkin.c
+++ src/checkin.c
@@ -75,10 +75,11 @@
75
76 /*
77 ** COMMAND: changes
78 **
79 ** Usage: %fossil changes
80 **
81 ** Report on the edit status of all files in the current checkout.
82 ** See also the "status" and "extra" commands.
83 */
84 void changes_cmd(void){
85 Blob report;
@@ -91,11 +92,13 @@
92 blob_write_to_file(&report, "-");
93 }
94
95 /*
96 ** COMMAND: status
97 **
98 ** Usage: %fossil status
99 **
100 ** Report on the status of the current checkout.
101 */
102 void status_cmd(void){
103 int vid;
104 db_must_be_within_tree();
@@ -110,11 +113,13 @@
113 changes_cmd();
114 }
115
116 /*
117 ** COMMAND: ls
118 **
119 ** Usage: %fossil ls
120 **
121 ** Show the names of all files in the current checkout
122 */
123 void ls_cmd(void){
124 int vid;
125 Stmt q;
@@ -143,10 +148,11 @@
148 }
149
150 /*
151 ** COMMAND: extra
152 ** Usage: %fossil extra
153 **
154 ** Print a list of all files in the source tree that are not part of
155 ** the current checkout. See also the "clean" command.
156 */
157 void extra_cmd(void){
158 Blob path;
@@ -166,11 +172,12 @@
172 db_finalize(&q);
173 }
174
175 /*
176 ** COMMAND: clean
177 ** Usage: %fossil clean ?-all?
178 **
179 ** Delete all "extra" files in the source tree. "Extra" files are
180 ** files that are not officially part of the checkout. See also
181 ** the "extra" command. This operation cannot be undone.
182 **
183 ** You will be prompted before removing each file. If you are
184
--- src/checkout.c
+++ src/checkout.c
@@ -134,10 +134,11 @@
134134
135135
/*
136136
** COMMAND: checkout
137137
**
138138
** Usage: %fossil checkout VERSION ?-f|--force?
139
+**
139140
** Check out a version specified on the command-line. This command
140141
** will not overwrite edited files in the current checkout unless
141142
** the --force option appears on the command-line.
142143
**
143144
** See also the "update" command.
@@ -190,10 +191,11 @@
190191
191192
/*
192193
** COMMAND: close
193194
**
194195
** Usage: %fossil close ?-f|--force?
196
+**
195197
** The opposite of "open". Close the current database connection.
196198
** Require a -f or --force flag if there are unsaved changed in the
197199
** current check-out.
198200
*/
199201
void close_cmd(void){
200202
--- src/checkout.c
+++ src/checkout.c
@@ -134,10 +134,11 @@
134
135 /*
136 ** COMMAND: checkout
137 **
138 ** Usage: %fossil checkout VERSION ?-f|--force?
 
139 ** Check out a version specified on the command-line. This command
140 ** will not overwrite edited files in the current checkout unless
141 ** the --force option appears on the command-line.
142 **
143 ** See also the "update" command.
@@ -190,10 +191,11 @@
190
191 /*
192 ** COMMAND: close
193 **
194 ** Usage: %fossil close ?-f|--force?
 
195 ** The opposite of "open". Close the current database connection.
196 ** Require a -f or --force flag if there are unsaved changed in the
197 ** current check-out.
198 */
199 void close_cmd(void){
200
--- src/checkout.c
+++ src/checkout.c
@@ -134,10 +134,11 @@
134
135 /*
136 ** COMMAND: checkout
137 **
138 ** Usage: %fossil checkout VERSION ?-f|--force?
139 **
140 ** Check out a version specified on the command-line. This command
141 ** will not overwrite edited files in the current checkout unless
142 ** the --force option appears on the command-line.
143 **
144 ** See also the "update" command.
@@ -190,10 +191,11 @@
191
192 /*
193 ** COMMAND: close
194 **
195 ** Usage: %fossil close ?-f|--force?
196 **
197 ** The opposite of "open". Close the current database connection.
198 ** Require a -f or --force flag if there are unsaved changed in the
199 ** current check-out.
200 */
201 void close_cmd(void){
202
+10 -3
--- src/db.c
+++ src/db.c
@@ -75,10 +75,11 @@
7575
db_force_rollback();
7676
exit(1);
7777
}
7878
7979
static int nBegin = 0; /* Nesting depth of BEGIN */
80
+static int isNewRepo = 0; /* True if the repository is newly created */
8081
static int doRollback = 0; /* True to force a rollback */
8182
static int nCommitHook = 0; /* Number of commit hooks */
8283
static struct sCommitHook {
8384
int (*xHook)(void); /* Functions to call at db_end_transaction() */
8485
int sequence; /* Call functions in sequence order */
@@ -124,10 +125,14 @@
124125
}
125126
}
126127
void db_force_rollback(void){
127128
if( nBegin ){
128129
sqlite3_exec(g.db, "ROLLBACK", 0, 0, 0);
130
+ if( isNewRepo ){
131
+ db_close();
132
+ unlink(g.zRepositoryName);
133
+ }
129134
}
130135
nBegin = 0;
131136
}
132137
133138
/*
@@ -730,10 +735,11 @@
730735
zFilename,
731736
zRepositorySchema1,
732737
zRepositorySchema2,
733738
(char*)0
734739
);
740
+ isNewRepo = 1;
735741
}
736742
737743
/*
738744
** Fill an empty repository database with the basic information for a
739745
** repository. This function is shared between 'create_repository_cmd'
@@ -804,10 +810,11 @@
804810
805811
/*
806812
** COMMAND: new
807813
**
808814
** Usage: %fossil new FILENAME
815
+**
809816
** Create a repository for a new project in the file named FILENAME.
810817
** This command is distinct from "clone". The "clone" command makes
811818
** a copy of an existing project. This command starts a new project.
812819
*/
813820
void create_repository_cmd(void){
@@ -1113,17 +1120,17 @@
11131120
** diff. If undefined, text diff will be used.
11141121
*/
11151122
void setting_cmd(void){
11161123
static const char *azName[] = {
11171124
"autosync",
1118
- "pgp-command",
1125
+ "diff-command",
11191126
"editor",
1127
+ "gdiff-command",
11201128
"localauth",
11211129
"omitsign",
1130
+ "pgp-command",
11221131
"proxy",
1123
- "diff-command",
1124
- "gdiff-command",
11251132
};
11261133
int i;
11271134
int globalFlag = find_option("global","g",0)!=0;
11281135
int unsetFlag = g.argv[1][0]=='u';
11291136
db_find_and_open_repository(0);
11301137
--- src/db.c
+++ src/db.c
@@ -75,10 +75,11 @@
75 db_force_rollback();
76 exit(1);
77 }
78
79 static int nBegin = 0; /* Nesting depth of BEGIN */
 
80 static int doRollback = 0; /* True to force a rollback */
81 static int nCommitHook = 0; /* Number of commit hooks */
82 static struct sCommitHook {
83 int (*xHook)(void); /* Functions to call at db_end_transaction() */
84 int sequence; /* Call functions in sequence order */
@@ -124,10 +125,14 @@
124 }
125 }
126 void db_force_rollback(void){
127 if( nBegin ){
128 sqlite3_exec(g.db, "ROLLBACK", 0, 0, 0);
 
 
 
 
129 }
130 nBegin = 0;
131 }
132
133 /*
@@ -730,10 +735,11 @@
730 zFilename,
731 zRepositorySchema1,
732 zRepositorySchema2,
733 (char*)0
734 );
 
735 }
736
737 /*
738 ** Fill an empty repository database with the basic information for a
739 ** repository. This function is shared between 'create_repository_cmd'
@@ -804,10 +810,11 @@
804
805 /*
806 ** COMMAND: new
807 **
808 ** Usage: %fossil new FILENAME
 
809 ** Create a repository for a new project in the file named FILENAME.
810 ** This command is distinct from "clone". The "clone" command makes
811 ** a copy of an existing project. This command starts a new project.
812 */
813 void create_repository_cmd(void){
@@ -1113,17 +1120,17 @@
1113 ** diff. If undefined, text diff will be used.
1114 */
1115 void setting_cmd(void){
1116 static const char *azName[] = {
1117 "autosync",
1118 "pgp-command",
1119 "editor",
 
1120 "localauth",
1121 "omitsign",
 
1122 "proxy",
1123 "diff-command",
1124 "gdiff-command",
1125 };
1126 int i;
1127 int globalFlag = find_option("global","g",0)!=0;
1128 int unsetFlag = g.argv[1][0]=='u';
1129 db_find_and_open_repository(0);
1130
--- src/db.c
+++ src/db.c
@@ -75,10 +75,11 @@
75 db_force_rollback();
76 exit(1);
77 }
78
79 static int nBegin = 0; /* Nesting depth of BEGIN */
80 static int isNewRepo = 0; /* True if the repository is newly created */
81 static int doRollback = 0; /* True to force a rollback */
82 static int nCommitHook = 0; /* Number of commit hooks */
83 static struct sCommitHook {
84 int (*xHook)(void); /* Functions to call at db_end_transaction() */
85 int sequence; /* Call functions in sequence order */
@@ -124,10 +125,14 @@
125 }
126 }
127 void db_force_rollback(void){
128 if( nBegin ){
129 sqlite3_exec(g.db, "ROLLBACK", 0, 0, 0);
130 if( isNewRepo ){
131 db_close();
132 unlink(g.zRepositoryName);
133 }
134 }
135 nBegin = 0;
136 }
137
138 /*
@@ -730,10 +735,11 @@
735 zFilename,
736 zRepositorySchema1,
737 zRepositorySchema2,
738 (char*)0
739 );
740 isNewRepo = 1;
741 }
742
743 /*
744 ** Fill an empty repository database with the basic information for a
745 ** repository. This function is shared between 'create_repository_cmd'
@@ -804,10 +810,11 @@
810
811 /*
812 ** COMMAND: new
813 **
814 ** Usage: %fossil new FILENAME
815 **
816 ** Create a repository for a new project in the file named FILENAME.
817 ** This command is distinct from "clone". The "clone" command makes
818 ** a copy of an existing project. This command starts a new project.
819 */
820 void create_repository_cmd(void){
@@ -1113,17 +1120,17 @@
1120 ** diff. If undefined, text diff will be used.
1121 */
1122 void setting_cmd(void){
1123 static const char *azName[] = {
1124 "autosync",
1125 "diff-command",
1126 "editor",
1127 "gdiff-command",
1128 "localauth",
1129 "omitsign",
1130 "pgp-command",
1131 "proxy",
 
 
1132 };
1133 int i;
1134 int globalFlag = find_option("global","g",0)!=0;
1135 int unsetFlag = g.argv[1][0]=='u';
1136 db_find_and_open_repository(0);
1137
--- src/descendents.c
+++ src/descendents.c
@@ -131,10 +131,11 @@
131131
132132
/*
133133
** COMMAND: descendents
134134
**
135135
** Usage: %fossil descendents ?UUID?
136
+**
136137
** Find all leaf descendents of the current version or of the
137138
** specified version.
138139
*/
139140
void descendents_cmd(void){
140141
Stmt q;
@@ -160,10 +161,11 @@
160161
161162
/*
162163
** COMMAND: leaves
163164
**
164165
** Usage: %fossil leaves
166
+**
165167
** Find leaves of all branches.
166168
*/
167169
void branches_cmd(void){
168170
Stmt q;
169171
170172
--- src/descendents.c
+++ src/descendents.c
@@ -131,10 +131,11 @@
131
132 /*
133 ** COMMAND: descendents
134 **
135 ** Usage: %fossil descendents ?UUID?
 
136 ** Find all leaf descendents of the current version or of the
137 ** specified version.
138 */
139 void descendents_cmd(void){
140 Stmt q;
@@ -160,10 +161,11 @@
160
161 /*
162 ** COMMAND: leaves
163 **
164 ** Usage: %fossil leaves
 
165 ** Find leaves of all branches.
166 */
167 void branches_cmd(void){
168 Stmt q;
169
170
--- src/descendents.c
+++ src/descendents.c
@@ -131,10 +131,11 @@
131
132 /*
133 ** COMMAND: descendents
134 **
135 ** Usage: %fossil descendents ?UUID?
136 **
137 ** Find all leaf descendents of the current version or of the
138 ** specified version.
139 */
140 void descendents_cmd(void){
141 Stmt q;
@@ -160,10 +161,11 @@
161
162 /*
163 ** COMMAND: leaves
164 **
165 ** Usage: %fossil leaves
166 **
167 ** Find leaves of all branches.
168 */
169 void branches_cmd(void){
170 Stmt q;
171
172
+2
--- src/main.c
+++ src/main.c
@@ -364,10 +364,11 @@
364364
365365
/*
366366
** COMMAND: test-commands
367367
**
368368
** Usage: %fossil test-commands
369
+**
369370
** List all commands used for testing and debugging.
370371
*/
371372
void cmd_test_cmd_list(void){
372373
int i, nCmd;
373374
const char *aCmd[count(aCommand)];
@@ -382,10 +383,11 @@
382383
383384
/*
384385
** COMMAND: help
385386
**
386387
** Usage: %fossil help COMMAND
388
+**
387389
** Display information on how to use COMMAND
388390
*/
389391
void help_cmd(void){
390392
int rc, idx;
391393
const char *z;
392394
--- src/main.c
+++ src/main.c
@@ -364,10 +364,11 @@
364
365 /*
366 ** COMMAND: test-commands
367 **
368 ** Usage: %fossil test-commands
 
369 ** List all commands used for testing and debugging.
370 */
371 void cmd_test_cmd_list(void){
372 int i, nCmd;
373 const char *aCmd[count(aCommand)];
@@ -382,10 +383,11 @@
382
383 /*
384 ** COMMAND: help
385 **
386 ** Usage: %fossil help COMMAND
 
387 ** Display information on how to use COMMAND
388 */
389 void help_cmd(void){
390 int rc, idx;
391 const char *z;
392
--- src/main.c
+++ src/main.c
@@ -364,10 +364,11 @@
364
365 /*
366 ** COMMAND: test-commands
367 **
368 ** Usage: %fossil test-commands
369 **
370 ** List all commands used for testing and debugging.
371 */
372 void cmd_test_cmd_list(void){
373 int i, nCmd;
374 const char *aCmd[count(aCommand)];
@@ -382,10 +383,11 @@
383
384 /*
385 ** COMMAND: help
386 **
387 ** Usage: %fossil help COMMAND
388 **
389 ** Display information on how to use COMMAND
390 */
391 void help_cmd(void){
392 int rc, idx;
393 const char *z;
394

Keyboard Shortcuts

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