changeset 37044:0b1230a5a958

rebase: look up default date outside of conclude[memory]node() Differential Revision: https://phab.mercurial-scm.org/D2922
author Martin von Zweigbergk <martinvonz@google.com>
date Tue, 20 Mar 2018 21:59:04 -0700
parents b8d305bd12ca
children 8ff5772711fa
files hgext/rebase.py
diffstat 1 files changed, 5 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/rebase.py	Tue Mar 20 21:58:32 2018 -0700
+++ b/hgext/rebase.py	Tue Mar 20 21:59:04 2018 -0700
@@ -446,6 +446,9 @@
         ctx = repo[rev]
         if commitmsg is None:
             commitmsg = ctx.description()
+        date = self.date
+        if date is None:
+            date = ctx.date()
         extra = {'rebase_source': ctx.hex()}
         for c in self.extrafns:
             c(ctx, extra)
@@ -461,14 +464,14 @@
                     extra=extra,
                     commitmsg=commitmsg,
                     editor=editor,
-                    date=self.date)
+                    date=date)
                 mergemod.mergestate.clean(repo)
             else:
                 newnode = concludenode(repo, ctx, p1, p2,
                     extra=extra,
                     commitmsg=commitmsg,
                     editor=editor,
-                    date=self.date)
+                    date=date)
 
             if newnode is None:
                 # If it ended up being a no-op commit, then the normal
@@ -1035,9 +1038,6 @@
     if wctx.isempty() and not repo.ui.configbool('ui', 'allowemptycommit'):
         return None
 
-    if date is None:
-        date = ctx.date()
-
     # By convention, ``extra['branch']`` (set by extrafn) clobbers
     # ``branch`` (used when passing ``--keepbranches``).
     branch = repo[p1].branch()
@@ -1060,8 +1060,6 @@
         repo.setparents(repo[p1].node(), repo[p2].node())
 
         # Commit might fail if unresolved files exist
-        if date is None:
-            date = ctx.date()
         newnode = repo.commit(text=commitmsg, user=ctx.user(),
                               date=date, extra=extra, editor=editor)