Mercurial > public > mercurial-scm > hg
diff hgext/absorb.py @ 45124:3ee8e2d5c0d8
absorb: consider rewrite.empty-successor configuration
This adds support for the recently added rewrite.empty-successor configuration.
author | Manuel Jacob <me@manueljacob.de> |
---|---|
date | Mon, 01 Jun 2020 09:42:41 +0200 |
parents | 65d19d9c8e76 |
children | f55099982bc5 |
line wrap: on
line diff
--- a/hgext/absorb.py Mon Jun 01 08:38:42 2020 +0200 +++ b/hgext/absorb.py Mon Jun 01 09:42:41 2020 +0200 @@ -50,6 +50,7 @@ phases, pycompat, registrar, + rewriteutil, scmutil, util, ) @@ -782,8 +783,10 @@ # nothing changed, nothing commited nextp1 = ctx continue - if ctx.files() and self._willbecomenoop( - memworkingcopy, ctx, nextp1 + if ( + self.skip_empty_successor + and ctx.files() + and self._willbecomenoop(memworkingcopy, ctx, nextp1) ): # changeset is no longer necessary self.replacemap[ctx.node()] = None @@ -935,6 +938,10 @@ self.repo, replacements, operation=b'absorb', fixphase=True ) + @util.propertycache + def skip_empty_successor(self): + return rewriteutil.skip_empty_successor(self.ui, b'absorb') + def _parsechunk(hunk): """(crecord.uihunk or patch.recordhunk) -> (path, (a1, a2, [bline]))"""