contrib/hgk
changeset 3940 a33ddd20105c
parent 3093 edefbb3a3b08
child 4501 b2338c0cf468
equal deleted inserted replaced
3936:ea238a4e9e8b 3940:a33ddd20105c
    41 	    lappend revargs $opt
    41 	    lappend revargs $opt
    42 	}
    42 	}
    43     }
    43     }
    44     if [catch {
    44     if [catch {
    45 	set parse_args [concat --default HEAD $revargs]
    45 	set parse_args [concat --default HEAD $revargs]
    46 	set parsed_args [split [eval exec hg debug-rev-parse $parse_args] "\n"]
    46 	set parse_temp [eval exec hg debug-rev-parse $parse_args]
       
    47 	regsub -all "\r\n" $parse_temp "\n" parse_temp
       
    48 	set parsed_args [split $parse_temp "\n"]
    47     } err] {
    49     } err] {
    48 	# if git-rev-parse failed for some reason...
    50 	# if git-rev-parse failed for some reason...
    49 	if {$rargs == {}} {
    51 	if {$rargs == {}} {
    50 	    set revargs HEAD
    52 	    set revargs HEAD
    51 	}
    53 	}
   106 	if {$start == 0} {
   108 	if {$start == 0} {
   107 	    set cmit "$leftover$cmit"
   109 	    set cmit "$leftover$cmit"
   108 	    set leftover {}
   110 	    set leftover {}
   109 	}
   111 	}
   110 	set start [expr {$i + 1}]
   112 	set start [expr {$i + 1}]
       
   113 	regsub -all "\r\n" $cmit "\n" cmit
   111 	set j [string first "\n" $cmit]
   114 	set j [string first "\n" $cmit]
   112 	set ok 0
   115 	set ok 0
   113 	if {$j >= 0} {
   116 	if {$j >= 0} {
   114 	    set ids [string range $cmit 0 [expr {$j - 1}]]
   117 	    set ids [string range $cmit 0 [expr {$j - 1}]]
   115 	    set ok 1
   118 	    set ok 1
   207 	    lappend children($p) $id
   210 	    lappend children($p) $id
   208 	    incr nchildren($p)
   211 	    incr nchildren($p)
   209 	    incr ncleft($p)
   212 	    incr ncleft($p)
   210 	}
   213 	}
   211     }
   214     }
       
   215     regsub -all "\r\n" $contents "\n" contents
   212     foreach line [split $contents "\n"] {
   216     foreach line [split $contents "\n"] {
   213 	if {$inhdr} {
   217 	if {$inhdr} {
   214 	    set line [split $line]
   218 	    set line [split $line]
   215 	    if {$line == {}} {
   219 	    if {$line == {}} {
   216 		set inhdr 0
   220 		set inhdr 0
   255 
   259 
   256 proc readrefs {} {
   260 proc readrefs {} {
   257     global tagids idtags headids idheads tagcontents
   261     global tagids idtags headids idheads tagcontents
   258 
   262 
   259     set tags [exec hg tags]
   263     set tags [exec hg tags]
   260     set lines [split $tags '\n']
   264     regsub -all "\r\n" $tags "\n" tags
       
   265     set lines [split $tags "\n"]
   261     foreach f $lines {
   266     foreach f $lines {
   262 	set f [regexp -all -inline {\S+} $f]
   267 	set f [regexp -all -inline {\S+} $f]
   263 	set direct [lindex $f 0]
   268 	set direct [lindex $f 0]
   264 	set full [lindex $f 1]
   269 	set full [lindex $f 1]
   265 	set sha [split $full ':']
   270 	set sha [split $full ':']
  2854 	return
  2859 	return
  2855     }
  2860     }
  2856     if {$ids != $diffids || $bdf != $blobdifffd($ids)} {
  2861     if {$ids != $diffids || $bdf != $blobdifffd($ids)} {
  2857 	return
  2862 	return
  2858     }
  2863     }
       
  2864     regsub -all "\r" $line "" line
  2859     $ctext conf -state normal
  2865     $ctext conf -state normal
  2860     if {[regexp {^diff --git a/(.*) b/(.*)} $line match fname newname]} {
  2866     if {[regexp {^diff --git a/(.*) b/(.*)} $line match fname newname]} {
  2861 	# start of a new file
  2867 	# start of a new file
  2862 	$ctext insert end "\n"
  2868 	$ctext insert end "\n"
  2863 	$ctext tag add $curdifftag $curtagstart end
  2869 	$ctext tag add $curdifftag $curtagstart end
  2912 	    }
  2918 	    }
  2913 	    $ctext insert end "$line\n"
  2919 	    $ctext insert end "$line\n"
  2914 	} elseif {$diffinhdr || $x == "\\"} {
  2920 	} elseif {$diffinhdr || $x == "\\"} {
  2915 	    # e.g. "\ No newline at end of file"
  2921 	    # e.g. "\ No newline at end of file"
  2916 	    $ctext insert end "$line\n" filesep
  2922 	    $ctext insert end "$line\n" filesep
  2917 	} else {
  2923 	} elseif  {$line != ""} {
  2918 	    # Something else we don't recognize
  2924 	    # Something else we don't recognize
  2919 	    if {$curdifftag != "Comments"} {
  2925 	    if {$curdifftag != "Comments"} {
  2920 		$ctext insert end "\n"
  2926 		$ctext insert end "\n"
  2921 		$ctext tag add $curdifftag $curtagstart end
  2927 		$ctext tag add $curdifftag $curtagstart end
  2922 		set curtagstart [$ctext index "end - 1c"]
  2928 		set curtagstart [$ctext index "end - 1c"]