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.
Commit
b725c1cf266b766626c4874d4d5a20978b57ca2e
Parent
6e4e16fb8c0568b…
3 files changed
-6
+1
-1
+1
-4
-6
| --- src/add.c | ||
| +++ src/add.c | ||
| @@ -258,13 +258,10 @@ | ||
| 258 | 258 | } |
| 259 | 259 | if( zIgnoreFlag==0 ){ |
| 260 | 260 | zIgnoreFlag = db_get("ignore-glob", 0); |
| 261 | 261 | } |
| 262 | 262 | vid = db_lget_int("checkout",0); |
| 263 | - if( vid==0 ){ | |
| 264 | - fossil_fatal("no checkout to add to"); | |
| 265 | - } | |
| 266 | 263 | db_begin_transaction(); |
| 267 | 264 | db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY %s)", |
| 268 | 265 | filename_collation()); |
| 269 | 266 | pClean = glob_create(zCleanFlag); |
| 270 | 267 | pIgnore = glob_create(zIgnoreFlag); |
| @@ -500,13 +497,10 @@ | ||
| 500 | 497 | } |
| 501 | 498 | if( zIgnoreFlag==0 ){ |
| 502 | 499 | zIgnoreFlag = db_get("ignore-glob", 0); |
| 503 | 500 | } |
| 504 | 501 | vid = db_lget_int("checkout",0); |
| 505 | - if( vid==0 ){ | |
| 506 | - fossil_fatal("no checkout to add to"); | |
| 507 | - } | |
| 508 | 502 | db_begin_transaction(); |
| 509 | 503 | |
| 510 | 504 | /* step 1: |
| 511 | 505 | ** Populate the temp table "sfile" with the names of all unmanaged |
| 512 | 506 | ** files currently in the check-out, except for files that match the |
| 513 | 507 |
| --- 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 @@ | ||
| 220 | 220 | zVers = db_text(0, "SELECT uuid FROM event, blob" |
| 221 | 221 | " WHERE event.objid=blob.rid AND event.type='ci'" |
| 222 | 222 | " ORDER BY event.mtime DESC"); |
| 223 | 223 | } |
| 224 | 224 | if( zVers==0 ){ |
| 225 | - fossil_fatal("cannot locate \"latest\" checkout"); | |
| 225 | + return; | |
| 226 | 226 | } |
| 227 | 227 | }else{ |
| 228 | 228 | zVers = g.argv[2]; |
| 229 | 229 | } |
| 230 | 230 | vid = load_vfile(zVers); |
| 231 | 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 | 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 @@ | ||
| 125 | 125 | debugFlag = find_option("debug",0,0)!=0; |
| 126 | 126 | setmtimeFlag = find_option("setmtime",0,0)!=0; |
| 127 | 127 | capture_case_sensitive_option(); |
| 128 | 128 | db_must_be_within_tree(); |
| 129 | 129 | vid = db_lget_int("checkout", 0); |
| 130 | - if( vid==0 ){ | |
| 131 | - fossil_fatal("cannot find current version"); | |
| 132 | - } | |
| 133 | 130 | user_select(); |
| 134 | 131 | if( !dryRunFlag && !internalUpdate ){ |
| 135 | 132 | autosync(SYNC_PULL + SYNC_VERBOSE*verboseFlag); |
| 136 | 133 | } |
| 137 | 134 | |
| @@ -200,11 +197,11 @@ | ||
| 200 | 197 | " ORDER BY event.mtime DESC"); |
| 201 | 198 | if( tid==0 ) tid = vid; |
| 202 | 199 | } |
| 203 | 200 | |
| 204 | 201 | if( tid==0 ){ |
| 205 | - fossil_panic("unable to find a version to update to."); | |
| 202 | + return; | |
| 206 | 203 | } |
| 207 | 204 | |
| 208 | 205 | db_begin_transaction(); |
| 209 | 206 | vfile_check_signature(vid, CKSIG_ENOTFILE); |
| 210 | 207 | if( !dryRunFlag && !internalUpdate ) undo_begin(); |
| 211 | 208 |
| --- 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 |