Fossil

Check-in [c190bcc3ce]
Login

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

Overview
Comment:Augment the fdiff web method to accept a "patch" query parameter and output text/plain if the parameter is present.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: c190bcc3ceaa7a726ed3c4f3d3cb66dfdb83037d
User & Date: drh 2011-02-20 00:12:27.788
Context
2011-02-20
20:44
Allow the target attribute on <a> markup. Ticket [577663c2727505a] ... (check-in: fde81c6109 user: drh tags: trunk)
05:56
Merge custom Makefile to trunk. ... (Closed-Leaf check-in: 9503a9152e user: mistachkin tags: trunk)
00:12
Augment the fdiff web method to accept a "patch" query parameter and output text/plain if the parameter is present. ... (check-in: c190bcc3ce user: drh tags: trunk)
2011-02-19
16:14
Add the "vpatch" web method that returns the difference between two checkins as text/plain and a a "patch" hyperlink on the checkin information page that jumps to the appropriate vpatch page. ... (check-in: 4bdf71b1ce user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/info.c.
915
916
917
918
919
920
921

922
923

924
925
926
927

928
929
930
931
932
933
934














935


936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955

956
957
958
959
960
961
962
    @ <a href="%s(g.zTop)/artifact/%S(zUuid)">[view]</a>
  }
}


/*
** WEBPAGE: fdiff

**
** Two arguments, v1 and v2, are integers.  Show the difference between

** the two records.
*/
void diff_page(void){
  int v1, v2;

  Blob c1, c2, diff;

  login_check_credentials();
  if( !g.okRead ){ login_needed(); return; }
  v1 = name_to_rid_www("v1");
  v2 = name_to_rid_www("v2");
  if( v1==0 || v2==0 ) fossil_redirect_home();














  style_header("Diff");


  @ <h2>Differences From:</h2>
  @ <blockquote><p>
  object_description(v1, 1, 0);
  @ </p></blockquote>
  @ <h2>To:</h2>
  @ <blockquote><p>
  object_description(v2, 1, 0);
  @ </p></blockquote>
  @ <hr />
  @ <blockquote><pre>
  content_get(v1, &c1);
  content_get(v2, &c2);
  blob_zero(&diff);
  text_diff(&c1, &c2, &diff, 4, 1);
  blob_reset(&c1);
  blob_reset(&c2);
  @ %h(blob_str(&diff))
  @ </pre></blockquote>
  blob_reset(&diff);
  style_footer();

}

/*
** WEBPAGE: raw
** URL: /raw?name=ARTIFACTID&m=TYPE
** 
** Return the uninterpreted content of an artifact.  Used primarily







>

|
>
|



>
|






>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
|
|
|
|
|
|
|
|
|
|
<
<
<
<
<
<
|
|
|
|
>







915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964






965
966
967
968
969
970
971
972
973
974
975
976
    @ <a href="%s(g.zTop)/artifact/%S(zUuid)">[view]</a>
  }
}


/*
** WEBPAGE: fdiff
** URL: fdiff?v1=UUID&v2=UUID&patch
**
** Two arguments, v1 and v2, identify the files to be diffed.  Show the 
** difference between the two artifacts.  Generate plaintext if "patch"
** is present.
*/
void diff_page(void){
  int v1, v2;
  int isPatch;
  Blob c1, c2, diff, *pOut;

  login_check_credentials();
  if( !g.okRead ){ login_needed(); return; }
  v1 = name_to_rid_www("v1");
  v2 = name_to_rid_www("v2");
  if( v1==0 || v2==0 ) fossil_redirect_home();
  isPatch = P("patch")!=0;
  if( isPatch ){
    pOut = cgi_output_blob();
    cgi_set_content_type("text/plain");
  }else{
    blob_zero(&diff);
    pOut = &diff;
  }
  content_get(v1, &c1);
  content_get(v2, &c2);
  text_diff(&c1, &c2, pOut, 4, 1);
  blob_reset(&c1);
  blob_reset(&c2);
  if( !isPatch ){
    style_header("Diff");
    style_submenu_element("Patch", "Patch", "%s/fdiff?v1=%T&v2=%T&patch",
                          g.zTop, P("v1"), P("v2"));
    @ <h2>Differences From:</h2>
    @ <blockquote><p>
    object_description(v1, 1, 0);
    @ </p></blockquote>
    @ <h2>To:</h2>
    @ <blockquote><p>
    object_description(v2, 1, 0);
    @ </p></blockquote>
    @ <hr />
    @ <blockquote><pre>






    @ %h(blob_str(&diff))
    @ </pre></blockquote>
    blob_reset(&diff);
    style_footer();
  }
}

/*
** WEBPAGE: raw
** URL: /raw?name=ARTIFACTID&m=TYPE
** 
** Return the uninterpreted content of an artifact.  Used primarily