]> asedeno.scripts.mit.edu Git - git.git/blobdiff - lib/choose_rev.tcl
git-gui: show unstaged symlinks in diff viewer
[git.git] / lib / choose_rev.tcl
index bb6966eb93a308983e98e5829a1acdce123ef406..ec064b3e13a6b2e6ab0e3ee05ab7a55cab8aa4bc 100644 (file)
@@ -17,6 +17,7 @@ field spec_head       ; # list of all head specs
 field spec_trck       ; # list of all tracking branch specs
 field spec_tag        ; # list of all tag specs
 field tip_data        ; # array of tip commit info by refname
+field log_last        ; # array of reflog date by refname
 
 field tooltip_wm        {} ; # Current tooltip toplevel, if open
 field tooltip_t         {} ; # Text widget in $tooltip_wm
@@ -33,6 +34,10 @@ proc new_unmerged {path {title {}}} {
 constructor _new {path unmerged_only title} {
        global current_branch is_detached
 
+       if {![info exists ::all_remotes]} {
+               load_all_remotes
+       }
+
        set w $path
 
        if {$title ne {}} {
@@ -518,7 +523,14 @@ method _open_tooltip {} {
                set cmit [lindex $data 0]
        }
 
-       $tooltip_t insert end "[lindex $spec 0]\n"
+       $tooltip_t insert end [lindex $spec 0]
+       set last [_reflog_last $this [lindex $spec 1]]
+       if {$last ne {}} {
+               $tooltip_t insert end "\n"
+               $tooltip_t insert end "updated"
+               $tooltip_t insert end " $last"
+       }
+       $tooltip_t insert end "\n"
 
        if {$tag ne {}} {
                $tooltip_t insert end "\n"
@@ -553,6 +565,30 @@ method _open_tooltip {} {
        _position_tooltip $this
 }
 
+method _reflog_last {name} {
+       if {[info exists reflog_last($name)]} {
+               return reflog_last($name)
+       }
+
+       set last {}
+       if {[catch {set last [file mtime [gitdir $name]]}]
+       && ![catch {set g [open [gitdir logs $name] r]}]} {
+               fconfigure $g -translation binary
+               while {[gets $g line] >= 0} {
+                       if {[regexp {> ([1-9][0-9]*) } $line line when]} {
+                               set last $when
+                       }
+               }
+               close $g
+       }
+
+       if {$last ne {}} {
+               set last [clock format $last -format {%a %b %e %H:%M:%S %Y}]
+       }
+       set reflog_last($name) $last
+       return $last
+}
+
 method _position_tooltip {} {
        set max_h [lindex [split [$tooltip_t index end] .] 0]
        set max_w 0