Fossil

Check-in [f6c13632]
Login

Check-in [f6c13632]

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

Overview
Comment:Fix the "fossil diff --undo" option so that it works even when called from a subdirectory of the project.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: f6c13632bb9632ff55219fc1a3ff4ef471764714
User & Date: drh 2015-09-12 19:18:28
Context
2015-09-15
19:11
"cat" synonym for "stash show" ... (Closed-Leaf check-in: 533f8b6a user: bch tags: stash-cat)
18:58
Make sure memory returned from db_get() has been properly reallocated if it uses the default value. ... (check-in: 868404c0 user: drh tags: trunk)
2015-09-12
19:18
Fix the "fossil diff --undo" option so that it works even when called from a subdirectory of the project. ... (check-in: f6c13632 user: drh tags: trunk)
2015-09-11
13:53
Add support for the --undo option to the "fossil diff" command. ... (check-in: 485aa806 user: drh tags: trunk)
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/diffcmd.c.

476
477
478
479
480
481
482

483

484




485

486
487
488
489
490
491
492
493
static void diff_all_against_undo(
  const char *zDiffCmd,     /* Use this diff command.  NULL for built-in */
  const char *zBinGlob,     /* Treat file names matching this as binary */
  int fIncludeBinary,       /* Treat file names matching this as binary */
  u64 diffFlags             /* Flags controlling diff output */
){
  Stmt q;

  db_prepare(&q, "SELECT pathname FROM undo");

  while( db_step(&q)==SQLITE_ROW ){




    diff_one_against_undo(zDiffCmd, zBinGlob, fIncludeBinary, diffFlags,

                          db_column_text(&q, 0));
  }
  db_finalize(&q);
}

/*
** Output the differences between two versions of a single file.
** zFrom and zTo are the check-ins containing the two file versions.







>
|
>

>
>
>
>
|
>
|







476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
static void diff_all_against_undo(
  const char *zDiffCmd,     /* Use this diff command.  NULL for built-in */
  const char *zBinGlob,     /* Treat file names matching this as binary */
  int fIncludeBinary,       /* Treat file names matching this as binary */
  u64 diffFlags             /* Flags controlling diff output */
){
  Stmt q;
  Blob content;
  db_prepare(&q, "SELECT pathname, content FROM undo");
  blob_init(&content, 0, 0);
  while( db_step(&q)==SQLITE_ROW ){
    const char *zFile = (const char*)db_column_text(&q, 0);
    char *zFullName = mprintf("%s%s", g.zLocalRoot, zFile);
    db_column_blob(&q, 1, &content);
    diff_file(&content, 0, zFullName, zFile,
              zDiffCmd, zBinGlob, fIncludeBinary, diffFlags);
    fossil_free(zFullName);
    blob_reset(&content);
  }
  db_finalize(&q);
}

/*
** Output the differences between two versions of a single file.
** zFrom and zTo are the check-ins containing the two file versions.