contrib/hgk
changeset 3056 3dab573a4330
parent 2297 936b615eb44e
child 3089 d0fcce3728d1
equal deleted inserted replaced
3055:11e3396e3a2b 3056:3dab573a4330
    98 	set ok 0
    98 	set ok 0
    99 	if {$j >= 0} {
    99 	if {$j >= 0} {
   100 	    set ids [string range $cmit 0 [expr {$j - 1}]]
   100 	    set ids [string range $cmit 0 [expr {$j - 1}]]
   101 	    set ok 1
   101 	    set ok 1
   102 	    foreach id $ids {
   102 	    foreach id $ids {
   103 		if {![regexp {^[0-9a-f]{40}$} $id]} {
   103 		if {![regexp {^[0-9a-f]{12}$} $id]} {
   104 		    set ok 0
   104 		    set ok 0
   105 		    break
   105 		    break
   106 		}
   106 		}
   107 	    }
   107 	    }
   108 	}
   108 	}
   259     set files [glob -nocomplain -types f [file join $git $base *]]
   259     set files [glob -nocomplain -types f [file join $git $base *]]
   260     foreach f $files {
   260     foreach f $files {
   261 	catch {
   261 	catch {
   262 	    set fd [open $f r]
   262 	    set fd [open $f r]
   263 	    set line [read $fd 40]
   263 	    set line [read $fd 40]
   264 	    if {[regexp {^[0-9a-f]{40}} $line id]} {
   264 	    if {[regexp {^[0-9a-f]{12}} $line id]} {
   265 		set name "$dname[file tail $f]"
   265 		set name "$dname[file tail $f]"
   266 		set otherrefids($name) $id
   266 		set otherrefids($name) $id
   267 		lappend idotherrefs($id) $name
   267 		lappend idotherrefs($id) $name
   268 	    }
   268 	    }
   269 	    close $fd
   269 	    close $fd
  1741 		bell
  1741 		bell
  1742 	    }
  1742 	    }
  1743 	}
  1743 	}
  1744 	return
  1744 	return
  1745     }
  1745     }
  1746     if {![regexp {^[0-9a-f]{40}} $line id]} {
  1746     if {![regexp {^[0-9a-f]{12}} $line id]} {
  1747 	error_popup "Can't parse git-diff-tree output: $line"
  1747 	error_popup "Can't parse git-diff-tree output: $line"
  1748 	stopfindproc
  1748 	stopfindproc
  1749 	return
  1749 	return
  1750     }
  1750     }
  1751     if {![info exists idline($id)]} {
  1751     if {![info exists idline($id)]} {
  1854 		error_popup "Couldn't find diffs for {$ids}"
  1854 		error_popup "Couldn't find diffs for {$ids}"
  1855 	    }
  1855 	    }
  1856 	}
  1856 	}
  1857 	return
  1857 	return
  1858     }
  1858     }
  1859     if {[regexp {^([0-9a-f]{40}) \(from ([0-9a-f]{40})\)} $line match id p]} {
  1859     if {[regexp {^([0-9a-f]{12}) \(from ([0-9a-f]{12})\)} $line match id p]} {
  1860 	# start of a new string of diffs
  1860 	# start of a new string of diffs
  1861 	donefilediff
  1861 	donefilediff
  1862 	set fdiffids [list $id $p]
  1862 	set fdiffids [list $id $p]
  1863 	set fdiffs {}
  1863 	set fdiffs {}
  1864     } elseif {[string match ":*" $line]} {
  1864     } elseif {[string match ":*" $line]} {
  2012     global ctext idline linknum
  2012     global ctext idline linknum
  2013 
  2013 
  2014     set start [$ctext index "end - 1c"]
  2014     set start [$ctext index "end - 1c"]
  2015     $ctext insert end $text
  2015     $ctext insert end $text
  2016     $ctext insert end "\n"
  2016     $ctext insert end "\n"
  2017     set links [regexp -indices -all -inline {[0-9a-f]{40}} $text]
  2017     set links [regexp -indices -all -inline {[0-9a-f]{12}} $text]
  2018     foreach l $links {
  2018     foreach l $links {
  2019 	set s [lindex $l 0]
  2019 	set s [lindex $l 0]
  2020 	set e [lindex $l 1]
  2020 	set e [lindex $l 1]
  2021 	set linkid [string range $text $s $e]
  2021 	set linkid [string range $text $s $e]
  2022 	if {![info exists idline($linkid)]} continue
  2022 	if {![info exists idline($linkid)]} continue