Fossil

Check-in [db608ee7]
Login

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

Overview
Comment:Continuing work on the "diff" command.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: db608ee72f27666be6645c6151f9e791d512ea71
User & Date: drh 2009-11-06 02:47:30
Context
2009-11-06
03:10
After any kind of database error, include in the error message a warning to the user that it might be wise to run "fossil all rebuild". check-in: 397fa9bf user: drh tags: trunk
02:47
Continuing work on the "diff" command. check-in: db608ee7 user: drh tags: trunk
01:59
Work toward improving the "diff" command. Get the "-r" or "--from" option working. check-in: a51808c0 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/diffcmd.c.

164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
...
265
266
267
268
269
270
271

272
273
274
275
276
277
278
279
280
281
282
283
284

285
286
287
288
289
290
291
292
293
294
295
296
297
298
      fossil_fatal("no such check-in: %s", zFrom);
    }
    load_vfile_from_rid(rid);
    blob_appendf(&sql,
      "SELECT v2.pathname, v2.deleted, v2.chnged, v2.rid==0, v1.rid"
      "  FROM vfile v1, vfile v2 "
      " WHERE v1.pathname=v2.pathname AND v1.vid=%d AND v2.vid=%d"
      "   AND (v2.deleted OR v2.chnged OR v2.rid==0)"
      "UNION "
      "SELECT pathname, 1, 0, 0, 0"
      "  FROM vfile v1"
      " WHERE v1.vid=%d"
      "   AND NOT EXISTS(SELECT 1 FROM vfile v2"
                        " WHERE v2.vid=%d AND v2.pathname=v1.pathname)"
      "UNION "
................................................................................
  isGDiff = g.argv[1][0]=='g';
  isInternDiff = find_option("internal","i",0)!=0;
  zFrom = find_option("from", "r", 1);
  zTo = find_option("to", 0, 1);

  if( zTo==0 ){
    db_must_be_within_tree();

    if( !isInternDiff ){
      zDiffCmd = db_get(isGDiff ? "gdiff-command" : "diff-command", 0);
    }
    verify_all_options();
    if( g.argc==3 ){
      diff_one_against_disk(zFrom, zDiffCmd);
    }else{
      diff_all_against_disk(zFrom, zDiffCmd);
    }
  }else if( zFrom==0 ){
    fossil_fatal("must use --from if --to is present");
  }else{
    db_find_and_open_repository(1);

    if( !isInternDiff ){
      zDiffCmd = db_get(isGDiff ? "gdiff-command" : "diff-command", 0);
    }
    verify_all_options();
    fossil_fatal("--to not yet implemented");
#if 0
    if( g.argc==3 ){
      diff_one_two_versions(zFrom, zTo, zDiffCmd);
    }else{
      diff_all_two_versions(zFrom, zTo, zDiffCmd);
    }
#endif
  }
}







|







 







>
|


<









>
|


<










164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
...
265
266
267
268
269
270
271
272
273
274
275

276
277
278
279
280
281
282
283
284
285
286
287
288

289
290
291
292
293
294
295
296
297
298
      fossil_fatal("no such check-in: %s", zFrom);
    }
    load_vfile_from_rid(rid);
    blob_appendf(&sql,
      "SELECT v2.pathname, v2.deleted, v2.chnged, v2.rid==0, v1.rid"
      "  FROM vfile v1, vfile v2 "
      " WHERE v1.pathname=v2.pathname AND v1.vid=%d AND v2.vid=%d"
      "   AND (v2.deleted OR v2.chnged OR v1.rid!=v2.rid)"
      "UNION "
      "SELECT pathname, 1, 0, 0, 0"
      "  FROM vfile v1"
      " WHERE v1.vid=%d"
      "   AND NOT EXISTS(SELECT 1 FROM vfile v2"
                        " WHERE v2.vid=%d AND v2.pathname=v1.pathname)"
      "UNION "
................................................................................
  isGDiff = g.argv[1][0]=='g';
  isInternDiff = find_option("internal","i",0)!=0;
  zFrom = find_option("from", "r", 1);
  zTo = find_option("to", 0, 1);

  if( zTo==0 ){
    db_must_be_within_tree();
    verify_all_options();
    if( !isInternDiff && g.argc==3 ){
      zDiffCmd = db_get(isGDiff ? "gdiff-command" : "diff-command", 0);
    }

    if( g.argc==3 ){
      diff_one_against_disk(zFrom, zDiffCmd);
    }else{
      diff_all_against_disk(zFrom, zDiffCmd);
    }
  }else if( zFrom==0 ){
    fossil_fatal("must use --from if --to is present");
  }else{
    db_find_and_open_repository(1);
    verify_all_options();
    if( !isInternDiff && g.argc==3 ){
      zDiffCmd = db_get(isGDiff ? "gdiff-command" : "diff-command", 0);
    }

    fossil_fatal("--to not yet implemented");
#if 0
    if( g.argc==3 ){
      diff_one_two_versions(zFrom, zTo, zDiffCmd);
    }else{
      diff_all_two_versions(zFrom, zTo, zDiffCmd);
    }
#endif
  }
}