Patchwork hgk: use hg export to write commits

login
register
mail settings
Submitter Andrew Shadura
Date March 25, 2014, 9:49 p.m.
Message ID <07445a7e9050ee48bff0.1395784170@localhost.localdomain>
Download mbox | patch
Permalink /patch/4063/
State Accepted
Commit 70f9a5d8c06fa53cfbbc01593c35540dc7eb1380
Headers show

Comments

Andrew Shadura - March 25, 2014, 9:49 p.m.
# HG changeset patch
# User Andrew Shadura <andrew@shadura.me>
# 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.
Matt Mackall - April 3, 2014, 8:31 p.m.
On Tue, 2014-03-25 at 22:49 +0100, Andrew Shadura wrote:
> # HG changeset patch
> # User Andrew Shadura <andrew@shadura.me>
> # Date 1394904471 -3600
> #      Sat Mar 15 18:27:51 2014 +0100
> # Node ID 07445a7e9050ee48bff0e04bb1c240e71cfea290
> # Parent  d1ef724df3b4d403338d986cf25a7e8bd5a67264
> hgk: use hg export to write commits

Queued for default, thanks.

Patch

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 {}