Fossil

Check-in [c82fb61775]
Login

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

Overview
Comment: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.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: c82fb617751103296e041d5839b9a7408cebda83
User & Date: jnc 2007-09-24 06:53:46.000
Context
2007-09-24
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
12:55
Minor updates to the todo.txt and ideas.txt files. check-in: 43b33702b4 user: drh 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
04:37
Added style.css page that get's from the repo or uses a built in style.css. Removed static formatting in header/footer, replaced with divs, spans and ids which the style.css can totally control. The default style.css is simple, uses blue colors from timeline date area. Fixed minor bug on setup_ulist where it would display footer at top. check-in: 5cd9597428 user: jnc tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/db.c.
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
void cmd_config(void){
  db_open_config();
  if( g.argc>2 ){
    int i;
    db_begin_transaction();
    for(i=2; i<g.argc; i++){
      char *zName, *zValue;
      int j;

      zName = mprintf("%s", g.argv[i]);
      for(j=0; zName[j] && zName[j]!='='; j++){}
      if( zName[j] ){
        zName[j] = 0;
        zValue = &zName[j+1];
        if( zValue[0] ){
          db_global_set(zName, zValue);
        }else{
          db_multi_exec("DELETE FROM global_config WHERE name=%Q", zName);

        }
      }
      zValue = db_global_get(zName, 0);
      if( zValue ){
        printf("%s=%s\n", zName, zValue);
      }else{



        printf("%s is undefined\n", zName);

      }
    }
    db_end_transaction(0);
  }else{
    Stmt q;
    db_prepare(&q, "SELECT name, value FROM global_config ORDER BY name");
    while( db_step(&q)==SQLITE_ROW ){







|










>






>
>
>
|
>







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
void cmd_config(void){
  db_open_config();
  if( g.argc>2 ){
    int i;
    db_begin_transaction();
    for(i=2; i<g.argc; i++){
      char *zName, *zValue;
      int j, removed=0;

      zName = mprintf("%s", g.argv[i]);
      for(j=0; zName[j] && zName[j]!='='; j++){}
      if( zName[j] ){
        zName[j] = 0;
        zValue = &zName[j+1];
        if( zValue[0] ){
          db_global_set(zName, zValue);
        }else{
          db_multi_exec("DELETE FROM global_config WHERE name=%Q", zName);
          removed=1;
        }
      }
      zValue = db_global_get(zName, 0);
      if( zValue ){
        printf("%s=%s\n", zName, zValue);
      }else{
        if( removed==1 ){
          printf("%s has been removed from configuration\n", zName);
        }else{
          printf("%s is undefined\n", zName);
        }
      }
    }
    db_end_transaction(0);
  }else{
    Stmt q;
    db_prepare(&q, "SELECT name, value FROM global_config ORDER BY name");
    while( db_step(&q)==SQLITE_ROW ){
Changes to src/diffcmd.c.
38
39
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
  blob_appendf(pBlob, "\"%s\"", zIn);
  z = blob_buffer(pBlob);
  for(i=n+1; i<=n+k; i++){
    if( z[i]=='"' ) z[i] = '_';
  }
}



/*
** COMMAND: diff
** COMMAND: tkdiff
**
** Usage: %fossil diff|tkdiff 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.  Use





** either "diff -u" or "tkdiff".





*/
void diff_cmd(void){
  const char *zFile;
  Blob cmd;
  Blob fname;
  int i;
  char *zV1 = 0;
  char *zV2 = 0;



  if( g.argc<3 ){
    usage("?OPTIONS? FILE");
  }
  db_must_be_within_tree();






  blob_zero(&cmd);
  blob_appendf(&cmd, "%s ", g.argv[1]);

  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 ){
        zV2 = g.argv[i+1];
      }else{
        fossil_panic("too many versions");
      }
    }else{

      blob_appendf(&cmd, "%s ", z);

    }
  }
  zFile = g.argv[g.argc-1];
  if( !file_tree_name(zFile, &fname) ){
    fossil_panic("unknown file: %s", zFile);
  }
  if( zV1==0 ){







<
<


<

|
>

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





|


|
>
>




>
>
>
>
>
>
|
|
>











>
|
>







38
39
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
107
  blob_appendf(pBlob, "\"%s\"", zIn);
  z = blob_buffer(pBlob);
  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 ){
        zV2 = g.argv[i+1];
      }else{
        fossil_panic("too many versions");
      }
    }else{
      if( internalDiff==0 ){
        blob_appendf(&cmd, "%s ", z);
      }
    }
  }
  zFile = g.argv[g.argc-1];
  if( !file_tree_name(zFile, &fname) ){
    fossil_panic("unknown file: %s", zFile);
  }
  if( zV1==0 ){
96
97
98
99
100
101
102











103
104
105
106
107
108
109
110
111

112
113
114
115
116
    }
    blob_zero(&vname);
    do{
      blob_reset(&vname);
      blob_appendf(&vname, "%s~%d", zFile, cnt++);
    }while( access(blob_str(&vname),0)==0 );
    content_get(rid, &record);











    blob_write_to_file(&record, blob_str(&vname));
    blob_reset(&record);
    shell_escape(&cmd, blob_str(&vname));
    blob_appendf(&cmd, " ");
    shell_escape(&cmd, zFile);
    system(blob_str(&cmd));
    unlink(blob_str(&vname));
    blob_reset(&vname);
    blob_reset(&cmd);

  }else{
    fossil_panic("not yet implemented");
  }
  blob_reset(&fname);
}







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





