Fossil

Check-in [5a1da556d6]
Login

Check-in [5a1da556d6]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Get stub table layout in place for merge-info --html. It's not yet clear whether this will suffice.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | merge-info-html
Files: files | file ages | folders
SHA3-256: 5a1da556d69b208a5b7dc6d452b8b89fdbc4dfcd98437552a8343f2ef72a1ccb
User & Date: stephan 2024-12-09 07:08:21.918
Context
2024-12-09
08:17
Move filename info into the corresponding merge-info table. Start adding infrastructure for emitting HTML-mode output to the content columns. ... (check-in: e3a3f0a5f2 user: stephan tags: merge-info-html)
07:08
Get stub table layout in place for merge-info --html. It's not yet clear whether this will suffice. ... (check-in: 5a1da556d6 user: stephan tags: merge-info-html)
07:05
Fix width:1px sizes on diff line-number and change-type cols for diff --browser and friends. ... (check-in: d2d01d3eb7 user: stephan tags: merge-info-html)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/default.css.
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
8.9199065,6.1390961 9.1162816,5.8045312 9.1162816,5.4699662 q 0,-0.5091205 -0.3491113,-0.7927734 \
-0.3491111,-0.2909259 -0.9746021,-0.2909259 -0.5891252,0 -1.2728012,0.247287 \
-0.6836761,0.240014 -1.4255375,0.720042 V 3.0698267 q 0.8800513,-0.3054724 1.6073661,-0.4509353 \
0.7273151,-0.145463 1.403718,-0.145463 1.7746486,0 2.7056104,0.727315 0.930965,0.720042 \
0.930965,2.1092135 0,0.7127686 -0.283654,1.2800746 -0.283652,0.5600324 -0.967329,1.2073428 \
L 10.025425,8.2119439 Q 9.530851,8.6628792 9.3781148,8.9392588 9.2253789,9.2083654 \
9.2253789,9.535657 Z M 6.5997716,10.939376 h 2.6256073 v 2.589241 H 6.5997716 Z' \
style='fill:%23f8f8f8;stroke-width:1.35412836' /%3e%3c/svg%3e ");    
  background-repeat: no-repeat;
  background-position: center;
  /* When not using a background image, this additional style works
     reasonably well along with a ::before content of "?": */
  /*border-width: 1px;
  border-style: outset;
  border-radius: 0.5em;







|







1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
8.9199065,6.1390961 9.1162816,5.8045312 9.1162816,5.4699662 q 0,-0.5091205 -0.3491113,-0.7927734 \
-0.3491111,-0.2909259 -0.9746021,-0.2909259 -0.5891252,0 -1.2728012,0.247287 \
-0.6836761,0.240014 -1.4255375,0.720042 V 3.0698267 q 0.8800513,-0.3054724 1.6073661,-0.4509353 \
0.7273151,-0.145463 1.403718,-0.145463 1.7746486,0 2.7056104,0.727315 0.930965,0.720042 \
0.930965,2.1092135 0,0.7127686 -0.283654,1.2800746 -0.283652,0.5600324 -0.967329,1.2073428 \
L 10.025425,8.2119439 Q 9.530851,8.6628792 9.3781148,8.9392588 9.2253789,9.2083654 \
9.2253789,9.535657 Z M 6.5997716,10.939376 h 2.6256073 v 2.589241 H 6.5997716 Z' \
style='fill:%23f8f8f8;stroke-width:1.35412836' /%3e%3c/svg%3e ");
  background-repeat: no-repeat;
  background-position: center;
  /* When not using a background image, this additional style works
     reasonably well along with a ::before content of "?": */
  /*border-width: 1px;
  border-style: outset;
  border-radius: 0.5em;
Changes to src/merge.c.
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366

  db_prepare(&q,
       /*   0    1     2   3     4   5    6     7 */
    "SELECT fnp, ridp, fn, ridv, sz, fnm, ridm, fnr"
    "  FROM mergestat WHERE rowid IN mi_html"
    "  ORDER BY coalesce(fnr,fn,fnp)"
  );
  blob_append(&out, "<ul>\n", 5);
  while( SQLITE_ROW==db_step(&q) ){
    const char * zFN;                /* A filename */
    char * zToFree[5] = {0,0,0,0,0}; /* String memory to free */
    unsigned zToFreeNdx = 0;         /* Current index into zToFree */
    int rid = 0;                     /* A blob rid */
    int sz;                          /* File size */
    unsigned int i;                  /* Loop counter */







<







352
353
354
355
356
357
358

359
360
361
362
363
364
365

  db_prepare(&q,
       /*   0    1     2   3     4   5    6     7 */
    "SELECT fnp, ridp, fn, ridv, sz, fnm, ridm, fnr"
    "  FROM mergestat WHERE rowid IN mi_html"
    "  ORDER BY coalesce(fnr,fn,fnp)"
  );

  while( SQLITE_ROW==db_step(&q) ){
    const char * zFN;                /* A filename */
    char * zToFree[5] = {0,0,0,0,0}; /* String memory to free */
    unsigned zToFreeNdx = 0;         /* Current index into zToFree */
    int rid = 0;                     /* A blob rid */
    int sz;                          /* File size */
    unsigned int i;                  /* Loop counter */
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
    for(i = 0; i < zToFreeNdx; ++i ){
      fossil_free(zToFree[i]);
      zToFree[i] = 0;
    }
  }/* for-each-file loop */
  db_finalize(&q);
  mb->xDestroy(mb);
  blob_append(&out, "</ul>\n", 6);

  blob_append(&out, diff_webpage_footer(), -1);
  blob_reset(&v1);
  blob_reset(&v2);
  blob_reset(&pivot);
  blob_append_char(&out, '\n');
  blob_write_to_file(&out, "-");







<







446
447
448
449
450
451
452

453
454
455
456
457
458
459
    for(i = 0; i < zToFreeNdx; ++i ){
      fossil_free(zToFree[i]);
      zToFree[i] = 0;
    }
  }/* for-each-file loop */
  db_finalize(&q);
  mb->xDestroy(mb);


  blob_append(&out, diff_webpage_footer(), -1);
  blob_reset(&v1);
  blob_reset(&v2);
  blob_reset(&pivot);
  blob_append_char(&out, '\n');
  blob_write_to_file(&out, "-");
