Mercurial > hg
changeset 45712:0a330055340c
absorb: update commit hash references in the new commits
Differential Revision: https://phab.mercurial-scm.org/D9182
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Fri, 09 Oct 2020 00:14:07 -0400 |
parents | 3d68b47e461b |
children | 04de8a1ec08f |
files | hgext/absorb.py tests/test-absorb.t |
diffstat | 2 files changed, 23 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/absorb.py Thu Oct 08 23:33:04 2020 -0400 +++ b/hgext/absorb.py Fri Oct 09 00:14:07 2020 -0400 @@ -244,7 +244,7 @@ return content, mode, copy -def overlaycontext(memworkingcopy, ctx, parents=None, extra=None): +def overlaycontext(memworkingcopy, ctx, parents=None, extra=None, desc=None): """({path: content}, ctx, (p1node, p2node)?, {}?) -> memctx memworkingcopy overrides file contents. """ @@ -253,8 +253,9 @@ parents = ctx.repo().changelog.parents(ctx.node()) if extra is None: extra = ctx.extra() + if desc is None: + desc = ctx.description() date = ctx.date() - desc = ctx.description() user = ctx.user() files = set(ctx.files()).union(memworkingcopy) store = overlaystore(ctx, memworkingcopy) @@ -923,7 +924,18 @@ extra = ctx.extra() if self._useobsolete and self.ui.configbool(b'absorb', b'add-noise'): extra[b'absorb_source'] = ctx.hex() - mctx = overlaycontext(memworkingcopy, ctx, parents, extra=extra) + + desc = rewriteutil.update_hash_refs( + ctx.repo(), + ctx.description(), + { + oldnode: [newnode] + for oldnode, newnode in self.replacemap.items() + }, + ) + mctx = overlaycontext( + memworkingcopy, ctx, parents, extra=extra, desc=desc + ) return mctx.commit() @util.propertycache
--- a/tests/test-absorb.t Thu Oct 08 23:33:04 2020 -0400 +++ b/tests/test-absorb.t Fri Oct 09 00:14:07 2020 -0400 @@ -603,21 +603,21 @@ $ hg commit -m a -A a b $ hg branch foo -q $ echo b > b - $ hg commit -m foo # will become empty + $ hg commit -m 'foo (child of 0cde1ae39321)' # will become empty $ hg branch bar -q - $ hg commit -m bar # is already empty + $ hg commit -m 'bar (child of e969dc86aefc)' # is already empty $ echo a2 > a $ printf '' > b $ hg absorb --apply-changes --verbose | grep became 0:0cde1ae39321: 1 file(s) changed, became 3:fc7fcdd90fdb - 1:795dfb1adcef: 2 file(s) changed, became 4:a8740537aa53 - 2:b02935f68891: 2 file(s) changed, became 5:59533e01c707 - $ hg log -T '{rev} (branch: {branch}) {desc}\n' -G --stat - @ 5 (branch: bar) bar + 1:e969dc86aefc: 2 file(s) changed, became 4:8fc6b2cb43a5 + 2:0298954ced32: 2 file(s) changed, became 5:ca8386dc4e2c + $ hg log -T '{rev}:{node|short} (branch: {branch}) {desc}\n' -G --stat + @ 5:ca8386dc4e2c (branch: bar) bar (child of 8fc6b2cb43a5) | - o 4 (branch: foo) foo + o 4:8fc6b2cb43a5 (branch: foo) foo (child of fc7fcdd90fdb) | - o 3 (branch: default) a + o 3:fc7fcdd90fdb (branch: default) a a | 1 + b | 0 2 files changed, 1 insertions(+), 0 deletions(-)