Mercurial > hg
comparison hgext/absorb.py @ 44985:1ca0047fd7e1
absorb: preserve changesets which were already empty
Most commands in Mercurial (commit, rebase, absorb itself) don’t create empty
changesets or drop them if they become empty. If there’s a changeset that’s
empty, it must be a deliberate choice of the user. At least it shouldn’t be
absorb’s responsibility to prune them. The fact that changesets that became
empty during absorb are pruned, is unaffected by this.
This case was found while writing patches which make it possible to configure
absorb and rebase to not drop empty changesets. Even without having such config
set, I think it’s valuable to preserve changesets which were already empty.
author | Manuel Jacob <me@manueljacob.de> |
---|---|
date | Mon, 01 Jun 2020 20:57:14 +0200 |
parents | bfef35bb4ecb |
children | 65d19d9c8e76 |
comparison
equal
deleted
inserted
replaced
44984:bfef35bb4ecb | 44985:1ca0047fd7e1 |
---|---|
780 memworkingcopy = self._getnewfilecontents(ctx) | 780 memworkingcopy = self._getnewfilecontents(ctx) |
781 if not memworkingcopy and not lastcommitted: | 781 if not memworkingcopy and not lastcommitted: |
782 # nothing changed, nothing commited | 782 # nothing changed, nothing commited |
783 nextp1 = ctx | 783 nextp1 = ctx |
784 continue | 784 continue |
785 if self._willbecomenoop(memworkingcopy, ctx, nextp1): | 785 if ctx.files() and self._willbecomenoop( |
786 memworkingcopy, ctx, nextp1 | |
787 ): | |
786 # changeset is no longer necessary | 788 # changeset is no longer necessary |
787 self.replacemap[ctx.node()] = None | 789 self.replacemap[ctx.node()] = None |
788 msg = _(b'became empty and was dropped') | 790 msg = _(b'became empty and was dropped') |
789 else: | 791 else: |
790 # changeset needs re-commit | 792 # changeset needs re-commit |