Fossil SCM
Move filename info into the corresponding merge-info table. Start adding infrastructure for emitting HTML-mode output to the content columns.
Commit
e3a3f0a5f224492ec0c4b1379e31e262760e6f139f694335faf289148e57cf91
Parent
5a1da556d69b208…
2 files changed
+3
+34
-19
+3
| --- src/merge.c | ||
| +++ src/merge.c | ||
| @@ -255,10 +255,13 @@ | ||
| 255 | 255 | ** we should probably apply change status markers like the |
| 256 | 256 | ** diff view does. |
| 257 | 257 | */ |
| 258 | 258 | static void merge_info_html_css(Blob *p){ |
| 259 | 259 | blob_append(p, "<style>\n", -1); |
| 260 | + blob_append(p, "table.diff {\n" | |
| 261 | + "margin-bottom: 1em;" | |
| 262 | + "}\n", -1); | |
| 260 | 263 | blob_append(p, "tr.diffchunk {\n" |
| 261 | 264 | "display: grid; gap: 0px 0px;\n" |
| 262 | 265 | "grid-template-rows: 1fr;\n" |
| 263 | 266 | "grid-template-columns: " |
| 264 | 267 | "auto 1fr auto " /* # baseline sep */ |
| 265 | 268 |
| --- src/merge.c | |
| +++ src/merge.c | |
| @@ -255,10 +255,13 @@ | |
| 255 | ** we should probably apply change status markers like the |
| 256 | ** diff view does. |
| 257 | */ |
| 258 | static void merge_info_html_css(Blob *p){ |
| 259 | blob_append(p, "<style>\n", -1); |
| 260 | blob_append(p, "tr.diffchunk {\n" |
| 261 | "display: grid; gap: 0px 0px;\n" |
| 262 | "grid-template-rows: 1fr;\n" |
| 263 | "grid-template-columns: " |
| 264 | "auto 1fr auto " /* # baseline sep */ |
| 265 |
| --- src/merge.c | |
| +++ src/merge.c | |
| @@ -255,10 +255,13 @@ | |
| 255 | ** we should probably apply change status markers like the |
| 256 | ** diff view does. |
| 257 | */ |
| 258 | static void merge_info_html_css(Blob *p){ |
| 259 | blob_append(p, "<style>\n", -1); |
| 260 | blob_append(p, "table.diff {\n" |
| 261 | "margin-bottom: 1em;" |
| 262 | "}\n", -1); |
| 263 | blob_append(p, "tr.diffchunk {\n" |
| 264 | "display: grid; gap: 0px 0px;\n" |
| 265 | "grid-template-rows: 1fr;\n" |
| 266 | "grid-template-columns: " |
| 267 | "auto 1fr auto " /* # baseline sep */ |
| 268 |
+34
-19
| --- src/merge3.c | ||
| +++ src/merge3.c | ||
| @@ -712,44 +712,59 @@ | ||
| 712 | 712 | p->xChngV1 = tclChngV1; |
| 713 | 713 | p->xChngV2 = tclChngV2; |
| 714 | 714 | p->xChngBoth = tclChngBoth; |
| 715 | 715 | p->xConflict = tclConflict; |
| 716 | 716 | } |
| 717 | + | |
| 718 | +/* | |
| 719 | +** Works like blob_copy_lines() except that if pTo is not NULL, the | |
| 720 | +** copied content is HTML-escaped. | |
| 721 | +*/ | |
| 722 | +/*static*/ void htmlCopyLines(Blob *pTo, Blob *pFrom, int N){ | |
| 723 | + const unsigned int iStart = pFrom->iCursor; | |
| 724 | + blob_copy_lines(0, pFrom, N); | |
| 725 | + if( pTo ){ | |
| 726 | + assert( iStart <= pFrom->iCursor ); | |
| 727 | + htmlize_to_blob(pTo, blob_str(pFrom) + iStart, (int)(pFrom->iCursor - iStart)); | |
| 728 | + } | |
| 729 | +} | |
| 717 | 730 | |
| 718 | 731 | /* MergeBuilderHtml::xStart() */ |
| 719 | 732 | static void htmlStart(MergeBuilder *p){ |
| 720 | 733 | MergeBuilderHtml *pH = (MergeBuilderHtml*)p; |
| 721 | 734 | unsigned int i; |
| 722 | 735 | |
| 723 | 736 | for(i = 0; i < sizeof(pH->aCol)/sizeof(Blob); ++i){ |
| 724 | 737 | blob_zero(&pH->aCol[i]); |
| 725 | 738 | } |
| 726 | - /* TODO: open HTML table in p->pOut */ | |
| 727 | - blob_appendf(p->pOut, "<h1>%h → (%h, %h) → %h</h1>", | |
| 728 | - p->zPivot, p->zV1, p->zV2, p->zOut); | |
| 729 | - /* Reminder; MergeBuilder does not currently contain enough state to | |
| 739 | + /* Reminder: MergeBuilder does not currently contain enough state to | |
| 730 | 740 | ** let us include version info in this diff. We have the raw content |
| 731 | 741 | ** of p->pPivot and p->pV2, but p->pV1 may be locally edited. We |
| 732 | 742 | ** can't readily know whether we need to use SHA1 or SHA3 to find it |
| 733 | 743 | ** in the blob table. */ |
| 734 | 744 | blob_append(p->pOut, |
| 735 | - "<table class='diff'><tbody>" | |
| 736 | - "<tr class='diffchunk'>\n", -1); | |
| 737 | -#define DCOL(KEY,KLASS,DUMMY) \ | |
| 738 | - blob_appendf(&pH->aCol[KEY], "<td class='" KLASS "'><pre>%h", DUMMY) | |
| 739 | - DCOL(MBH_COL_BASELINE_LN, "mrgBaseLn diffln", "###"); | |
| 740 | - DCOL(MBH_COL_BASELINE, "mrgBase", "merge base"); | |
| 741 | - DCOL(MBH_COL_BASELINE_SEP, "mrgBaseSep diffsep", " "); | |
| 742 | - DCOL(MBH_COL_LOCAL_LN, "mrgLocalLn diffln", "###"); | |
| 743 | - DCOL(MBH_COL_LOCAL, "mrgLocal", "local"); | |
| 744 | - DCOL(MBH_COL_LOCAL_SEP, "mrgLocalSep diffsep", " "); | |
| 745 | - DCOL(MBH_COL_MERGEDIN_LN, "mrgMILn diffln", "###"); | |
| 746 | - DCOL(MBH_COL_MERGEDIN, "mrgMI", "merged-in"); | |
| 747 | - DCOL(MBH_COL_MERGEDIN_SEP, "mrgMISep diffsep", " "); | |
| 748 | - DCOL(MBH_COL_RESULT_LN, "mrgResLn diffln", "###"); | |
| 749 | - DCOL(MBH_COL_RESULT, "mrgRes", "merge result"); | |
| 745 | + "<table class='diff'>", -1); | |
| 746 | + blob_append(p->pOut, "<thead><tr class='diffchunk'>", -1); | |
| 747 | +#define DCOL(KEY,KLASS,DUMMY,FILENAME) \ | |
| 748 | + blob_appendf(&pH->aCol[KEY], "<td class='" KLASS "'><pre>%h", DUMMY); \ | |
| 749 | + blob_append(p->pOut, "<td class='" KLASS "'>", -1 ); \ | |
| 750 | + if( FILENAME ) blob_appendf(p->pOut, "%h", FILENAME); \ | |
| 751 | + blob_append(p->pOut, "</td>", -1) | |
| 752 | + DCOL(MBH_COL_BASELINE_LN, "mrgBaseLn diffln", "###", 0); | |
| 753 | + DCOL(MBH_COL_BASELINE, "mrgBase", "", p->zPivot); | |
| 754 | + DCOL(MBH_COL_BASELINE_SEP, "mrgBaseSep diffsep", " ", 0); | |
| 755 | + DCOL(MBH_COL_LOCAL_LN, "mrgLocalLn diffln", "###", 0); | |
| 756 | + DCOL(MBH_COL_LOCAL, "mrgLocal", "", p->zV1); | |
| 757 | + DCOL(MBH_COL_LOCAL_SEP, "mrgLocalSep diffsep", " ", 0); | |
| 758 | + DCOL(MBH_COL_MERGEDIN_LN, "mrgMILn diffln", "###", 0); | |
| 759 | + DCOL(MBH_COL_MERGEDIN, "mrgMI", "", p->zV2); | |
| 760 | + DCOL(MBH_COL_MERGEDIN_SEP, "mrgMISep diffsep", " ", 0); | |
| 761 | + DCOL(MBH_COL_RESULT_LN, "mrgResLn diffln", "###", 0); | |
| 762 | + DCOL(MBH_COL_RESULT, "mrgRes", "", p->zOut); | |
| 750 | 763 | #undef DCOL |
| 764 | + blob_append(p->pOut, "</tr></thead>\n" | |
| 765 | + "<tbody><tr class='diffchunk'>\n", -1); | |
| 751 | 766 | } |
| 752 | 767 | |
| 753 | 768 | /* MergeBuilderHtml::xEnd() */ |
| 754 | 769 | static void htmlEnd(MergeBuilder *p){ |
| 755 | 770 | MergeBuilderHtml *pH = (MergeBuilderHtml*)p; |
| 756 | 771 |
| --- src/merge3.c | |
| +++ src/merge3.c | |
| @@ -712,44 +712,59 @@ | |
| 712 | p->xChngV1 = tclChngV1; |
| 713 | p->xChngV2 = tclChngV2; |
| 714 | p->xChngBoth = tclChngBoth; |
| 715 | p->xConflict = tclConflict; |
| 716 | } |
| 717 | |
| 718 | /* MergeBuilderHtml::xStart() */ |
| 719 | static void htmlStart(MergeBuilder *p){ |
| 720 | MergeBuilderHtml *pH = (MergeBuilderHtml*)p; |
| 721 | unsigned int i; |
| 722 | |
| 723 | for(i = 0; i < sizeof(pH->aCol)/sizeof(Blob); ++i){ |
| 724 | blob_zero(&pH->aCol[i]); |
| 725 | } |
| 726 | /* TODO: open HTML table in p->pOut */ |
| 727 | blob_appendf(p->pOut, "<h1>%h → (%h, %h) → %h</h1>", |
| 728 | p->zPivot, p->zV1, p->zV2, p->zOut); |
| 729 | /* Reminder; MergeBuilder does not currently contain enough state to |
| 730 | ** let us include version info in this diff. We have the raw content |
| 731 | ** of p->pPivot and p->pV2, but p->pV1 may be locally edited. We |
| 732 | ** can't readily know whether we need to use SHA1 or SHA3 to find it |
| 733 | ** in the blob table. */ |
| 734 | blob_append(p->pOut, |
| 735 | "<table class='diff'><tbody>" |
| 736 | "<tr class='diffchunk'>\n", -1); |
| 737 | #define DCOL(KEY,KLASS,DUMMY) \ |
| 738 | blob_appendf(&pH->aCol[KEY], "<td class='" KLASS "'><pre>%h", DUMMY) |
| 739 | DCOL(MBH_COL_BASELINE_LN, "mrgBaseLn diffln", "###"); |
| 740 | DCOL(MBH_COL_BASELINE, "mrgBase", "merge base"); |
| 741 | DCOL(MBH_COL_BASELINE_SEP, "mrgBaseSep diffsep", " "); |
| 742 | DCOL(MBH_COL_LOCAL_LN, "mrgLocalLn diffln", "###"); |
| 743 | DCOL(MBH_COL_LOCAL, "mrgLocal", "local"); |
| 744 | DCOL(MBH_COL_LOCAL_SEP, "mrgLocalSep diffsep", " "); |
| 745 | DCOL(MBH_COL_MERGEDIN_LN, "mrgMILn diffln", "###"); |
| 746 | DCOL(MBH_COL_MERGEDIN, "mrgMI", "merged-in"); |
| 747 | DCOL(MBH_COL_MERGEDIN_SEP, "mrgMISep diffsep", " "); |
| 748 | DCOL(MBH_COL_RESULT_LN, "mrgResLn diffln", "###"); |
| 749 | DCOL(MBH_COL_RESULT, "mrgRes", "merge result"); |
| 750 | #undef DCOL |
| 751 | } |
| 752 | |
| 753 | /* MergeBuilderHtml::xEnd() */ |
| 754 | static void htmlEnd(MergeBuilder *p){ |
| 755 | MergeBuilderHtml *pH = (MergeBuilderHtml*)p; |
| 756 |
| --- src/merge3.c | |
| +++ src/merge3.c | |
| @@ -712,44 +712,59 @@ | |
| 712 | p->xChngV1 = tclChngV1; |
| 713 | p->xChngV2 = tclChngV2; |
| 714 | p->xChngBoth = tclChngBoth; |
| 715 | p->xConflict = tclConflict; |
| 716 | } |
| 717 | |
| 718 | /* |
| 719 | ** Works like blob_copy_lines() except that if pTo is not NULL, the |
| 720 | ** copied content is HTML-escaped. |
| 721 | */ |
| 722 | /*static*/ void htmlCopyLines(Blob *pTo, Blob *pFrom, int N){ |
| 723 | const unsigned int iStart = pFrom->iCursor; |
| 724 | blob_copy_lines(0, pFrom, N); |
| 725 | if( pTo ){ |
| 726 | assert( iStart <= pFrom->iCursor ); |
| 727 | htmlize_to_blob(pTo, blob_str(pFrom) + iStart, (int)(pFrom->iCursor - iStart)); |
| 728 | } |
| 729 | } |
| 730 | |
| 731 | /* MergeBuilderHtml::xStart() */ |
| 732 | static void htmlStart(MergeBuilder *p){ |
| 733 | MergeBuilderHtml *pH = (MergeBuilderHtml*)p; |
| 734 | unsigned int i; |
| 735 | |
| 736 | for(i = 0; i < sizeof(pH->aCol)/sizeof(Blob); ++i){ |
| 737 | blob_zero(&pH->aCol[i]); |
| 738 | } |
| 739 | /* Reminder: MergeBuilder does not currently contain enough state to |
| 740 | ** let us include version info in this diff. We have the raw content |
| 741 | ** of p->pPivot and p->pV2, but p->pV1 may be locally edited. We |
| 742 | ** can't readily know whether we need to use SHA1 or SHA3 to find it |
| 743 | ** in the blob table. */ |
| 744 | blob_append(p->pOut, |
| 745 | "<table class='diff'>", -1); |
| 746 | blob_append(p->pOut, "<thead><tr class='diffchunk'>", -1); |
| 747 | #define DCOL(KEY,KLASS,DUMMY,FILENAME) \ |
| 748 | blob_appendf(&pH->aCol[KEY], "<td class='" KLASS "'><pre>%h", DUMMY); \ |
| 749 | blob_append(p->pOut, "<td class='" KLASS "'>", -1 ); \ |
| 750 | if( FILENAME ) blob_appendf(p->pOut, "%h", FILENAME); \ |
| 751 | blob_append(p->pOut, "</td>", -1) |
| 752 | DCOL(MBH_COL_BASELINE_LN, "mrgBaseLn diffln", "###", 0); |
| 753 | DCOL(MBH_COL_BASELINE, "mrgBase", "", p->zPivot); |
| 754 | DCOL(MBH_COL_BASELINE_SEP, "mrgBaseSep diffsep", " ", 0); |
| 755 | DCOL(MBH_COL_LOCAL_LN, "mrgLocalLn diffln", "###", 0); |
| 756 | DCOL(MBH_COL_LOCAL, "mrgLocal", "", p->zV1); |
| 757 | DCOL(MBH_COL_LOCAL_SEP, "mrgLocalSep diffsep", " ", 0); |
| 758 | DCOL(MBH_COL_MERGEDIN_LN, "mrgMILn diffln", "###", 0); |
| 759 | DCOL(MBH_COL_MERGEDIN, "mrgMI", "", p->zV2); |
| 760 | DCOL(MBH_COL_MERGEDIN_SEP, "mrgMISep diffsep", " ", 0); |
| 761 | DCOL(MBH_COL_RESULT_LN, "mrgResLn diffln", "###", 0); |
| 762 | DCOL(MBH_COL_RESULT, "mrgRes", "", p->zOut); |
| 763 | #undef DCOL |
| 764 | blob_append(p->pOut, "</tr></thead>\n" |
| 765 | "<tbody><tr class='diffchunk'>\n", -1); |
| 766 | } |
| 767 | |
| 768 | /* MergeBuilderHtml::xEnd() */ |
| 769 | static void htmlEnd(MergeBuilder *p){ |
| 770 | MergeBuilderHtml *pH = (MergeBuilderHtml*)p; |
| 771 |