##// END OF EJS Templates
rebase: move config override out of conclude[memory]node()...
Martin von Zweigbergk -
r37058:b8d305bd default
parent child Browse files
Show More
@@ -454,29 +454,28 b' class rebaseruntime(object):'
454 454 overrides = {('phases', 'new-commit'): destphase}
455 455 if keepbranch:
456 456 overrides[('ui', 'allowemptycommit')] = True
457 if self.inmemory:
458 newnode = concludememorynode(repo, ctx, p1, p2,
459 wctx=self.wctx,
460 extra=extra,
461 commitmsg=commitmsg,
462 editor=editor,
463 overrides=overrides,
464 date=self.date)
465 mergemod.mergestate.clean(repo)
466 else:
467 newnode = concludenode(repo, ctx, p1, p2,
468 extra=extra,
469 commitmsg=commitmsg,
470 editor=editor,
471 overrides=overrides,
472 date=self.date)
457 with repo.ui.configoverride(overrides, 'rebase'):
458 if self.inmemory:
459 newnode = concludememorynode(repo, ctx, p1, p2,
460 wctx=self.wctx,
461 extra=extra,
462 commitmsg=commitmsg,
463 editor=editor,
464 date=self.date)
465 mergemod.mergestate.clean(repo)
466 else:
467 newnode = concludenode(repo, ctx, p1, p2,
468 extra=extra,
469 commitmsg=commitmsg,
470 editor=editor,
471 date=self.date)
473 472
474 if newnode is None:
475 # If it ended up being a no-op commit, then the normal
476 # merge state clean-up path doesn't happen, so do it
477 # here. Fix issue5494
478 mergemod.mergestate.clean(repo)
479 return newnode
473 if newnode is None:
474 # If it ended up being a no-op commit, then the normal
475 # merge state clean-up path doesn't happen, so do it
476 # here. Fix issue5494
477 mergemod.mergestate.clean(repo)
478 return newnode
480 479
481 480 def _rebasenode(self, tr, rev, allowdivergence, progressfn):
482 481 repo, ui, opts = self.repo, self.ui, self.opts
@@ -1028,33 +1027,30 b' def externalparent(repo, state, destance'
1028 1027 (max(destancestors),
1029 1028 ', '.join("%d" % p for p in sorted(parents))))
1030 1029
1031 def concludememorynode(repo, ctx, p1, p2, wctx, editor, extra, overrides, date,
1032 commitmsg):
1030 def concludememorynode(repo, ctx, p1, p2, wctx, editor, extra, date, commitmsg):
1033 1031 '''Commit the memory changes with parents p1 and p2. Reuse commit info from
1034 1032 ctx.
1035 1033 Return node of committed revision.'''
1036 with repo.ui.configoverride(overrides, 'rebase'):
1037 # Replicates the empty check in ``repo.commit``.
1038 if wctx.isempty() and not repo.ui.configbool('ui', 'allowemptycommit'):
1039 return None
1034 # Replicates the empty check in ``repo.commit``.
1035 if wctx.isempty() and not repo.ui.configbool('ui', 'allowemptycommit'):
1036 return None
1040 1037
1041 if date is None:
1042 date = ctx.date()
1038 if date is None:
1039 date = ctx.date()
1043 1040
1044 # By convention, ``extra['branch']`` (set by extrafn) clobbers
1045 # ``branch`` (used when passing ``--keepbranches``).
1046 branch = repo[p1].branch()
1047 if 'branch' in extra:
1048 branch = extra['branch']
1041 # By convention, ``extra['branch']`` (set by extrafn) clobbers
1042 # ``branch`` (used when passing ``--keepbranches``).
1043 branch = repo[p1].branch()
1044 if 'branch' in extra:
1045 branch = extra['branch']
1049 1046
1050 memctx = wctx.tomemctx(commitmsg, parents=(p1, p2), date=date,
1051 extra=extra, user=ctx.user(), branch=branch, editor=editor)
1052 commitres = repo.commitctx(memctx)
1053 wctx.clean() # Might be reused
1054 return commitres
1047 memctx = wctx.tomemctx(commitmsg, parents=(p1, p2), date=date,
1048 extra=extra, user=ctx.user(), branch=branch, editor=editor)
1049 commitres = repo.commitctx(memctx)
1050 wctx.clean() # Might be reused
1051 return commitres
1055 1052
1056 def concludenode(repo, ctx, p1, p2, editor, extra, overrides, date,
1057 commitmsg):
1053 def concludenode(repo, ctx, p1, p2, editor, extra, date, commitmsg):
1058 1054 '''Commit the wd changes with parents p1 and p2. Reuse commit info from ctx.
1059 1055 Return node of committed revision.'''
1060 1056 dsguard = util.nullcontextmanager()
@@ -1063,12 +1059,11 b' def concludenode(repo, ctx, p1, p2, edit'
1063 1059 with dsguard:
1064 1060 repo.setparents(repo[p1].node(), repo[p2].node())
1065 1061
1066 with repo.ui.configoverride(overrides, 'rebase'):
1067 # Commit might fail if unresolved files exist
1068 if date is None:
1069 date = ctx.date()
1070 newnode = repo.commit(text=commitmsg, user=ctx.user(),
1071 date=date, extra=extra, editor=editor)
1062 # Commit might fail if unresolved files exist
1063 if date is None:
1064 date = ctx.date()
1065 newnode = repo.commit(text=commitmsg, user=ctx.user(),
1066 date=date, extra=extra, editor=editor)
1072 1067
1073 1068 repo.dirstate.setbranch(repo[newnode].branch())
1074 1069 return newnode
General Comments 0
You need to be logged in to leave comments. Login now