Differences From:
File
src/checkin.c
part of check-in
[6f0a9f730b]
- Mention that check-in comments follow wiki formatting rules. If the
check-in comment is blank, prompt the user to abort the check-in.
by
drh on
2008-11-26 03:26:56.
[view]
To:
File
src/checkin.c
part of check-in
[b6e22e62cf]
- Attempting to rationalize the tagging and branching logic. The "branch"
command has been resurrected and appears to work now. The "tag branch"
command has been removed. Special tags "newbranch" and "closed" used to
manage branches. New changes are not well-tested - use with caution.
You must "rebuild" when upgrading through this version.
by
drh on
2009-01-20 16:51:19.
[view]
@@ -347,8 +347,27 @@
}
}
/*
+** Return true if the check-in with RID=rid has one or more child
+** check-ins which are not tagged with "newbranch". In other words,
+** return true if the check-in is not a leaf.
+*/
+int is_not_a_leaf(int rid){
+ return db_exists(
+ "SELECT 1 FROM plink"
+ " WHERE pid=%d"
+ " AND NOT EXIST("
+ "SELECT 1 FROM tagxref"
+ " WHERE tagxref.rid=plink.cid"
+ " AND tagxref.tagid=%d"
+ " AND tagxref.tagtype=1"
+ ")",
+ rid, TAG_NEWBRANCH
+ );
+}
+
+/*
** COMMAND: ci
** COMMAND: commit
**
** Usage: %fossil commit ?-m COMMENT? ?--nosign? ?FILE...?
@@ -441,12 +460,12 @@
}
}
vid = db_lget_int("checkout", 0);
- if( db_exists("SELECT 1 FROM plink WHERE pid=%d", vid) ){
+ if( is_not_a_leaf(vid) ){
wouldFork=1;
if( forceFlag==0 ){
- fossil_fatal("would fork. use -f or --force");
+ fossil_fatal("would fork. \"update\" first or use -f or --force.");
}
}
vfile_aggregate_checksum_disk(vid, &cksum1);
if( zComment ){