Fossil SCM

Refuse to close a check-out if the stash is non-empty and the -f flag is omitted.

drh 2013-06-22 20:25 trunk
Commit c6aedbd0bd48ad7b5df07da49895e5fb47e4707b
1 file changed +8 -1
+8 -1
--- src/checkout.c
+++ src/checkout.c
@@ -278,11 +278,11 @@
278278
**
279279
** Usage: %fossil close ?OPTIONS?
280280
**
281281
** The opposite of "open". Close the current database connection.
282282
** Require a -f or --force flag if there are unsaved changed in the
283
-** current check-out.
283
+** current check-out or if there is non-empty stash.
284284
**
285285
** Options:
286286
** --force|-f necessary to close a check out with uncommitted changes
287287
**
288288
** See also: open
@@ -291,12 +291,19 @@
291291
int forceFlag = find_option("force","f",0)!=0;
292292
db_must_be_within_tree();
293293
if( !forceFlag && unsaved_changes()==1 ){
294294
fossil_fatal("there are unsaved changes in the current checkout");
295295
}
296
+ if( !forceFlag
297
+ && db_exists("SELECT 1 FROM %s.sqlite_master WHERE name='stash'",
298
+ db_name("localdb"))
299
+ && db_exists("SELECT 1 FROM %s.stash", db_name("localdb"))
300
+ ){
301
+ fossil_fatal("closing the checkout will delete your stash");
302
+ }
296303
if( db_is_writeable("repository") ){
297304
db_multi_exec("DELETE FROM config WHERE name='ckout:%q'", g.zLocalRoot);
298305
}
299306
unlink_local_database(1);
300307
db_close(1);
301308
unlink_local_database(0);
302309
}
303310
--- src/checkout.c
+++ src/checkout.c
@@ -278,11 +278,11 @@
278 **
279 ** Usage: %fossil close ?OPTIONS?
280 **
281 ** The opposite of "open". Close the current database connection.
282 ** Require a -f or --force flag if there are unsaved changed in the
283 ** current check-out.
284 **
285 ** Options:
286 ** --force|-f necessary to close a check out with uncommitted changes
287 **
288 ** See also: open
@@ -291,12 +291,19 @@
291 int forceFlag = find_option("force","f",0)!=0;
292 db_must_be_within_tree();
293 if( !forceFlag && unsaved_changes()==1 ){
294 fossil_fatal("there are unsaved changes in the current checkout");
295 }
 
 
 
 
 
 
 
296 if( db_is_writeable("repository") ){
297 db_multi_exec("DELETE FROM config WHERE name='ckout:%q'", g.zLocalRoot);
298 }
299 unlink_local_database(1);
300 db_close(1);
301 unlink_local_database(0);
302 }
303
--- src/checkout.c
+++ src/checkout.c
@@ -278,11 +278,11 @@
278 **
279 ** Usage: %fossil close ?OPTIONS?
280 **
281 ** The opposite of "open". Close the current database connection.
282 ** Require a -f or --force flag if there are unsaved changed in the
283 ** current check-out or if there is non-empty stash.
284 **
285 ** Options:
286 ** --force|-f necessary to close a check out with uncommitted changes
287 **
288 ** See also: open
@@ -291,12 +291,19 @@
291 int forceFlag = find_option("force","f",0)!=0;
292 db_must_be_within_tree();
293 if( !forceFlag && unsaved_changes()==1 ){
294 fossil_fatal("there are unsaved changes in the current checkout");
295 }
296 if( !forceFlag
297 && db_exists("SELECT 1 FROM %s.sqlite_master WHERE name='stash'",
298 db_name("localdb"))
299 && db_exists("SELECT 1 FROM %s.stash", db_name("localdb"))
300 ){
301 fossil_fatal("closing the checkout will delete your stash");
302 }
303 if( db_is_writeable("repository") ){
304 db_multi_exec("DELETE FROM config WHERE name='ckout:%q'", g.zLocalRoot);
305 }
306 unlink_local_database(1);
307 db_close(1);
308 unlink_local_database(0);
309 }
310

Keyboard Shortcuts

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