Fossil SCM
Enhance the --detail option on the "merge" command to show the specific check-in that is being merged in and the baseline of the merge.
Commit
68d84047c0a4dcce7264d12bd324d334ea5371f7
Parent
b4a1c60ef648865…
1 file changed
+37
-1
+37
-1
| --- src/merge.c | ||
| +++ src/merge.c | ||
| @@ -20,10 +20,43 @@ | ||
| 20 | 20 | */ |
| 21 | 21 | #include "config.h" |
| 22 | 22 | #include "merge.h" |
| 23 | 23 | #include <assert.h> |
| 24 | 24 | |
| 25 | +/* | |
| 26 | +** Print information about a particular check-in. | |
| 27 | +*/ | |
| 28 | +void print_checkin_description(int rid, int indent, const char *zLabel){ | |
| 29 | + Stmt q; | |
| 30 | + db_prepare(&q, | |
| 31 | + "SELECT datetime(mtime,'localtime')," | |
| 32 | + " coalesce(euser,user), coalesce(ecomment,comment)," | |
| 33 | + " (SELECT uuid FROM blob WHERE rid=%d)," | |
| 34 | + " (SELECT group_concat(substr(tagname,5), ', ') FROM tag, tagxref" | |
| 35 | + " WHERE tagname GLOB 'sym-*' AND tag.tagid=tagxref.tagid" | |
| 36 | + " AND tagxref.rid=%d AND tagxref.tagtype>0)" | |
| 37 | + " FROM event WHERE objid=%d", rid, rid, rid); | |
| 38 | + if( db_step(&q)==SQLITE_ROW ){ | |
| 39 | + const char *zTagList = db_column_text(&q, 4); | |
| 40 | + char *zCom; | |
| 41 | + if( zTagList && zTagList[0] ){ | |
| 42 | + zCom = mprintf("%s (%s)", db_column_text(&q, 2), zTagList); | |
| 43 | + }else{ | |
| 44 | + zCom = mprintf("%s", db_column_text(&q,2)); | |
| 45 | + } | |
| 46 | + fossil_print("%-*s [%S] by %s on %s\n%*s", | |
| 47 | + indent-1, zLabel, | |
| 48 | + db_column_text(&q, 3), | |
| 49 | + db_column_text(&q, 1), | |
| 50 | + db_column_text(&q, 0), | |
| 51 | + indent, ""); | |
| 52 | + comment_print(zCom, indent, 78); | |
| 53 | + fossil_free(zCom); | |
| 54 | + } | |
| 55 | + db_finalize(&q); | |
| 56 | +} | |
| 57 | + | |
| 25 | 58 | |
| 26 | 59 | /* |
| 27 | 60 | ** COMMAND: merge |
| 28 | 61 | ** |
| 29 | 62 | ** Usage: %fossil merge ?OPTIONS? VERSION |
| @@ -116,11 +149,10 @@ | ||
| 116 | 149 | fossil_fatal("not a version: %s", zPivot); |
| 117 | 150 | } |
| 118 | 151 | if( pickFlag ){ |
| 119 | 152 | fossil_fatal("incompatible options: --cherrypick & --baseline"); |
| 120 | 153 | } |
| 121 | - /* pickFlag = 1; // Using --baseline is really like doing a cherrypick */ | |
| 122 | 154 | }else if( pickFlag || backoutFlag ){ |
| 123 | 155 | pid = db_int(0, "SELECT pid FROM plink WHERE cid=%d AND isprim", mid); |
| 124 | 156 | if( pid<=0 ){ |
| 125 | 157 | fossil_fatal("cannot find an ancestor for %s", g.argv[2]); |
| 126 | 158 | } |
| @@ -144,10 +176,14 @@ | ||
| 144 | 176 | mid = t; |
| 145 | 177 | } |
| 146 | 178 | if( !is_a_version(pid) ){ |
| 147 | 179 | fossil_fatal("not a version: record #%d", pid); |
| 148 | 180 | } |
| 181 | + if( detailFlag ){ | |
| 182 | + print_checkin_description(mid, 12, "merge-from:"); | |
| 183 | + print_checkin_description(pid, 12, "baseline:"); | |
| 184 | + } | |
| 149 | 185 | vfile_check_signature(vid, 1, 0); |
| 150 | 186 | db_begin_transaction(); |
| 151 | 187 | if( !nochangeFlag ) undo_begin(); |
| 152 | 188 | load_vfile_from_rid(mid); |
| 153 | 189 | load_vfile_from_rid(pid); |
| 154 | 190 |
| --- src/merge.c | |
| +++ src/merge.c | |
| @@ -20,10 +20,43 @@ | |
| 20 | */ |
| 21 | #include "config.h" |
| 22 | #include "merge.h" |
| 23 | #include <assert.h> |
| 24 | |
| 25 | |
| 26 | /* |
| 27 | ** COMMAND: merge |
| 28 | ** |
| 29 | ** Usage: %fossil merge ?OPTIONS? VERSION |
| @@ -116,11 +149,10 @@ | |
| 116 | fossil_fatal("not a version: %s", zPivot); |
| 117 | } |
| 118 | if( pickFlag ){ |
| 119 | fossil_fatal("incompatible options: --cherrypick & --baseline"); |
| 120 | } |
| 121 | /* pickFlag = 1; // Using --baseline is really like doing a cherrypick */ |
| 122 | }else if( pickFlag || backoutFlag ){ |
| 123 | pid = db_int(0, "SELECT pid FROM plink WHERE cid=%d AND isprim", mid); |
| 124 | if( pid<=0 ){ |
| 125 | fossil_fatal("cannot find an ancestor for %s", g.argv[2]); |
| 126 | } |
| @@ -144,10 +176,14 @@ | |
| 144 | mid = t; |
| 145 | } |
| 146 | if( !is_a_version(pid) ){ |
| 147 | fossil_fatal("not a version: record #%d", pid); |
| 148 | } |
| 149 | vfile_check_signature(vid, 1, 0); |
| 150 | db_begin_transaction(); |
| 151 | if( !nochangeFlag ) undo_begin(); |
| 152 | load_vfile_from_rid(mid); |
| 153 | load_vfile_from_rid(pid); |
| 154 |
| --- src/merge.c | |
| +++ src/merge.c | |
| @@ -20,10 +20,43 @@ | |
| 20 | */ |
| 21 | #include "config.h" |
| 22 | #include "merge.h" |
| 23 | #include <assert.h> |
| 24 | |
| 25 | /* |
| 26 | ** Print information about a particular check-in. |
| 27 | */ |
| 28 | void print_checkin_description(int rid, int indent, const char *zLabel){ |
| 29 | Stmt q; |
| 30 | db_prepare(&q, |
| 31 | "SELECT datetime(mtime,'localtime')," |
| 32 | " coalesce(euser,user), coalesce(ecomment,comment)," |
| 33 | " (SELECT uuid FROM blob WHERE rid=%d)," |
| 34 | " (SELECT group_concat(substr(tagname,5), ', ') FROM tag, tagxref" |
| 35 | " WHERE tagname GLOB 'sym-*' AND tag.tagid=tagxref.tagid" |
| 36 | " AND tagxref.rid=%d AND tagxref.tagtype>0)" |
| 37 | " FROM event WHERE objid=%d", rid, rid, rid); |
| 38 | if( db_step(&q)==SQLITE_ROW ){ |
| 39 | const char *zTagList = db_column_text(&q, 4); |
| 40 | char *zCom; |
| 41 | if( zTagList && zTagList[0] ){ |
| 42 | zCom = mprintf("%s (%s)", db_column_text(&q, 2), zTagList); |
| 43 | }else{ |
| 44 | zCom = mprintf("%s", db_column_text(&q,2)); |
| 45 | } |
| 46 | fossil_print("%-*s [%S] by %s on %s\n%*s", |
| 47 | indent-1, zLabel, |
| 48 | db_column_text(&q, 3), |
| 49 | db_column_text(&q, 1), |
| 50 | db_column_text(&q, 0), |
| 51 | indent, ""); |
| 52 | comment_print(zCom, indent, 78); |
| 53 | fossil_free(zCom); |
| 54 | } |
| 55 | db_finalize(&q); |
| 56 | } |
| 57 | |
| 58 | |
| 59 | /* |
| 60 | ** COMMAND: merge |
| 61 | ** |
| 62 | ** Usage: %fossil merge ?OPTIONS? VERSION |
| @@ -116,11 +149,10 @@ | |
| 149 | fossil_fatal("not a version: %s", zPivot); |
| 150 | } |
| 151 | if( pickFlag ){ |
| 152 | fossil_fatal("incompatible options: --cherrypick & --baseline"); |
| 153 | } |
| 154 | }else if( pickFlag || backoutFlag ){ |
| 155 | pid = db_int(0, "SELECT pid FROM plink WHERE cid=%d AND isprim", mid); |
| 156 | if( pid<=0 ){ |
| 157 | fossil_fatal("cannot find an ancestor for %s", g.argv[2]); |
| 158 | } |
| @@ -144,10 +176,14 @@ | |
| 176 | mid = t; |
| 177 | } |
| 178 | if( !is_a_version(pid) ){ |
| 179 | fossil_fatal("not a version: record #%d", pid); |
| 180 | } |
| 181 | if( detailFlag ){ |
| 182 | print_checkin_description(mid, 12, "merge-from:"); |
| 183 | print_checkin_description(pid, 12, "baseline:"); |
| 184 | } |
| 185 | vfile_check_signature(vid, 1, 0); |
| 186 | db_begin_transaction(); |
| 187 | if( !nochangeFlag ) undo_begin(); |
| 188 | load_vfile_from_rid(mid); |
| 189 | load_vfile_from_rid(pid); |
| 190 |