Mercurial > hg
comparison hgext/rebase.py @ 37035:b7f5d03e1e54
rebase: look up commit message to reuse outside of conclude[memory]node()
This was done the same way in both functions, so let's let the single
caller do it.
Differential Revision: https://phab.mercurial-scm.org/D2916
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Wed, 21 Mar 2018 11:05:32 -0700 |
parents | fbc82a08bdcb |
children | 0ab0d94ead72 |
comparison
equal
deleted
inserted
replaced
37034:fbc82a08bdcb | 37035:b7f5d03e1e54 |
---|---|
453 | 453 |
454 Reuse commit info from rev but also store useful information in extra. | 454 Reuse commit info from rev but also store useful information in extra. |
455 Return node of committed revision.''' | 455 Return node of committed revision.''' |
456 repo = self.repo | 456 repo = self.repo |
457 ctx = repo[rev] | 457 ctx = repo[rev] |
458 if commitmsg is None: | |
459 commitmsg = ctx.description() | |
458 if self.inmemory: | 460 if self.inmemory: |
459 newnode = concludememorynode(repo, ctx, p1, p2, | 461 newnode = concludememorynode(repo, ctx, p1, p2, |
460 wctx=self.wctx, | 462 wctx=self.wctx, |
461 extrafn=_makeextrafn(self.extrafns), | 463 extrafn=_makeextrafn(self.extrafns), |
462 commitmsg=commitmsg, | 464 commitmsg=commitmsg, |
1028 'than one external parent: %s') % | 1030 'than one external parent: %s') % |
1029 (max(destancestors), | 1031 (max(destancestors), |
1030 ', '.join("%d" % p for p in sorted(parents)))) | 1032 ', '.join("%d" % p for p in sorted(parents)))) |
1031 | 1033 |
1032 def concludememorynode(repo, ctx, p1, p2, wctx, editor, extrafn, keepbranches, | 1034 def concludememorynode(repo, ctx, p1, p2, wctx, editor, extrafn, keepbranches, |
1033 date, commitmsg=None): | 1035 date, commitmsg): |
1034 '''Commit the memory changes with parents p1 and p2. Reuse commit info from | 1036 '''Commit the memory changes with parents p1 and p2. Reuse commit info from |
1035 ctx but also store useful information in extra. | 1037 ctx but also store useful information in extra. |
1036 Return node of committed revision.''' | 1038 Return node of committed revision.''' |
1037 if commitmsg is None: | |
1038 commitmsg = ctx.description() | |
1039 keepbranch = keepbranches and repo[p1].branch() != ctx.branch() | 1039 keepbranch = keepbranches and repo[p1].branch() != ctx.branch() |
1040 extra = {'rebase_source': ctx.hex()} | 1040 extra = {'rebase_source': ctx.hex()} |
1041 if extrafn: | 1041 if extrafn: |
1042 extrafn(ctx, extra) | 1042 extrafn(ctx, extra) |
1043 | 1043 |
1064 commitres = repo.commitctx(memctx) | 1064 commitres = repo.commitctx(memctx) |
1065 wctx.clean() # Might be reused | 1065 wctx.clean() # Might be reused |
1066 return commitres | 1066 return commitres |
1067 | 1067 |
1068 def concludenode(repo, ctx, p1, p2, editor, extrafn, keepbranches, date, | 1068 def concludenode(repo, ctx, p1, p2, editor, extrafn, keepbranches, date, |
1069 commitmsg=None): | 1069 commitmsg): |
1070 '''Commit the wd changes with parents p1 and p2. Reuse commit info from ctx | 1070 '''Commit the wd changes with parents p1 and p2. Reuse commit info from ctx |
1071 but also store useful information in extra. | 1071 but also store useful information in extra. |
1072 Return node of committed revision.''' | 1072 Return node of committed revision.''' |
1073 dsguard = util.nullcontextmanager() | 1073 dsguard = util.nullcontextmanager() |
1074 if not repo.ui.configbool('rebase', 'singletransaction'): | 1074 if not repo.ui.configbool('rebase', 'singletransaction'): |
1075 dsguard = dirstateguard.dirstateguard(repo, 'rebase') | 1075 dsguard = dirstateguard.dirstateguard(repo, 'rebase') |
1076 with dsguard: | 1076 with dsguard: |
1077 repo.setparents(repo[p1].node(), repo[p2].node()) | 1077 repo.setparents(repo[p1].node(), repo[p2].node()) |
1078 if commitmsg is None: | |
1079 commitmsg = ctx.description() | |
1080 keepbranch = keepbranches and repo[p1].branch() != ctx.branch() | 1078 keepbranch = keepbranches and repo[p1].branch() != ctx.branch() |
1081 extra = {'rebase_source': ctx.hex()} | 1079 extra = {'rebase_source': ctx.hex()} |
1082 if extrafn: | 1080 if extrafn: |
1083 extrafn(ctx, extra) | 1081 extrafn(ctx, extra) |
1084 | 1082 |