115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
    }
    blob_zero(&vname);
    do{
      blob_reset(&vname);
      blob_appendf(&vname, "%s~%d", zFile, cnt++);
    }while( access(blob_str(&vname),0)==0 );
    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));
      blob_appendf(&cmd, " ");
      shell_escape(&cmd, zFile);
      system(blob_str(&cmd));
      unlink(blob_str(&vname));
      blob_reset(&vname);
      blob_reset(&cmd);
    }
  }else{
    fossil_panic("not yet implemented");
  }
  blob_reset(&fname);
}
Changes to todo.txt.
18
19
20
21
22
23
24
25

26
27
28
29
30
31
32
    process.  fwrite() is not suppose to do this.  Need to figure
    out what is going wrong.

 *  Bug: pull is ending prematurely.

 *  Bug: Make sure merge and other commands (check-out) do not try
    to use a phantom.
¿

 *  The ipaddr field of the rcvfrom table is not being set.  This
    field should be the IP address from which information is received
    for the local repository.  So when somebody does a push of new
    files we record the ipaddr.  Or when we do a pull, we record
    the ipaddr.

 *  Additional information displayed for the "vinfo" page:







<
>







18
19
20
21
22
23
24

25
26
27
28
29
30
31
32
    process.  fwrite() is not suppose to do this.  Need to figure
    out what is going wrong.

 *  Bug: pull is ending prematurely.

 *  Bug: Make sure merge and other commands (check-out) do not try
    to use a phantom.

¿
 *  The ipaddr field of the rcvfrom table is not being set.  This
    field should be the IP address from which information is received
    for the local repository.  So when somebody does a push of new
    files we record the ipaddr.  Or when we do a pull, we record
    the ipaddr.

 *  Additional information displayed for the "vinfo" page:
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
    delta compression.  This results in excess bandwidth usage.
    There are some pieces in xfer.c that are sketches of ideas on
    how to do delta compression, but nothing has been implemented.

 *  Enhancements to the diff and tkdiff commands in the cli.
    Allow the entire tree or a subtree to be diffed, not just a 
    single file.  Allow diffs against any two arbitrary versions,
    not just diffs against the current check-out.  Allow 
    configuration options to replace tkdiff with some other
    visual differ of the users choice. Example: eskil.

 *  Ticketing interface (expand this bullet)

     +  Create new tickets as files in the file hierarchy
     +  Append remarks to a ticket
     +  Add attachments to a ticket
     +  Change attributes of a ticket







|
<
<







44
45
46
47
48
49
50
51


52
53
54
55
56
57
58
    delta compression.  This results in excess bandwidth usage.
    There are some pieces in xfer.c that are sketches of ideas on
    how to do delta compression, but nothing has been implemented.

 *  Enhancements to the diff and tkdiff commands in the cli.
    Allow the entire tree or a subtree to be diffed, not just a 
    single file.  Allow diffs against any two arbitrary versions,
    not just diffs against the current check-out.



 *  Ticketing interface (expand this bullet)

     +  Create new tickets as files in the file hierarchy
     +  Append remarks to a ticket
     +  Add attachments to a ticket
     +  Change attributes of a ticket
116
117
118
119
120
121
122




    a check-in comment with a new comment.  Comment changes should be
    GPG clearsigned at the very least.  Comment changes only apply if
    the user who made the change has the right permissions.

 *  Make the interface to fossil look pretty and be customizable so
    that other people will be attracted to it, will take over maintenance
    of it, and we can eventually move on to other things.











>
>
>
>
114
115
116
117
118
119
120
121
122
123
124
    a check-in comment with a new comment.  Comment changes should be
    GPG clearsigned at the very least.  Comment changes only apply if
    the user who made the change has the right permissions.

 *  Make the interface to fossil look pretty and be customizable so
    that other people will be attracted to it, will take over maintenance
    of it, and we can eventually move on to other things.
    
    This has begun, but I wonder if we need to use a templating system for
    full customization. If the CSS is done correctly, you can change 99.9%
    of everything. See: http://www.csszengarden.com/