Fossil  Diff

Differences From Artifact [6da016415d]:

  • File src/wiki.c — part of check-in [525816e6d7] at 2011-11-04 20:37:04 on branch json — Added configure option --enable-json to enable json features. They are disabled by default. (user: json-demo size: 29639) [more...]

To Artifact [af6df3466e]:

  • File src/wiki.c — part of check-in [96f1975ce2] at 2012-02-04 21:38:20 on branch trunk — Add the new colorized diff logic to file and wiki diffs in addition to version diffs. (user: drh size: 29725) [more...]

591
592
593
594
595
596
597

598
599
600
601
602
603
604
*/
void wdiff_page(void){
  char *zTitle;
  int rid1, rid2;
  const char *zPageName;
  Manifest *pW1, *pW2 = 0;
  Blob w1, w2, d;


  login_check_credentials();
  rid1 = atoi(PD("a","0"));
  if( !g.perm.History ){ login_needed(); return; }
  if( rid1==0 ) fossil_redirect_home();
  rid2 = atoi(PD("b","0"));
  zPageName = PD("name","");







>







591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
*/
void wdiff_page(void){
  char *zTitle;
  int rid1, rid2;
  const char *zPageName;
  Manifest *pW1, *pW2 = 0;
  Blob w1, w2, d;
  int diffFlags;

  login_check_credentials();
  rid1 = atoi(PD("a","0"));
  if( !g.perm.History ){ login_needed(); return; }
  if( rid1==0 ) fossil_redirect_home();
  rid2 = atoi(PD("b","0"));
  zPageName = PD("name","");
619
620
621
622
623
624
625

626
627
628
629
630
631
632
633
634
635
636
  if( pW1==0 ) fossil_redirect_home();
  blob_init(&w1, pW1->zWiki, -1);
  blob_zero(&w2);
  if( rid2 && (pW2 = manifest_get(rid2, CFTYPE_WIKI))!=0 ){
    blob_init(&w2, pW2->zWiki, -1);
  }
  blob_zero(&d);

  text_diff(&w2, &w1, &d, 5 | DIFF_IGNORE_EOLWS);
  @ <pre>
  @ %h(blob_str(&d))
  @ </pre>
  manifest_destroy(pW1);
  manifest_destroy(pW2);
  style_footer();
}

/*
** prepare()s pStmt with a query requesting:







>
|
|
|
|







620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
  if( pW1==0 ) fossil_redirect_home();
  blob_init(&w1, pW1->zWiki, -1);
  blob_zero(&w2);
  if( rid2 && (pW2 = manifest_get(rid2, CFTYPE_WIKI))!=0 ){
    blob_init(&w2, pW2->zWiki, -1);
  }
  blob_zero(&d);
  diffFlags = construct_diff_flags(1,0);
  text_diff(&w2, &w1, &d, diffFlags | DIFF_HTML | DIFF_LINENO);
  @ <div class="udiff">
  @ %s(blob_str(&d))
  @ </div>
  manifest_destroy(pW1);
  manifest_destroy(pW2);
  style_footer();
}

/*
** prepare()s pStmt with a query requesting: