Displayed file timestamps and diff tool

So I was looking to see who changed a line of code, and when. I fired up revtool and isolated the line. I fired up difftool from revtool and I see the before and after files with the differences.

In revtool, the “before” file is dated Jan xx, 2011, and the “after” file is dated Feb xx, 2011.

In difftool, the two files are dated “now”.

Is there a way I can tell difftool to show me the dates of the files I’m looking at instead of the current date/time??

You are correct. That looks like a bug in difftool.

You can view the diffs in revtool directly. Left-click one rev and then right-click the other rev. In that case, the dates are displayed correctly, but if you launch difftool the dates are pointless.

Here is a quick hack that appears to fix the problem:

===== gui/difftool.tcl 1.107 vs edited =====
--- 1.107/src/gui/difftool.tcl  2016-03-04 16:51:29 -05:00
+++ edited/src/gui/difftool.tcl 2018-02-21 06:08:09 -05:00
@@ -180,7 +180,7 @@
                catch {close $f}
        set tmp [tmpfile difftool]
-       if {[catch {exec bk get -qkp -r$rev $file > $tmp} msg]} {
+       if {[catch {exec bk get -qk -r$rev -TG$tmp $file} msg]} {
                puts "$msg"
                exit 1

It relies on the -T option to 'bk get' to set the timestamp of a checked out file to match the revision time and an undocumented option -G to override the ‘gfile’ pathname.

I will need to get @mcvoy to look at this change to make sure it seems right. (I don’t normally work in the GUIs)

Thanks a bunch, Wayne!

I should be able to get back to you on the other thing in a week or so -
I’m still wicked busy.

BTW it appears this bug has had a long history. This worked at one point and then was broken when Larry fixed a different bug.

#### src/gui/ChangeSet ####
2009-02-11 16:27:49-08:00, lm@travis.bitmover.com +1 -0
  difftool used -G which means that you can't run difftool
  on a file that is merged in RESYNC.

==== src/gui/difftool.tcl ====
2009-02-11 16:27:48-08:00, lm@travis.bitmover.com +1 -1
  Do not use get -G, it breaks when you have a merge pointer
  and no gfile (see the test case in this cset but note that
  the bug is fixed twice, here and in slib.c; undo both to
  make the test fail).
--- 1.70/src/gui/difftool.tcl   2008-09-09 14:56:25 -04:00
+++ 1.71/src/gui/difftool.tcl   2009-02-11 19:27:48 -05:00
@@ -193,7 +193,7 @@ proc getRev {file rev checkMods} \
        set pid [pid]
        incr unique
        set tmp "$tmp@$rev-$pid$unique"
-       if {[catch {exec bk get -qkTG$tmp -r$rev $file} msg]} {
+       if {[catch {exec bk get -qkTp -r$rev $file > $tmp} msg]} {
                puts "$msg"
                exit 1

Larry added a test case for this but I didn’t run GUI regression when I made a quick pass at this last time. So the correct fix will take a little thinking.

OK. I have verified that this fix does indeed work for the case that Larry was trying to address as well so I made a cset and pushed the changes to bk://bkbits.net/bk/dev

Thanks a bunch, folks!