Fossil

Check-in [01ce2cf3dc]
Login

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

Overview
Comment:Added a gdiff command. diff command now runs config diff-command, gdiff command (graphical diff) now runs config gdiff-command. With both, if -i is supplied, internal diff is used. With both, if they are not configured, internal diff is used. Fixed bug with internal diff giving files in reverse order. Also put div id="sub-menu" inside of submenu if, as to not display the sub menu if no sub menu items exist
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 01ce2cf3dc8949a16646fecaa3f48bd353fe12d7
User & Date: jnc 2007-09-24 14:02:30.000
Context
2007-09-24
17:11
Added revert command, currently only offering revert to current version. Organized todo.txt a bit, added new bug report ... (check-in: 255bacf907 user: jnc tags: trunk)
14:02
Added a gdiff command. diff command now runs config diff-command, gdiff command (graphical diff) now runs config gdiff-command. With both, if -i is supplied, internal diff is used. With both, if they are not configured, internal diff is used. Fixed bug with internal diff giving files in reverse order. Also put div id="sub-menu" inside of submenu if, as to not display the sub menu if no sub menu items exist ... (check-in: 01ce2cf3dc user: jnc tags: trunk)
06:53
Added support for a user defined diff command, which if set (fossil config diff-command), is run by default. The user can give a -i flag to run the internal diff command regardless of user defined diff command setting. Removed command tkdiff, no longer needed. Made the config remove message a bit more clear, when removing a config setting, it states it has been removed instead of telling you it's undefined. ... (check-in: c82fb61775 user: jnc tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/diffcmd.c.
40
41
42
43
44
45
46

47
48
49
50
51







52
53
54
55
56
57

58

59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80





81
82
83
84
85
86
87
88
89
90
91
92
  for(i=n+1; i<=n+k; i++){
    if( z[i]=='"' ) z[i] = '_';
  }
}

