Fossil SCM
When doing a "fossil update" if there are multiple descendents but only one descendent in the same branch as current, then go to that one descendent without complaining. Ticket [33d2bf39889352f2f]
Commit
4beacb6dc4721bf10faf3b1eb3c691a51ffdd4f0
Parent
dbb02ff1f945f6c…
1 file changed
+25
-10
+25
-10
| --- src/update.c | ||
| +++ src/update.c | ||
| @@ -96,22 +96,37 @@ | ||
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | if( tid==0 ){ |
| 101 | - compute_leaves(vid, 1); | |
| 102 | - if( !db_exists("SELECT 1 FROM leaves") ) compute_leaves(vid, 0); | |
| 101 | + int closeCode = 1; | |
| 102 | + compute_leaves(vid, closeCode); | |
| 103 | + if( !db_exists("SELECT 1 FROM leaves") ){ | |
| 104 | + closeCode = 0; | |
| 105 | + compute_leaves(vid, closeCode); | |
| 106 | + } | |
| 103 | 107 | if( !latestFlag && db_int(0, "SELECT count(*) FROM leaves")>1 ){ |
| 104 | - db_prepare(&q, | |
| 105 | - "%s " | |
| 106 | - " AND event.objid IN leaves" | |
| 107 | - " ORDER BY event.mtime DESC", | |
| 108 | - timeline_query_for_tty() | |
| 108 | + db_multi_exec( | |
| 109 | + "DELETE FROM leaves WHERE rid NOT IN" | |
| 110 | + " (SELECT leaves.rid FROM leaves, tagxref" | |
| 111 | + " WHERE leaves.rid=tagxref.rid AND tagxref.tagid=%d" | |
| 112 | + " AND tagxref.value==(SELECT value FROM tagxref" | |
| 113 | + " WHERE tagid=%d AND rid=%d))", | |
| 114 | + TAG_BRANCH, TAG_BRANCH, vid | |
| 109 | 115 | ); |
| 110 | - print_timeline(&q, 100); | |
| 111 | - db_finalize(&q); | |
| 112 | - fossil_fatal("Multiple descendants"); | |
| 116 | + if( db_int(0, "SELECT count(*) FROM leaves")>1 ){ | |
| 117 | + compute_leaves(vid, closeCode); | |
| 118 | + db_prepare(&q, | |
| 119 | + "%s " | |
| 120 | + " AND event.objid IN leaves" | |
| 121 | + " ORDER BY event.mtime DESC", | |
| 122 | + timeline_query_for_tty() | |
| 123 | + ); | |
| 124 | + print_timeline(&q, 100); | |
| 125 | + db_finalize(&q); | |
| 126 | + fossil_fatal("Multiple descendants"); | |
| 127 | + } | |
| 113 | 128 | } |
| 114 | 129 | tid = db_int(0, "SELECT rid FROM leaves, event" |
| 115 | 130 | " WHERE event.objid=leaves.rid" |
| 116 | 131 | " ORDER BY event.mtime DESC"); |
| 117 | 132 | } |
| 118 | 133 |
| --- src/update.c | |
| +++ src/update.c | |
| @@ -96,22 +96,37 @@ | |
| 96 | } |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | if( tid==0 ){ |
| 101 | compute_leaves(vid, 1); |
| 102 | if( !db_exists("SELECT 1 FROM leaves") ) compute_leaves(vid, 0); |
| 103 | if( !latestFlag && db_int(0, "SELECT count(*) FROM leaves")>1 ){ |
| 104 | db_prepare(&q, |
| 105 | "%s " |
| 106 | " AND event.objid IN leaves" |
| 107 | " ORDER BY event.mtime DESC", |
| 108 | timeline_query_for_tty() |
| 109 | ); |
| 110 | print_timeline(&q, 100); |
| 111 | db_finalize(&q); |
| 112 | fossil_fatal("Multiple descendants"); |
| 113 | } |
| 114 | tid = db_int(0, "SELECT rid FROM leaves, event" |
| 115 | " WHERE event.objid=leaves.rid" |
| 116 | " ORDER BY event.mtime DESC"); |
| 117 | } |
| 118 |
| --- src/update.c | |
| +++ src/update.c | |
| @@ -96,22 +96,37 @@ | |
| 96 | } |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | if( tid==0 ){ |
| 101 | int closeCode = 1; |
| 102 | compute_leaves(vid, closeCode); |
| 103 | if( !db_exists("SELECT 1 FROM leaves") ){ |
| 104 | closeCode = 0; |
| 105 | compute_leaves(vid, closeCode); |
| 106 | } |
| 107 | if( !latestFlag && db_int(0, "SELECT count(*) FROM leaves")>1 ){ |
| 108 | db_multi_exec( |
| 109 | "DELETE FROM leaves WHERE rid NOT IN" |
| 110 | " (SELECT leaves.rid FROM leaves, tagxref" |
| 111 | " WHERE leaves.rid=tagxref.rid AND tagxref.tagid=%d" |
| 112 | " AND tagxref.value==(SELECT value FROM tagxref" |
| 113 | " WHERE tagid=%d AND rid=%d))", |
| 114 | TAG_BRANCH, TAG_BRANCH, vid |
| 115 | ); |
| 116 | if( db_int(0, "SELECT count(*) FROM leaves")>1 ){ |
| 117 | compute_leaves(vid, closeCode); |
| 118 | db_prepare(&q, |
| 119 | "%s " |
| 120 | " AND event.objid IN leaves" |
| 121 | " ORDER BY event.mtime DESC", |
| 122 | timeline_query_for_tty() |
| 123 | ); |
| 124 | print_timeline(&q, 100); |
| 125 | db_finalize(&q); |
| 126 | fossil_fatal("Multiple descendants"); |
| 127 | } |
| 128 | } |
| 129 | tid = db_int(0, "SELECT rid FROM leaves, event" |
| 130 | " WHERE event.objid=leaves.rid" |
| 131 | " ORDER BY event.mtime DESC"); |
| 132 | } |
| 133 |