Fossil

Diff
Login

Differences From Artifact [ac93d3c0e7]:

To Artifact [b3cf7d51cb]:


710
711
712
713
714
715
716













717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738



739
740
741
742
743
744
745
746
747
748
749
750


751
752
753
754
755
756
757
  p->xStart = tclStart;
  p->xSame = tclSame;
  p->xChngV1 = tclChngV1;
  p->xChngV2 = tclChngV2;
  p->xChngBoth = tclChngBoth;
  p->xConflict = tclConflict;
}














/* MergeBuilderHtml::xStart() */
static void htmlStart(MergeBuilder *p){
  MergeBuilderHtml *pH = (MergeBuilderHtml*)p;
  unsigned int i;

  for(i = 0; i < sizeof(pH->aCol)/sizeof(Blob); ++i){
    blob_zero(&pH->aCol[i]);
  }
  /* TODO: open HTML table in p->pOut */
  blob_appendf(p->pOut, "<h1>%h &rarr; (%h, %h) &rarr; %h</h1>",
               p->zPivot, p->zV1, p->zV2, p->zOut);
  /* Reminder; MergeBuilder does not currently contain enough state to
  ** let us include version info in this diff. We have the raw content
  ** of p->pPivot and p->pV2, but p->pV1 may be locally edited.  We
  ** can't readily know whether we need to use SHA1 or SHA3 to find it
  ** in the blob table. */
  blob_append(p->pOut,
              "<table class='diff'><tbody>"
              "<tr class='diffchunk'>\n", -1);
#define DCOL(KEY,KLASS,DUMMY)                                  \
  blob_appendf(&pH->aCol[KEY], "<td class='" KLASS "'><pre>%h", DUMMY)



  DCOL(MBH_COL_BASELINE_LN,  "mrgBaseLn diffln", "###");
  DCOL(MBH_COL_BASELINE,     "mrgBase", "merge base");
  DCOL(MBH_COL_BASELINE_SEP, "mrgBaseSep diffsep", " ");
  DCOL(MBH_COL_LOCAL_LN,     "mrgLocalLn diffln", "###");
  DCOL(MBH_COL_LOCAL,        "mrgLocal", "local");
  DCOL(MBH_COL_LOCAL_SEP,    "mrgLocalSep diffsep", " ");
  DCOL(MBH_COL_MERGEDIN_LN,  "mrgMILn diffln", "###");
  DCOL(MBH_COL_MERGEDIN,     "mrgMI", "merged-in");
  DCOL(MBH_COL_MERGEDIN_SEP, "mrgMISep diffsep", " ");
  DCOL(MBH_COL_RESULT_LN,    "mrgResLn diffln", "###");
  DCOL(MBH_COL_RESULT,       "mrgRes", "merge result");
#undef DCOL


}

/* MergeBuilderHtml::xEnd() */
static void htmlEnd(MergeBuilder *p){
  MergeBuilderHtml *pH = (MergeBuilderHtml*)p;
  unsigned int i;








>
>
>
>
>
>
>
>
>
>
>
>
>









<
<
<
|





|
|
|
|
>
>
>
|
|
|
|
|
|
|
|
|
|
|

>
>







710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738



739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
  p->xStart = tclStart;
  p->xSame = tclSame;
  p->xChngV1 = tclChngV1;
  p->xChngV2 = tclChngV2;
  p->xChngBoth = tclChngBoth;
  p->xConflict = tclConflict;
}

/*
** Works like blob_copy_lines() except that if pTo is not NULL, the
** copied content is HTML-escaped.
*/
/*static*/ void htmlCopyLines(Blob *pTo, Blob *pFrom, int N){
  const unsigned int iStart = pFrom->iCursor;
  blob_copy_lines(0, pFrom, N);
  if( pTo ){
    assert( iStart <= pFrom->iCursor );
    htmlize_to_blob(pTo, blob_str(pFrom) + iStart, (int)(pFrom->iCursor - iStart));
  }
}

/* MergeBuilderHtml::xStart() */
static void htmlStart(MergeBuilder *p){
  MergeBuilderHtml *pH = (MergeBuilderHtml*)p;
  unsigned int i;

  for(i = 0; i < sizeof(pH->aCol)/sizeof(Blob); ++i){
    blob_zero(&pH->aCol[i]);
  }



  /* Reminder: MergeBuilder does not currently contain enough state to
  ** let us include version info in this diff. We have the raw content
  ** of p->pPivot and p->pV2, but p->pV1 may be locally edited.  We
  ** can't readily know whether we need to use SHA1 or SHA3 to find it
  ** in the blob table. */
  blob_append(p->pOut,
              "<table class='diff'>", -1);
  blob_append(p->pOut, "<thead><tr class='diffchunk'>", -1);
#define DCOL(KEY,KLASS,DUMMY,FILENAME)                                  \
  blob_appendf(&pH->aCol[KEY], "<td class='" KLASS "'><pre>%h", DUMMY); \
  blob_append(p->pOut, "<td class='" KLASS "'>", -1 );                  \
  if( FILENAME ) blob_appendf(p->pOut, "%h", FILENAME);                 \
  blob_append(p->pOut, "</td>", -1)
  DCOL(MBH_COL_BASELINE_LN,  "mrgBaseLn diffln", "###", 0);
  DCOL(MBH_COL_BASELINE,     "mrgBase", "", p->zPivot);
  DCOL(MBH_COL_BASELINE_SEP, "mrgBaseSep diffsep", " ", 0);
  DCOL(MBH_COL_LOCAL_LN,     "mrgLocalLn diffln", "###", 0);
  DCOL(MBH_COL_LOCAL,        "mrgLocal", "", p->zV1);
  DCOL(MBH_COL_LOCAL_SEP,    "mrgLocalSep diffsep", " ", 0);
  DCOL(MBH_COL_MERGEDIN_LN,  "mrgMILn diffln", "###", 0);
  DCOL(MBH_COL_MERGEDIN,     "mrgMI", "", p->zV2);
  DCOL(MBH_COL_MERGEDIN_SEP, "mrgMISep diffsep", " ", 0);
  DCOL(MBH_COL_RESULT_LN,    "mrgResLn diffln", "###", 0);
  DCOL(MBH_COL_RESULT,       "mrgRes", "", p->zOut);
#undef DCOL
  blob_append(p->pOut, "</tr></thead>\n"
              "<tbody><tr class='diffchunk'>\n", -1);
}

/* MergeBuilderHtml::xEnd() */
static void htmlEnd(MergeBuilder *p){
  MergeBuilderHtml *pH = (MergeBuilderHtml*)p;
  unsigned int i;