Patchwork [2,of,6,v2] import: refactor date and user handling

login
register
mail settings
Submitter timeless@mozdev.org
Date Dec. 31, 2015, 6:47 a.m.
Message ID <442c96941ae7ae287485.1451544436@waste.org>
Download mbox | patch
Permalink /patch/12441/
State Accepted
Delegated to: Yuya Nishihara
Headers show

Comments

timeless@mozdev.org - Dec. 31, 2015, 6:47 a.m.
# HG changeset patch
# User timeless <timeless@mozdev.org>
# Date 1451509591 0
#      Wed Dec 30 21:06:31 2015 +0000
# Node ID 442c96941ae7ae28748567ab6c45f4ad448afb20
# Parent  f17ac521d430b98e46ea624320687e411ed8a2ce
import: refactor date and user handling

Patch

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -870,8 +870,8 @@ 
     extractdata = patch.extract(ui, hunk)
     tmpname = extractdata.get('filename')
     message = extractdata.get('message')
-    user = extractdata.get('user')
-    date = extractdata.get('date')
+    user = opts.get('user') or extractdata.get('user')
+    date = opts.get('date') or extractdata.get('date')
     branch = extractdata.get('branch')
     nodeid = extractdata.get('nodeid')
     p1 = extractdata.get('p1')
@@ -969,8 +969,8 @@ 
                 try:
                     if partial:
                         repo.ui.setconfig('ui', 'allowemptycommit', True)
-                    n = repo.commit(message, opts.get('user') or user,
-                                    opts.get('date') or date, match=m,
+                    n = repo.commit(message, user,
+                                    date, match=m,
                                     editor=editor, extra=extra)
                     for idfunc in extrapostimport:
                         extrapostimportmap[idfunc](repo[n])
@@ -995,8 +995,8 @@ 
                     editor = getcommiteditor(editform='import.bypass')
                 memctx = context.makememctx(repo, (p1.node(), p2.node()),
                                             message,
-                                            opts.get('user') or user,
-                                            opts.get('date') or date,
+                                            user,
+                                            date,
                                             branch, files, store,
                                             editor=editor)
                 n = memctx.commit()