Fossil SCM

Fix the "fossil diff --undo" option so that it works even when called from a subdirectory of the project.

drh 2015-09-12 19:18 trunk
Commit f6c13632bb9632ff55219fc1a3ff4ef471764714
1 file changed +10 -3
+10 -3
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -478,14 +478,21 @@
478478
const char *zBinGlob, /* Treat file names matching this as binary */
479479
int fIncludeBinary, /* Treat file names matching this as binary */
480480
u64 diffFlags /* Flags controlling diff output */
481481
){
482482
Stmt q;
483
- db_prepare(&q, "SELECT pathname FROM undo");
483
+ Blob content;
484
+ db_prepare(&q, "SELECT pathname, content FROM undo");
485
+ blob_init(&content, 0, 0);
484486
while( db_step(&q)==SQLITE_ROW ){
485
- diff_one_against_undo(zDiffCmd, zBinGlob, fIncludeBinary, diffFlags,
486
- db_column_text(&q, 0));
487
+ const char *zFile = (const char*)db_column_text(&q, 0);
488
+ char *zFullName = mprintf("%s%s", g.zLocalRoot, zFile);
489
+ db_column_blob(&q, 1, &content);
490
+ diff_file(&content, 0, zFullName, zFile,
491
+ zDiffCmd, zBinGlob, fIncludeBinary, diffFlags);
492
+ fossil_free(zFullName);
493
+ blob_reset(&content);
487494
}
488495
db_finalize(&q);
489496
}
490497
491498
/*
492499
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -478,14 +478,21 @@
478 const char *zBinGlob, /* Treat file names matching this as binary */
479 int fIncludeBinary, /* Treat file names matching this as binary */
480 u64 diffFlags /* Flags controlling diff output */
481 ){
482 Stmt q;
483 db_prepare(&q, "SELECT pathname FROM undo");
 
 
484 while( db_step(&q)==SQLITE_ROW ){
485 diff_one_against_undo(zDiffCmd, zBinGlob, fIncludeBinary, diffFlags,
486 db_column_text(&q, 0));
 
 
 
 
 
487 }
488 db_finalize(&q);
489 }
490
491 /*
492
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -478,14 +478,21 @@
478 const char *zBinGlob, /* Treat file names matching this as binary */
479 int fIncludeBinary, /* Treat file names matching this as binary */
480 u64 diffFlags /* Flags controlling diff output */
481 ){
482 Stmt q;
483 Blob content;
484 db_prepare(&q, "SELECT pathname, content FROM undo");
485 blob_init(&content, 0, 0);
486 while( db_step(&q)==SQLITE_ROW ){
487 const char *zFile = (const char*)db_column_text(&q, 0);
488 char *zFullName = mprintf("%s%s", g.zLocalRoot, zFile);
489 db_column_blob(&q, 1, &content);
490 diff_file(&content, 0, zFullName, zFile,
491 zDiffCmd, zBinGlob, fIncludeBinary, diffFlags);
492 fossil_free(zFullName);
493 blob_reset(&content);
494 }
495 db_finalize(&q);
496 }
497
498 /*
499

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button