Changes to src/merge3.c.
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
773
774
775
  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><pre>",
               p->zPivot, p->zV1, p->zV2, p->zOut);






















}

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

  /* TODO: flush pH->aCol to p->pOut and close HTML table */
  for(i = 0; i < sizeof(pH->aCol)/sizeof(Blob); ++i){

    blob_reset(&pH->aCol[i]);
  }
  blob_append(p->pOut, "</pre>\n", -1);
  p->pV1 = p->pV2 = p->pPivot = p->pOut = 0;
  p->zPivot = p->zV1 = p->zV2 = p->zOut = 0;
}

/* MergeBuilderHtml::xSame() */
static void htmlSame(MergeBuilder *p, unsigned int N){
  return dbgSame(p, N);
}
/* MergeBuilderHtml::xChngV1() */
static void htmlChngV1(MergeBuilder *p, unsigned int nPivot, unsigned int nV1){
  return dbgChngV1(p, nPivot, nV1);
}
/* MergeBuilderHtml::xChngV2() */
static void htmlChngV2(MergeBuilder *p, unsigned int nPivot, unsigned int nV2){
  return dbgChngV2(p, nPivot, nV2);
}
/* MergeBuilderHtml::xChngBoth() */
static void htmlChngBoth(MergeBuilder *p, unsigned int nPivot, unsigned int nV){
  return dbgChngBoth(p, nPivot, nV);
}
/* MergeBuilderHtml::xConflict() */
static void htmlConflict(
  MergeBuilder *p,
  unsigned int nPivot,
  unsigned int nV1,
  unsigned int nV2
){
  return dbgConflict(p, nPivot, nV1, nV2);
}
void mergebuilder_init_html(MergeBuilderHtml *pH){
  MergeBuilder *p = &pH->base;
  unsigned int i;
  mergebuilder_init(p);
  p->xStart = htmlStart;
  p->xEnd = htmlEnd;







|

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









>
|

|






|



|



|



|








|







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
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
  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;

  /* TODO: flush pH->aCol to p->pOut and close HTML table */
  for(i = 0; i < sizeof(pH->aCol)/sizeof(Blob); ++i){
    blob_appendf(&pH->aCol[i], "</pre></td><!-- end col-#%u -->", i);
    blob_append_xfer(p->pOut, &pH->aCol[i]);
  }
  blob_append(p->pOut, "</tbody></table>\n", -1);
  p->pV1 = p->pV2 = p->pPivot = p->pOut = 0;
  p->zPivot = p->zV1 = p->zV2 = p->zOut = 0;
}

/* MergeBuilderHtml::xSame() */
static void htmlSame(MergeBuilder *p, unsigned int N){
  /*dbgSame(p, N);*/
}
/* MergeBuilderHtml::xChngV1() */
static void htmlChngV1(MergeBuilder *p, unsigned int nPivot, unsigned int nV1){
  /*dbgChngV1(p, nPivot, nV1);*/
}
/* MergeBuilderHtml::xChngV2() */
static void htmlChngV2(MergeBuilder *p, unsigned int nPivot, unsigned int nV2){
  /*dbgChngV2(p, nPivot, nV2);*/
}
/* MergeBuilderHtml::xChngBoth() */
static void htmlChngBoth(MergeBuilder *p, unsigned int nPivot, unsigned int nV){
  /*dbgChngBoth(p, nPivot, nV);*/
}
/* MergeBuilderHtml::xConflict() */
static void htmlConflict(
  MergeBuilder *p,
  unsigned int nPivot,
  unsigned int nV1,
  unsigned int nV2
){
  /*dbgConflict(p, nPivot, nV1, nV2);*/
}
void mergebuilder_init_html(MergeBuilderHtml *pH){
  MergeBuilder *p = &pH->base;
  unsigned int i;
  mergebuilder_init(p);
  p->xStart = htmlStart;
  p->xEnd = htmlEnd;