export: map wctx.node() to 'ff...' node id (issue5438)
authorYuya Nishihara <yuya@tcha.org>
Sat, 03 Jun 2017 19:17:19 +0900
changeset 32662 9d201b39ccd9
parent 32661 a3064fe3e495
child 32663 5277d6faabb4
export: map wctx.node() to 'ff...' node id (issue5438)
mercurial/cmdutil.py
tests/test-export.t
--- a/mercurial/cmdutil.py	Sat Jun 03 20:39:33 2017 +0900
+++ b/mercurial/cmdutil.py	Sat Jun 03 19:17:19 2017 +0900
@@ -1140,7 +1140,7 @@
 extraexportmap = {}
 
 def _exportsingle(repo, ctx, match, switch_parent, rev, seqno, write, diffopts):
-    node = ctx.node()
+    node = scmutil.binnode(ctx)
     parents = [p.node() for p in ctx.parents() if p]
     branch = ctx.branch()
     if switch_parent:
--- a/tests/test-export.t	Sat Jun 03 20:39:33 2017 +0900
+++ b/tests/test-export.t	Sat Jun 03 19:17:19 2017 +0900
@@ -137,6 +137,28 @@
    foo-9
   +foo-10
 
+Exporting wdir revision:
+
+  $ echo "foo-wdir" >> foo
+  $ hg export 'wdir()'
+  # HG changeset patch
+  # User test
+  # Date 0 0
+  #      Thu Jan 01 00:00:00 1970 +0000
+  # Node ID ffffffffffffffffffffffffffffffffffffffff
+  # Parent  f3acbafac161ec68f1598af38f794f28847ca5d3
+  
+  
+  diff -r f3acbafac161 foo
+  --- a/foo	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/foo	Thu Jan 01 00:00:00 1970 +0000
+  @@ -10,3 +10,4 @@
+   foo-9
+   foo-10
+   foo-11
+  +foo-wdir
+  $ hg revert -q foo
+
 No filename should be printed if stdout is specified explicitly:
 
   $ hg export -v 1 -o -