Overview
SHA1 Hash: | c82fb617751103296e041d5839b9a7408cebda83 |
---|---|
Date: | 2007-09-24 06:53:46 |
User: | jnc |
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. |
Timelines: | ancestors | descendants | both | trunk |
Other Links: | files | ZIP archive | manifest |
Tags And Properties
- branch=trunk inherited from [a28c83647d]
- sym-trunk inherited from [a28c83647d]
Changes
[hide diffs]Modified src/db.c from [c864ef2a7b] to [65cc9f7698].
@@ -921,11 +921,11 @@ if( g.argc>2 ){ int i; db_begin_transaction(); for(i=2; i<g.argc; i++){ char *zName, *zValue; - int j; + int j, removed=0; zName = mprintf("%s", g.argv[i]); for(j=0; zName[j] && zName[j]!='='; j++){} if( zName[j] ){ zName[j] = 0; @@ -932,17 +932,22 @@ 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{ - printf("%s is undefined\n", zName); + 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;
Modified src/diffcmd.c from [16a1f70543] to [a106583630].
@@ -40,35 +40,52 @@ for(i=n+1; i<=n+k; i++){ if( z[i]=='"' ) z[i] = '_'; } } - - /* ** COMMAND: diff -** COMMAND: tkdiff ** -** Usage: %fossil diff|tkdiff FILE... +** 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. Use -** either "diff -u" or "tkdiff". +** 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; + 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(); - blob_zero(&cmd); - blob_appendf(&cmd, "%s ", g.argv[1]); + + 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]; @@ -76,11 +93,13 @@ zV2 = g.argv[i+1]; }else{ fossil_panic("too many versions"); } }else{ - blob_appendf(&cmd, "%s ", z); + 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); @@ -98,19 +117,31 @@ 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); + if( internalDiff==1 ){ + Blob current; + Blob out; + blob_zero(¤t); + blob_read_from_file(¤t, zFile); + blob_zero(&out); + unified_diff(¤t, &record, 5, &out); + printf("%s\n", blob_str(&out)); + blob_reset(¤t); + 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); }
Modified todo.txt from [a134ed615f] to [8c698d0971].
@@ -20,11 +20,11 @@ * 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. @@ -46,13 +46,11 @@ 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. + 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 @@ -118,5 +116,9 @@ 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/