[PATCH] patch: add 'extra' argument to makememctx

Laurent Charignon lcharignon at fb.com
Wed May 27 14:54:10 CDT 2015


# HG changeset patch
# User Laurent Charignon <lcharignon at fb.com>
# Date 1432325205 25200
#      Fri May 22 13:06:45 2015 -0700
# Node ID 3849154370284d72be0770cf0734bbd071539f19
# Parent  6ac860f700b5cfeda232d5305963047696b869ca
patch: add 'extra' argument to makememctx

The uncommit command in evolve needs to create memory context with given
extra parameters. This patch allows us to do that instead of always giving them
an empty value and having to override it afterwards.

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -340,7 +340,7 @@
 
 
 def makememctx(repo, parents, text, user, date, branch, files, store,
-               editor=None):
+               editor=None, extra=None):
     def getfilectx(repo, memctx, path):
         data, mode, copied = store.getfile(path)
         if data is None:
@@ -348,7 +348,8 @@
         islink, isexec = mode
         return memfilectx(repo, path, data, islink=islink, isexec=isexec,
                                   copied=copied, memctx=memctx)
-    extra = {}
+    if extra is None:
+        extra = {}
     if branch:
         extra['branch'] = encoding.fromlocal(branch)
     ctx =  memctx(repo, parents, text, files, getfilectx, user,


More information about the Mercurial-devel mailing list