From patchwork Tue Mar 25 21:49:30 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: hgk: use hg export to write commits From: Andrew Shadura X-Patchwork-Id: 4063 Message-Id: <07445a7e9050ee48bff0.1395784170@localhost.localdomain> To: mercurial-devel@selenic.com Date: Tue, 25 Mar 2014 22:49:30 +0100 # HG changeset patch # User Andrew Shadura # Date 1394904471 -3600 # Sat Mar 15 18:27:51 2014 +0100 # Node ID 07445a7e9050ee48bff0e04bb1c240e71cfea290 # Parent d1ef724df3b4d403338d986cf25a7e8bd5a67264 hgk: use hg export to write commits Instead of calling internal command, use hg export to produce changeset diffs compatible with hg import directly. diff --git a/contrib/hgk b/contrib/hgk --- a/contrib/hgk +++ b/contrib/hgk @@ -3893,7 +3893,7 @@ proc mktaggo {} { } proc writecommit {} { - global rowmenuid wrcomtop commitinfo wrcomcmd + global rowmenuid wrcomtop commitinfo set top .writecommit set wrcomtop $top @@ -3908,9 +3908,6 @@ proc writecommit {} { $top.head insert 0 [lindex $commitinfo($rowmenuid) 0] $top.head conf -state readonly grid x $top.head -sticky w - ttk::label $top.clab -text "Command:" - ttk::entry $top.cmd -width 60 -textvariable wrcomcmd - grid $top.clab $top.cmd -sticky w -pady 10 ttk::label $top.flab -text "Output file:" ttk::entry $top.fname -width 60 $top.fname insert 0 [file normalize "commit-[string range $rowmenuid 0 6]"] @@ -3931,9 +3928,8 @@ proc wrcomgo {} { global wrcomtop set id [$wrcomtop.sha1 get] - set cmd "echo $id | [$wrcomtop.cmd get]" set fname [$wrcomtop.fname get] - if {[catch {exec sh -c $cmd > $fname &} err]} { + if {[catch {exec $::env(HG) --config ui.report_untrusted=false export --git -o [string map {% %%} $fname] $id} err]} { error_popup "Error writing commit: $err" } catch {destroy $wrcomtop} @@ -4059,7 +4055,6 @@ proc getconfig {} { set datemode 0 set boldnames 0 set diffopts "-U 5 -p" -set wrcomcmd "\"\$HG\" --config ui.report_untrusted=false debug-diff-tree --stdin -p --pretty" set mainfont {Helvetica 9} set curidfont {}