Fossil

Check-in [9b7955b5]
Login

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

Overview
Comment:Code documentation.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | jan-sbsdiff
Files: files | file ages | folders
SHA1:9b7955b5a43492c1b3479e6d4245e7fe09426819
User & Date: jan 2011-10-15 00:26:20
Context
2011-10-15
12:22
Make sure sbsdiff lines are escaped properly. Started adding side-by-side diff support to fdiff. check-in: ff41d4be user: jan tags: jan-sbsdiff
00:26
Code documentation. check-in: 9b7955b5 user: jan tags: jan-sbsdiff
2011-10-14
22:21
Added two (local) options to sbsdiff (allow expansion and max columns limit), though they can't be changed in runtime yet. Added some missing error handling. check-in: 47cdbbf2 user: jan tags: jan-sbsdiff
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/diff.c.

595
596
597
598
599
600
601









602
603
604
605
606
607
608
609
610
611
612
613
614
...
623
624
625
626
627
628
629

630
631
632
633
634
635
636
    memcpy(out, dl->z, len);
    out[len] = '\0';
  }
  return out;
}

/*









 * References in the fossil repository:
 * /vdiff?from=080d27a&to=4b0f813&detail=1
 * /vdiff?from=636804745b&to=c1d78e0556&detail=1
 * /vdiff?from=c0b6c28d29&to=25169506b7&detail=1
 * /vdiff?from=e3d022dffa&to=48bcfbd47b&detail=1
 */
int html_sbsdiff(
  Blob *pA_Blob,   /* FROM file */
  Blob *pB_Blob,   /* TO file */
  int nContext,    /* Amount of context to unified diff */
  int ignoreEolWs  /* Ignore whitespace at the end of lines */
){
  DContext c;
................................................................................
  c.aFrom = break_into_lines(blob_str(pA_Blob), blob_size(pA_Blob),
                             &c.nFrom, ignoreEolWs);
  c.aTo = break_into_lines(blob_str(pB_Blob), blob_size(pB_Blob),
                           &c.nTo, ignoreEolWs);
  if( c.aFrom==0 || c.aTo==0 ){
    free(c.aFrom);
    free(c.aTo);

    @ <p class="generalError" style="white-space: nowrap">cannot compute
    @ difference between binary files</p>
    return 0;
  }

  collim = collim < 4 ? 0 : collim;








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







 







>







595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
...
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
    memcpy(out, dl->z, len);
    out[len] = '\0';
  }
  return out;
}

/*
** Output table body of a side-by-side diff. Prior to the call, the caller
** should have output:
**   <table class="sbsdiff">
**   <tr><th colspan="2" class="diffhdr">Old title</th><th/>
**   <th colspan="2" class="diffhdr">New title</th></tr>
**
** And after the call, it should output:
**   </table>
**
** Some good reference diffs in the fossil repository for testing:
** /vdiff?from=080d27a&to=4b0f813&detail=1
** /vdiff?from=636804745b&to=c1d78e0556&detail=1
** /vdiff?from=c0b6c28d29&to=25169506b7&detail=1
** /vdiff?from=e3d022dffa&to=48bcfbd47b&detail=1
*/
int html_sbsdiff(
  Blob *pA_Blob,   /* FROM file */
  Blob *pB_Blob,   /* TO file */
  int nContext,    /* Amount of context to unified diff */
  int ignoreEolWs  /* Ignore whitespace at the end of lines */
){
  DContext c;
................................................................................
  c.aFrom = break_into_lines(blob_str(pA_Blob), blob_size(pA_Blob),
                             &c.nFrom, ignoreEolWs);
  c.aTo = break_into_lines(blob_str(pB_Blob), blob_size(pB_Blob),
                           &c.nTo, ignoreEolWs);
  if( c.aFrom==0 || c.aTo==0 ){
    free(c.aFrom);
    free(c.aTo);
    /* Note: This would be generated within a table. */
    @ <p class="generalError" style="white-space: nowrap">cannot compute
    @ difference between binary files</p>
    return 0;
  }

  collim = collim < 4 ? 0 : collim;