Patchwork [4,of,5,V2] cmdutil: call memctx directly instead of makememctx

login
register
mail settings
Submitter Sean Farley
Date Aug. 6, 2014, 11:20 p.m.
Message ID <dd995b3276747e0ceab3.1407367225@laptop.local>
Download mbox | patch
Permalink /patch/5305/
State Changes Requested
Headers show

Comments

Sean Farley - Aug. 6, 2014, 11:20 p.m.
# HG changeset patch
# User Sean Farley <sean.michael.farley@gmail.com>
# Date 1402871026 25200
#      Sun Jun 15 15:23:46 2014 -0700
# Node ID dd995b3276747e0ceab33a4cddaf4e3dbcd4a877
# Parent  e0a761486fd816bb7baab8645f6c44c64e0489ef
cmdutil: call memctx directly instead of makememctx

Now that a memctx can take a store-type object directly, let's use that instead
of makememctx.

Patch

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -598,10 +598,11 @@  def tryimportone(ui, repo, hunk, parents
     strip = opts["strip"]
     sim = float(opts.get('similarity') or 0)
     if not tmpname:
         return (None, None, False)
     msg = _('applied to working directory')
+    extra = {}
 
     rejects = False
 
     try:
         cmdline_message = logmessage(ui, opts)
@@ -674,28 +675,30 @@  def tryimportone(ui, repo, hunk, parents
                 n = repo.commit(message, opts.get('user') or user,
                                 opts.get('date') or date, match=m,
                                 editor=editor, force=partial)
         else:
             if opts.get('exact') or opts.get('import_branch'):
-                branch = branch or 'default'
+                extra['branch'] = branch or 'default'
             else:
-                branch = p1.branch()
+                extra['branch'] = p1.branch()
             store = patch.filestore()
             try:
                 files = set()
                 try:
                     patch.patchrepo(ui, repo, p1, store, tmpname, strip,
                                     files, eolmode=None)
                 except patch.PatchError, e:
                     raise util.Abort(str(e))
                 editor = getcommiteditor(editform='import.bypass')
-                memctx = context.makememctx(repo, (p1.node(), p2.node()),
-                                            message,
-                                            opts.get('user') or user,
-                                            opts.get('date') or date,
-                                            branch, files, store,
-                                            editor=editor)
+                memctx = context.memctx(repo, (p1.node(), p2.node()),
+                                        message,
+                                        files,
+                                        store,
+                                        opts.get('user') or user,
+                                        opts.get('date') or date,
+                                        extra,
+                                        editor=getcommiteditor())
                 n = memctx.commit()
             finally:
                 store.close()
         if opts.get('exact') and hex(n) != nodeid:
             raise util.Abort(_('patch is damaged or loses information'))