diff mercurial/cmdutil.py @ 27612:a0dfe8d286fe

import: refactor date and user handling
author timeless <timeless@mozdev.org>
date Wed, 30 Dec 2015 21:06:31 +0000
parents fa8c491f2deb
children dffd2ed9a7c4
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Wed Dec 30 21:05:42 2015 +0000
+++ b/mercurial/cmdutil.py	Wed Dec 30 21:06:31 2015 +0000
@@ -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()