Fossil

Check-in [cee30a34]
Login

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

Overview
Comment:Add the undocumented --script FILENAME option to all diff operations that make use of the --tk option. The --script FILENAME option is used for testing and debugging only.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:cee30a34d80d3fe7f8f6b275d0a5dc6f0c3aebb8
User & Date: drh 2013-10-08 13:11:11
Context
2013-10-08
13:45
Revise the character escaping logic for generated tarballs and zip archives. Add a "For best results" comment to the configuration page where the project name is set. check-in: fe76ad55 user: drh tags: trunk
13:11
Add the undocumented --script FILENAME option to all diff operations that make use of the --tk option. The --script FILENAME option is used for testing and debugging only. check-in: cee30a34 user: drh tags: trunk
13:03
Escape special characters used in the Project Name when generating the URLs for tarball and ZIP archive. check-in: ddc313e8 user: drh tags: trunk
2013-09-28
10:34
Merge recent trunk changes into the tkdiff-enhancements branch. Closed-Leaf check-in: fac10931 user: drh tags: tkdiff-enhancements
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/diffcmd.c.

913
914
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
** (1) Write the Tcl/Tk script used for rendering into a temp file.
** (2) Invoke "wish" on the temp file using fossil_system().
** (3) Delete the temp file.
*/
void diff_tk(const char *zSubCmd, int firstArg){
  int i;
  Blob script;
  char *zTempFile;
  char *zCmd;
  blob_zero(&script);
  blob_appendf(&script, "set fossilcmd {| \"%/\" %s --html -y -i -v",
               g.nameOfExe, zSubCmd);
  for(i=firstArg; i<g.argc; i++){
    const char *z = g.argv[i];
    if( z[0]=='-' ){
      if( strglob("*-html",z) ) continue;
      if( strglob("*-y",z) ) continue;
      if( strglob("*-i",z) ) continue;








    }
    blob_append(&script, " ", 1);
    shell_escape(&script, z);
  }
  blob_appendf(&script, "}\n%s", zDiffScript);




  zTempFile = write_blob_to_temp_file(&script);
  zCmd = mprintf("tclsh \"%s\"", zTempFile);
  fossil_system(zCmd);
  file_delete(zTempFile);
  fossil_free(zCmd);


}

/*
** Returns non-zero if files that may be binary should be used with external
** diff programs.
*/
int diff_include_binary_files(void){







|










>
>
>
>
>
>
>
>





>
>
>
>
|
|
|
|
|
>
>







913
914
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
** (1) Write the Tcl/Tk script used for rendering into a temp file.
** (2) Invoke "wish" on the temp file using fossil_system().
** (3) Delete the temp file.
*/
void diff_tk(const char *zSubCmd, int firstArg){
  int i;
  Blob script;
  char *zTempFile = 0;
  char *zCmd;
  blob_zero(&script);
  blob_appendf(&script, "set fossilcmd {| \"%/\" %s --html -y -i -v",
               g.nameOfExe, zSubCmd);
  for(i=firstArg; i<g.argc; i++){
    const char *z = g.argv[i];
    if( z[0]=='-' ){
      if( strglob("*-html",z) ) continue;
      if( strglob("*-y",z) ) continue;
      if( strglob("*-i",z) ) continue;
      /* The undocumented --script FILENAME option causes the Tk script to
      ** be written into the FILENAME instead of being run.  This is used
      ** for testing and debugging. */
      if( strglob("*-script",z) && i<g.argc-1 ){
        i++;
        zTempFile = g.argv[i];
        continue;
      }
    }
    blob_append(&script, " ", 1);
    shell_escape(&script, z);
  }
  blob_appendf(&script, "}\n%s", zDiffScript);
  if( zTempFile ){
    blob_write_to_file(&script, zTempFile);
    fossil_print("To see diff, run: tclsh \"%s\"\n", zTempFile);
  }else{
    zTempFile = write_blob_to_temp_file(&script);
    zCmd = mprintf("tclsh \"%s\"", zTempFile);
    fossil_system(zCmd);
    file_delete(zTempFile);
    fossil_free(zCmd);
  }
  blob_reset(&script);
}

/*
** Returns non-zero if files that may be binary should be used with external
** diff programs.
*/
int diff_include_binary_files(void){