Mercurial > hg
diff hgext/rebase.py @ 45123:1efbfa9b36a7
rebase: 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 08:38:42 +0200 |
parents | 0ecb3b11fcad |
children | dc5e5577af39 |
line wrap: on
line diff
--- a/hgext/rebase.py Sun Jul 12 06:06:06 2020 +0200 +++ b/hgext/rebase.py Mon Jun 01 08:38:42 2020 +0200 @@ -206,6 +206,9 @@ self.backupf = ui.configbool(b'rewrite', b'backup-bundle') self.keepf = opts.get(b'keep', False) self.keepbranchesf = opts.get(b'keepbranches', False) + self.skipemptysuccessorf = rewriteutil.skip_empty_successor( + repo.ui, b'rebase' + ) self.obsoletenotrebased = {} self.obsoletewithoutsuccessorindestination = set() self.inmemory = inmemory @@ -530,7 +533,10 @@ for c in self.extrafns: c(ctx, extra) destphase = max(ctx.phase(), phases.draft) - overrides = {(b'phases', b'new-commit'): destphase} + overrides = { + (b'phases', b'new-commit'): destphase, + (b'ui', b'allowemptycommit'): not self.skipemptysuccessorf, + } with repo.ui.configoverride(overrides, b'rebase'): if self.inmemory: newnode = commitmemorynode( @@ -650,6 +656,14 @@ if newnode is not None: self.state[rev] = repo[newnode].rev() ui.debug(b'rebased as %s\n' % short(newnode)) + if repo[newnode].isempty(): + ui.warn( + _( + b'note: created empty successor for %s, its ' + b'destination already has all its changes\n' + ) + % desc + ) else: if not self.collapsef: ui.warn(