Fossil SCM

Allow commits against a closed leaf as long as the new commit is on a different branch.

drh 2014-07-19 19:20 trunk merge
Commit 619fa857c9330c10ade2a1e23ee7faa193f347cb
2 files changed +13 -3 +13 -3
+13 -3
--- src/checkin.c
+++ src/checkin.c
@@ -1677,15 +1677,25 @@
16771677
){
16781678
fossil_fatal("would fork. \"update\" first or use --allow-fork.");
16791679
}
16801680
16811681
/*
1682
- ** Do not allow a commit against a closed leaf on the same branch.
1682
+ ** Do not allow a commit against a closed leaf unless the commit
1683
+ ** ends up on a different branch.
16831684
*/
1684
- if( !sCiInfo.zBranch && db_exists("SELECT 1 FROM tagxref"
1685
+ if(
1686
+ /* parent checkin has the "closed" tag... */
1687
+ db_exists("SELECT 1 FROM tagxref"
16851688
" WHERE tagid=%d AND rid=%d AND tagtype>0",
1686
- TAG_CLOSED, vid) ){
1689
+ TAG_CLOSED, vid)
1690
+ /* ... and the new checkin has no --branch option or the --branch
1691
+ ** option does not actually change the branch */
1692
+ && (sCiInfo.zBranch==0
1693
+ || db_exists("SELECT 1 FROM tagxref"
1694
+ " WHERE tagid=%d AND rid=%d AND tagtype>0"
1695
+ " AND value=%Q", TAG_BRANCH, vid, sCiInfo.zBranch))
1696
+ ){
16871697
fossil_fatal("cannot commit against a closed leaf");
16881698
}
16891699
16901700
if( useCksum ) vfile_aggregate_checksum_disk(vid, &cksum1);
16911701
if( zComment ){
16921702
--- src/checkin.c
+++ src/checkin.c
@@ -1677,15 +1677,25 @@
1677 ){
1678 fossil_fatal("would fork. \"update\" first or use --allow-fork.");
1679 }
1680
1681 /*
1682 ** Do not allow a commit against a closed leaf on the same branch.
 
1683 */
1684 if( !sCiInfo.zBranch && db_exists("SELECT 1 FROM tagxref"
 
 
1685 " WHERE tagid=%d AND rid=%d AND tagtype>0",
1686 TAG_CLOSED, vid) ){
 
 
 
 
 
 
 
1687 fossil_fatal("cannot commit against a closed leaf");
1688 }
1689
1690 if( useCksum ) vfile_aggregate_checksum_disk(vid, &cksum1);
1691 if( zComment ){
1692
--- src/checkin.c
+++ src/checkin.c
@@ -1677,15 +1677,25 @@
1677 ){
1678 fossil_fatal("would fork. \"update\" first or use --allow-fork.");
1679 }
1680
1681 /*
1682 ** Do not allow a commit against a closed leaf unless the commit
1683 ** ends up on a different branch.
1684 */
1685 if(
1686 /* parent checkin has the "closed" tag... */
1687 db_exists("SELECT 1 FROM tagxref"
1688 " WHERE tagid=%d AND rid=%d AND tagtype>0",
1689 TAG_CLOSED, vid)
1690 /* ... and the new checkin has no --branch option or the --branch
1691 ** option does not actually change the branch */
1692 && (sCiInfo.zBranch==0
1693 || db_exists("SELECT 1 FROM tagxref"
1694 " WHERE tagid=%d AND rid=%d AND tagtype>0"
1695 " AND value=%Q", TAG_BRANCH, vid, sCiInfo.zBranch))
1696 ){
1697 fossil_fatal("cannot commit against a closed leaf");
1698 }
1699
1700 if( useCksum ) vfile_aggregate_checksum_disk(vid, &cksum1);
1701 if( zComment ){
1702
+13 -3
--- src/checkin.c
+++ src/checkin.c
@@ -1677,15 +1677,25 @@
16771677
){
16781678
fossil_fatal("would fork. \"update\" first or use --allow-fork.");
16791679
}
16801680
16811681
/*
1682
- ** Do not allow a commit against a closed leaf on the same branch.
1682
+ ** Do not allow a commit against a closed leaf unless the commit
1683
+ ** ends up on a different branch.
16831684
*/
1684
- if( !sCiInfo.zBranch && db_exists("SELECT 1 FROM tagxref"
1685
+ if(
1686
+ /* parent checkin has the "closed" tag... */
1687
+ db_exists("SELECT 1 FROM tagxref"
16851688
" WHERE tagid=%d AND rid=%d AND tagtype>0",
1686
- TAG_CLOSED, vid) ){
1689
+ TAG_CLOSED, vid)
1690
+ /* ... and the new checkin has no --branch option or the --branch
1691
+ ** option does not actually change the branch */
1692
+ && (sCiInfo.zBranch==0
1693
+ || db_exists("SELECT 1 FROM tagxref"
1694
+ " WHERE tagid=%d AND rid=%d AND tagtype>0"
1695
+ " AND value=%Q", TAG_BRANCH, vid, sCiInfo.zBranch))
1696
+ ){
16871697
fossil_fatal("cannot commit against a closed leaf");
16881698
}
16891699
16901700
if( useCksum ) vfile_aggregate_checksum_disk(vid, &cksum1);
16911701
if( zComment ){
16921702
--- src/checkin.c
+++ src/checkin.c
@@ -1677,15 +1677,25 @@
1677 ){
1678 fossil_fatal("would fork. \"update\" first or use --allow-fork.");
1679 }
1680
1681 /*
1682 ** Do not allow a commit against a closed leaf on the same branch.
 
1683 */
1684 if( !sCiInfo.zBranch && db_exists("SELECT 1 FROM tagxref"
 
 
1685 " WHERE tagid=%d AND rid=%d AND tagtype>0",
1686 TAG_CLOSED, vid) ){
 
 
 
 
 
 
 
1687 fossil_fatal("cannot commit against a closed leaf");
1688 }
1689
1690 if( useCksum ) vfile_aggregate_checksum_disk(vid, &cksum1);
1691 if( zComment ){
1692
--- src/checkin.c
+++ src/checkin.c
@@ -1677,15 +1677,25 @@
1677 ){
1678 fossil_fatal("would fork. \"update\" first or use --allow-fork.");
1679 }
1680
1681 /*
1682 ** Do not allow a commit against a closed leaf unless the commit
1683 ** ends up on a different branch.
1684 */
1685 if(
1686 /* parent checkin has the "closed" tag... */
1687 db_exists("SELECT 1 FROM tagxref"
1688 " WHERE tagid=%d AND rid=%d AND tagtype>0",
1689 TAG_CLOSED, vid)
1690 /* ... and the new checkin has no --branch option or the --branch
1691 ** option does not actually change the branch */
1692 && (sCiInfo.zBranch==0
1693 || db_exists("SELECT 1 FROM tagxref"
1694 " WHERE tagid=%d AND rid=%d AND tagtype>0"
1695 " AND value=%Q", TAG_BRANCH, vid, sCiInfo.zBranch))
1696 ){
1697 fossil_fatal("cannot commit against a closed leaf");
1698 }
1699
1700 if( useCksum ) vfile_aggregate_checksum_disk(vid, &cksum1);
1701 if( zComment ){
1702

Keyboard Shortcuts

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