Fossil SCM
Upgrade the test-find-pivot command to the merge-base command, per discussion at [forum:1f5db4364464e965|forum post 1f5db4364464e965].
Commit
2b6649c74384ce871e2cab8cd56ced0560ef8e9c0a22a1db9bf643645a76eb31
Parent
95e5814c9bac007…
2 files changed
+12
-7
+1
+12
-7
| --- src/pivot.c | ||
| +++ src/pivot.c | ||
| @@ -152,35 +152,40 @@ | ||
| 152 | 152 | db_finalize(&u1); |
| 153 | 153 | return rid; |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | /* |
| 157 | -** COMMAND: test-find-pivot | |
| 157 | +** COMMAND: merge-base | |
| 158 | 158 | ** |
| 159 | -** Usage: %fossil test-find-pivot ?options? PRIMARY SECONDARY ... | |
| 159 | +** Usage: %fossil merge-base ?options? PRIMARY SECONDARY ... | |
| 160 | 160 | ** |
| 161 | -** Test the pivot_find() procedure. | |
| 161 | +** Find a common ancestor given two or more checkin versions to | |
| 162 | +** hypothetically merge. | |
| 162 | 163 | ** |
| 163 | 164 | ** Options: |
| 164 | 165 | ** --ignore-merges Ignore merges for discovering name pivots |
| 165 | 166 | */ |
| 166 | 167 | void test_find_pivot(void){ |
| 167 | 168 | int i, rid; |
| 168 | 169 | int ignoreMerges = find_option("ignore-merges",0,0)!=0; |
| 169 | - int showDetails = find_option("details",0,0)!=0; | |
| 170 | + int showDetails = find_option("details",0,0)!=0 | |
| 171 | + /* intentionally undocumented */; | |
| 170 | 172 | if( g.argc<4 ){ |
| 171 | 173 | usage("?options? PRIMARY SECONDARY ..."); |
| 172 | 174 | } |
| 173 | 175 | db_must_be_within_tree(); |
| 174 | 176 | pivot_set_primary(name_to_rid(g.argv[2])); |
| 175 | 177 | for(i=3; i<g.argc; i++){ |
| 176 | 178 | pivot_set_secondary(name_to_rid(g.argv[i])); |
| 177 | 179 | } |
| 178 | 180 | rid = pivot_find(ignoreMerges); |
| 179 | - printf("pivot=%s\n", | |
| 180 | - db_text("?","SELECT uuid FROM blob WHERE rid=%d",rid) | |
| 181 | - ); | |
| 181 | + if( rid==0 ){ | |
| 182 | + puts("No common ancestor found."); | |
| 183 | + }else{ | |
| 184 | + printf("pivot=%s\n", | |
| 185 | + db_text("?","SELECT uuid FROM blob WHERE rid=%d",rid)); | |
| 186 | + } | |
| 182 | 187 | if( showDetails ){ |
| 183 | 188 | Stmt q; |
| 184 | 189 | db_prepare(&q, |
| 185 | 190 | "SELECT substr(uuid,1,12), aqueue.rid, datetime(aqueue.mtime)," |
| 186 | 191 | " aqueue.pending, aqueue.src\n" |
| 187 | 192 |
| --- src/pivot.c | |
| +++ src/pivot.c | |
| @@ -152,35 +152,40 @@ | |
| 152 | db_finalize(&u1); |
| 153 | return rid; |
| 154 | } |
| 155 | |
| 156 | /* |
| 157 | ** COMMAND: test-find-pivot |
| 158 | ** |
| 159 | ** Usage: %fossil test-find-pivot ?options? PRIMARY SECONDARY ... |
| 160 | ** |
| 161 | ** Test the pivot_find() procedure. |
| 162 | ** |
| 163 | ** Options: |
| 164 | ** --ignore-merges Ignore merges for discovering name pivots |
| 165 | */ |
| 166 | void test_find_pivot(void){ |
| 167 | int i, rid; |
| 168 | int ignoreMerges = find_option("ignore-merges",0,0)!=0; |
| 169 | int showDetails = find_option("details",0,0)!=0; |
| 170 | if( g.argc<4 ){ |
| 171 | usage("?options? PRIMARY SECONDARY ..."); |
| 172 | } |
| 173 | db_must_be_within_tree(); |
| 174 | pivot_set_primary(name_to_rid(g.argv[2])); |
| 175 | for(i=3; i<g.argc; i++){ |
| 176 | pivot_set_secondary(name_to_rid(g.argv[i])); |
| 177 | } |
| 178 | rid = pivot_find(ignoreMerges); |
| 179 | printf("pivot=%s\n", |
| 180 | db_text("?","SELECT uuid FROM blob WHERE rid=%d",rid) |
| 181 | ); |
| 182 | if( showDetails ){ |
| 183 | Stmt q; |
| 184 | db_prepare(&q, |
| 185 | "SELECT substr(uuid,1,12), aqueue.rid, datetime(aqueue.mtime)," |
| 186 | " aqueue.pending, aqueue.src\n" |
| 187 |
| --- src/pivot.c | |
| +++ src/pivot.c | |
| @@ -152,35 +152,40 @@ | |
| 152 | db_finalize(&u1); |
| 153 | return rid; |
| 154 | } |
| 155 | |
| 156 | /* |
| 157 | ** COMMAND: merge-base |
| 158 | ** |
| 159 | ** Usage: %fossil merge-base ?options? PRIMARY SECONDARY ... |
| 160 | ** |
| 161 | ** Find a common ancestor given two or more checkin versions to |
| 162 | ** hypothetically merge. |
| 163 | ** |
| 164 | ** Options: |
| 165 | ** --ignore-merges Ignore merges for discovering name pivots |
| 166 | */ |
| 167 | void test_find_pivot(void){ |
| 168 | int i, rid; |
| 169 | int ignoreMerges = find_option("ignore-merges",0,0)!=0; |
| 170 | int showDetails = find_option("details",0,0)!=0 |
| 171 | /* intentionally undocumented */; |
| 172 | if( g.argc<4 ){ |
| 173 | usage("?options? PRIMARY SECONDARY ..."); |
| 174 | } |
| 175 | db_must_be_within_tree(); |
| 176 | pivot_set_primary(name_to_rid(g.argv[2])); |
| 177 | for(i=3; i<g.argc; i++){ |
| 178 | pivot_set_secondary(name_to_rid(g.argv[i])); |
| 179 | } |
| 180 | rid = pivot_find(ignoreMerges); |
| 181 | if( rid==0 ){ |
| 182 | puts("No common ancestor found."); |
| 183 | }else{ |
| 184 | printf("pivot=%s\n", |
| 185 | db_text("?","SELECT uuid FROM blob WHERE rid=%d",rid)); |
| 186 | } |
| 187 | if( showDetails ){ |
| 188 | Stmt q; |
| 189 | db_prepare(&q, |
| 190 | "SELECT substr(uuid,1,12), aqueue.rid, datetime(aqueue.mtime)," |
| 191 | " aqueue.pending, aqueue.src\n" |
| 192 |
+1
| --- www/changes.wiki | ||
| +++ www/changes.wiki | ||
| @@ -1,9 +1,10 @@ | ||
| 1 | 1 | <title>Change Log</title> |
| 2 | 2 | |
| 3 | 3 | <h2 id='v2_21'>Changes for version 2.21 (pending)</h2> |
| 4 | 4 | * Add the ability to put text descriptions on ticket report formats. |
| 5 | + * Upgrade the test-find-pivot command to the [/help/merge-base|merge-base command]. | |
| 5 | 6 | |
| 6 | 7 | <h2 id='v2_20'>Changes for version 2.20 (2022-11-16)</h2> |
| 7 | 8 | * Added the [/help?cmd=chat-timeline-user|chat-timeline-user setting]. If |
| 8 | 9 | it is not an empty string, then any changes that would appear on the timeline |
| 9 | 10 | are announced in [./chat.md|the chat room]. |
| 10 | 11 |
| --- www/changes.wiki | |
| +++ www/changes.wiki | |
| @@ -1,9 +1,10 @@ | |
| 1 | <title>Change Log</title> |
| 2 | |
| 3 | <h2 id='v2_21'>Changes for version 2.21 (pending)</h2> |
| 4 | * Add the ability to put text descriptions on ticket report formats. |
| 5 | |
| 6 | <h2 id='v2_20'>Changes for version 2.20 (2022-11-16)</h2> |
| 7 | * Added the [/help?cmd=chat-timeline-user|chat-timeline-user setting]. If |
| 8 | it is not an empty string, then any changes that would appear on the timeline |
| 9 | are announced in [./chat.md|the chat room]. |
| 10 |
| --- www/changes.wiki | |
| +++ www/changes.wiki | |
| @@ -1,9 +1,10 @@ | |
| 1 | <title>Change Log</title> |
| 2 | |
| 3 | <h2 id='v2_21'>Changes for version 2.21 (pending)</h2> |
| 4 | * Add the ability to put text descriptions on ticket report formats. |
| 5 | * Upgrade the test-find-pivot command to the [/help/merge-base|merge-base command]. |
| 6 | |
| 7 | <h2 id='v2_20'>Changes for version 2.20 (2022-11-16)</h2> |
| 8 | * Added the [/help?cmd=chat-timeline-user|chat-timeline-user setting]. If |
| 9 | it is not an empty string, then any changes that would appear on the timeline |
| 10 | are announced in [./chat.md|the chat room]. |
| 11 |