Fossil SCM

Make "fossil add", "fossil addremove", "fossil update" and "fossil co --latest" work when the repository doesn't contain any commit yet. This is not a fatal situation at all.

jan.nijtmans 2013-10-30 09:11 trunk
Commit b725c1cf266b766626c4874d4d5a20978b57ca2e
-6
--- src/add.c
+++ src/add.c
@@ -258,13 +258,10 @@
258258
}
259259
if( zIgnoreFlag==0 ){
260260
zIgnoreFlag = db_get("ignore-glob", 0);
261261
}
262262
vid = db_lget_int("checkout",0);
263
- if( vid==0 ){
264
- fossil_fatal("no checkout to add to");
265
- }
266263
db_begin_transaction();
267264
db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY %s)",
268265
filename_collation());
269266
pClean = glob_create(zCleanFlag);
270267
pIgnore = glob_create(zIgnoreFlag);
@@ -500,13 +497,10 @@
500497
}
501498
if( zIgnoreFlag==0 ){
502499
zIgnoreFlag = db_get("ignore-glob", 0);
503500
}
504501
vid = db_lget_int("checkout",0);
505
- if( vid==0 ){
506
- fossil_fatal("no checkout to add to");
507
- }
508502
db_begin_transaction();
509503
510504
/* step 1:
511505
** Populate the temp table "sfile" with the names of all unmanaged
512506
** files currently in the check-out, except for files that match the
513507
--- src/add.c
+++ src/add.c
@@ -258,13 +258,10 @@
258 }
259 if( zIgnoreFlag==0 ){
260 zIgnoreFlag = db_get("ignore-glob", 0);
261 }
262 vid = db_lget_int("checkout",0);
263 if( vid==0 ){
264 fossil_fatal("no checkout to add to");
265 }
266 db_begin_transaction();
267 db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY %s)",
268 filename_collation());
269 pClean = glob_create(zCleanFlag);
270 pIgnore = glob_create(zIgnoreFlag);
@@ -500,13 +497,10 @@
500 }
501 if( zIgnoreFlag==0 ){
502 zIgnoreFlag = db_get("ignore-glob", 0);
503 }
504 vid = db_lget_int("checkout",0);
505 if( vid==0 ){
506 fossil_fatal("no checkout to add to");
507 }
508 db_begin_transaction();
509
510 /* step 1:
511 ** Populate the temp table "sfile" with the names of all unmanaged
512 ** files currently in the check-out, except for files that match the
513
--- src/add.c
+++ src/add.c
@@ -258,13 +258,10 @@
258 }
259 if( zIgnoreFlag==0 ){
260 zIgnoreFlag = db_get("ignore-glob", 0);
261 }
262 vid = db_lget_int("checkout",0);
 
 
 
263 db_begin_transaction();
264 db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY %s)",
265 filename_collation());
266 pClean = glob_create(zCleanFlag);
267 pIgnore = glob_create(zIgnoreFlag);
@@ -500,13 +497,10 @@
497 }
498 if( zIgnoreFlag==0 ){
499 zIgnoreFlag = db_get("ignore-glob", 0);
500 }
501 vid = db_lget_int("checkout",0);
 
 
 
502 db_begin_transaction();
503
504 /* step 1:
505 ** Populate the temp table "sfile" with the names of all unmanaged
506 ** files currently in the check-out, except for files that match the
507
+1 -1
--- src/checkout.c
+++ src/checkout.c
@@ -220,11 +220,11 @@
220220
zVers = db_text(0, "SELECT uuid FROM event, blob"
221221
" WHERE event.objid=blob.rid AND event.type='ci'"
222222
" ORDER BY event.mtime DESC");
223223
}
224224
if( zVers==0 ){
225
- fossil_fatal("cannot locate \"latest\" checkout");
225
+ return;
226226
}
227227
}else{
228228
zVers = g.argv[2];
229229
}
230230
vid = load_vfile(zVers);
231231
--- src/checkout.c
+++ src/checkout.c
@@ -220,11 +220,11 @@
220 zVers = db_text(0, "SELECT uuid FROM event, blob"
221 " WHERE event.objid=blob.rid AND event.type='ci'"
222 " ORDER BY event.mtime DESC");
223 }
224 if( zVers==0 ){
225 fossil_fatal("cannot locate \"latest\" checkout");
226 }
227 }else{
228 zVers = g.argv[2];
229 }
230 vid = load_vfile(zVers);
231
--- src/checkout.c
+++ src/checkout.c
@@ -220,11 +220,11 @@
220 zVers = db_text(0, "SELECT uuid FROM event, blob"
221 " WHERE event.objid=blob.rid AND event.type='ci'"
222 " ORDER BY event.mtime DESC");
223 }
224 if( zVers==0 ){
225 return;
226 }
227 }else{
228 zVers = g.argv[2];
229 }
230 vid = load_vfile(zVers);
231
+1 -4
--- src/update.c
+++ src/update.c
@@ -125,13 +125,10 @@
125125
debugFlag = find_option("debug",0,0)!=0;
126126
setmtimeFlag = find_option("setmtime",0,0)!=0;
127127
capture_case_sensitive_option();
128128
db_must_be_within_tree();
129129
vid = db_lget_int("checkout", 0);
130
- if( vid==0 ){
131
- fossil_fatal("cannot find current version");
132
- }
133130
user_select();
134131
if( !dryRunFlag && !internalUpdate ){
135132
autosync(SYNC_PULL + SYNC_VERBOSE*verboseFlag);
136133
}
137134
@@ -200,11 +197,11 @@
200197
" ORDER BY event.mtime DESC");
201198
if( tid==0 ) tid = vid;
202199
}
203200
204201
if( tid==0 ){
205
- fossil_panic("unable to find a version to update to.");
202
+ return;
206203
}
207204
208205
db_begin_transaction();
209206
vfile_check_signature(vid, CKSIG_ENOTFILE);
210207
if( !dryRunFlag && !internalUpdate ) undo_begin();
211208
--- src/update.c
+++ src/update.c
@@ -125,13 +125,10 @@
125 debugFlag = find_option("debug",0,0)!=0;
126 setmtimeFlag = find_option("setmtime",0,0)!=0;
127 capture_case_sensitive_option();
128 db_must_be_within_tree();
129 vid = db_lget_int("checkout", 0);
130 if( vid==0 ){
131 fossil_fatal("cannot find current version");
132 }
133 user_select();
134 if( !dryRunFlag && !internalUpdate ){
135 autosync(SYNC_PULL + SYNC_VERBOSE*verboseFlag);
136 }
137
@@ -200,11 +197,11 @@
200 " ORDER BY event.mtime DESC");
201 if( tid==0 ) tid = vid;
202 }
203
204 if( tid==0 ){
205 fossil_panic("unable to find a version to update to.");
206 }
207
208 db_begin_transaction();
209 vfile_check_signature(vid, CKSIG_ENOTFILE);
210 if( !dryRunFlag && !internalUpdate ) undo_begin();
211
--- src/update.c
+++ src/update.c
@@ -125,13 +125,10 @@
125 debugFlag = find_option("debug",0,0)!=0;
126 setmtimeFlag = find_option("setmtime",0,0)!=0;
127 capture_case_sensitive_option();
128 db_must_be_within_tree();
129 vid = db_lget_int("checkout", 0);
 
 
 
130 user_select();
131 if( !dryRunFlag && !internalUpdate ){
132 autosync(SYNC_PULL + SYNC_VERBOSE*verboseFlag);
133 }
134
@@ -200,11 +197,11 @@
197 " ORDER BY event.mtime DESC");
198 if( tid==0 ) tid = vid;
199 }
200
201 if( tid==0 ){
202 return;
203 }
204
205 db_begin_transaction();
206 vfile_check_signature(vid, CKSIG_ENOTFILE);
207 if( !dryRunFlag && !internalUpdate ) undo_begin();
208

Keyboard Shortcuts

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