/*
** COMMAND: diff

**
** Usage: %fossil diff ?-i FILE...
**
** Show the difference between the current version of a file (as it
** exists on disk) and that same file as it was checked out.







** If -i is supplied, the internal diff command will be executed
** otherwise, fossil attempts to use the user configured diff-command.
**
** Here are a few external diff command settings, for example:
**
**   %fossil config diff-command=tkdiff

**   %fossil config diff-command=eskill22

**   %fossil config diff-command=tortoisemerge
**   %fossil config diff-command=meld
**   %fossil config diff-command=xxdiff
**   %fossil config diff-command=kdiff3
*/
void diff_cmd(void){
  const char *zFile;
  Blob cmd;
  Blob fname;
  int i, internalDiff;
  char *zV1 = 0;
  char *zV2 = 0;
  
  internalDiff = find_option("intertal","i",0)!=0;
  
  if( g.argc<3 ){
    usage("?OPTIONS? FILE");
  }
  db_must_be_within_tree();
  
  if( internalDiff==0 ){
  	const char *zExternalCommand = db_global_get("diff-command", 0);





    if( zExternalCommand==0 ){
      internalDiff=1;
    }
  	blob_zero(&cmd);
  	blob_appendf(&cmd, "%s ", zExternalCommand);
  }
  for(i=2; i<g.argc-1; i++){
    const char *z = g.argv[i];
    if( (strcmp(z,"-v")==0 || strcmp(z,"--version")==0) && i<g.argc-2 ){
      if( zV1==0 ){
        zV1 = g.argv[i+1];
      }else if( zV2==0 ){







>

|



>
>
>
>
>
>
>
|
<



|
>
|
>
|
|
|
|









|







|
>
>
>
>
>



|
|







40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60

61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
  for(i=n+1; i<=n+k; i++){
    if( z[i]=='"' ) z[i] = '_';
  }
}

/*
** COMMAND: diff
** COMMAND: gdiff
**
** Usage: %fossil diff|gdiff ?-i FILE...
**
** Show the difference between the current version of a file (as it
** exists on disk) and that same file as it was checked out.
**
** diff will show a textual diff while gdiff will attempt to run a
** graphical diff command that you have setup. If the choosen command
** is not yet configured, the internal textual diff command will be
** used.
**
** If -i is supplied for either diff or gdiff, the internal textual
** diff command will be executed.

**
** Here are a few external diff command settings, for example:
**
**   %fossil config diff-command=diff
**
**   %fossil config gdiff-command=tkdiff
**   %fossil config gdiff-command=eskill22
**   %fossil config gdiff-command=tortoisemerge
**   %fossil config gdiff-command=meld
**   %fossil config gdiff-command=xxdiff
**   %fossil config gdiff-command=kdiff3
*/
void diff_cmd(void){
  const char *zFile;
  Blob cmd;
  Blob fname;
  int i, internalDiff;
  char *zV1 = 0;
  char *zV2 = 0;
  
  internalDiff = find_option("internal","i",0)!=0;
  
  if( g.argc<3 ){
    usage("?OPTIONS? FILE");
  }
  db_must_be_within_tree();
  
  if( internalDiff==0 ){
    const char *zExternalCommand;
    if( strcmp(g.argv[1], "diff")==0 ){
      zExternalCommand = db_global_get("diff-command", 0);
    }else{
      zExternalCommand = db_global_get("gdiff-command", 0);
    }
    if( zExternalCommand==0 ){
      internalDiff=1;
    }
    blob_zero(&cmd);
    blob_appendf(&cmd, "%s ", zExternalCommand);
  }
  for(i=2; i<g.argc-1; i++){
    const char *z = g.argv[i];
    if( (strcmp(z,"-v")==0 || strcmp(z,"--version")==0) && i<g.argc-2 ){
      if( zV1==0 ){
        zV1 = g.argv[i+1];
      }else if( zV2==0 ){
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
    content_get(rid, &record);
    if( internalDiff==1 ){
      Blob current;
      Blob out;
      blob_zero(&current);
      blob_read_from_file(&current, zFile);
      blob_zero(&out);
      unified_diff(&current, &record, 5, &out);
      printf("%s\n", blob_str(&out));
      blob_reset(&current);
      blob_reset(&out);
    }else{
      blob_write_to_file(&record, blob_str(&vname));
      blob_reset(&record);
      shell_escape(&cmd, blob_str(&vname));







|







135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
    content_get(rid, &record);
    if( internalDiff==1 ){
      Blob current;
      Blob out;
      blob_zero(&current);
      blob_read_from_file(&current, zFile);
      blob_zero(&out);
      unified_diff(&record, &current, 5, &out);
      printf("%s\n", blob_str(&out));
      blob_reset(&current);
      blob_reset(&out);
    }else{
      blob_write_to_file(&record, blob_str(&vname));
      blob_reset(&record);
      shell_escape(&cmd, blob_str(&vname));
Changes to src/style.c.
105
106
107
108
109
110
111
112
113

114
115
116
117
118
119
120
121
122
123
124
125
126
127
128

129
130
131
132
133
134
135
  if( g.okSetup ){
    @ | <a href="%s(g.zBaseURL)/setup">Setup</a>
  }
  if( !g.noPswd ){
    @ | <a href="%s(g.zBaseURL)/login">%s(zLogInOut)</a>
  }
  @ </div>
  @ <div id="sub-menu">
  if( nSubmenu>0 ){

    int i;
    qsort(aSubmenu, nSubmenu, sizeof(aSubmenu[0]), submenuCompare);
    for(i=0; i<nSubmenu; i++){
      struct Submenu *p = &aSubmenu[i];
      char *zTail = i<nSubmenu-1 ? " | " : "";
      if( p->zLink==0 ){
        @ <span class="label">%h(p->zLabel)</span>
        @ <span class="tail">%s(zTail)</span>
      }else{
        @ <a class="label" href="%T(p->zLink)">%h(p->zLabel)</a>
        @ <span class="tail">%s(zTail)</span>
      }
    }
  }
  @ </div>

  @ <div id="page">
  g.cgiPanic = 1;
}

/*
** Draw the footer at the bottom of the page.
*/







<

>













<
|
>







105
106
107
108
109
110
111

112
113
114
115
116
117
118
119
120
121
122
123
124
125
126

127
128
129
130
131
132
133
134
135
  if( g.okSetup ){
    @ | <a href="%s(g.zBaseURL)/setup">Setup</a>
  }
  if( !g.noPswd ){
    @ | <a href="%s(g.zBaseURL)/login">%s(zLogInOut)</a>
  }
  @ </div>

  if( nSubmenu>0 ){
    @ <div id="sub-menu">
    int i;
    qsort(aSubmenu, nSubmenu, sizeof(aSubmenu[0]), submenuCompare);
    for(i=0; i<nSubmenu; i++){
      struct Submenu *p = &aSubmenu[i];
      char *zTail = i<nSubmenu-1 ? " | " : "";
      if( p->zLink==0 ){
        @ <span class="label">%h(p->zLabel)</span>
        @ <span class="tail">%s(zTail)</span>
      }else{
        @ <a class="label" href="%T(p->zLink)">%h(p->zLabel)</a>
        @ <span class="tail">%s(zTail)</span>
      }
    }

    @ </div>
  }
  @ <div id="page">
  g.cgiPanic = 1;
}

/*
** Draw the footer at the bottom of the page.
*/