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