hgext/rebase.py
changeset 45123 1efbfa9b36a7
parent 45091 0ecb3b11fcad
child 45150 dc5e5577af39
equal deleted inserted replaced
45122:a391d0710f22 45123:1efbfa9b36a7
   204             self.extrafns = [e]
   204             self.extrafns = [e]
   205 
   205 
   206         self.backupf = ui.configbool(b'rewrite', b'backup-bundle')
   206         self.backupf = ui.configbool(b'rewrite', b'backup-bundle')
   207         self.keepf = opts.get(b'keep', False)
   207         self.keepf = opts.get(b'keep', False)
   208         self.keepbranchesf = opts.get(b'keepbranches', False)
   208         self.keepbranchesf = opts.get(b'keepbranches', False)
       
   209         self.skipemptysuccessorf = rewriteutil.skip_empty_successor(
       
   210             repo.ui, b'rebase'
       
   211         )
   209         self.obsoletenotrebased = {}
   212         self.obsoletenotrebased = {}
   210         self.obsoletewithoutsuccessorindestination = set()
   213         self.obsoletewithoutsuccessorindestination = set()
   211         self.inmemory = inmemory
   214         self.inmemory = inmemory
   212         self.stateobj = statemod.cmdstate(repo, b'rebasestate')
   215         self.stateobj = statemod.cmdstate(repo, b'rebasestate')
   213 
   216 
   528             date = ctx.date()
   531             date = ctx.date()
   529         extra = {b'rebase_source': ctx.hex()}
   532         extra = {b'rebase_source': ctx.hex()}
   530         for c in self.extrafns:
   533         for c in self.extrafns:
   531             c(ctx, extra)
   534             c(ctx, extra)
   532         destphase = max(ctx.phase(), phases.draft)
   535         destphase = max(ctx.phase(), phases.draft)
   533         overrides = {(b'phases', b'new-commit'): destphase}
   536         overrides = {
       
   537             (b'phases', b'new-commit'): destphase,
       
   538             (b'ui', b'allowemptycommit'): not self.skipemptysuccessorf,
       
   539         }
   534         with repo.ui.configoverride(overrides, b'rebase'):
   540         with repo.ui.configoverride(overrides, b'rebase'):
   535             if self.inmemory:
   541             if self.inmemory:
   536                 newnode = commitmemorynode(
   542                 newnode = commitmemorynode(
   537                     repo,
   543                     repo,
   538                     wctx=self.wctx,
   544                     wctx=self.wctx,
   648                 newnode = None
   654                 newnode = None
   649             # Update the state
   655             # Update the state
   650             if newnode is not None:
   656             if newnode is not None:
   651                 self.state[rev] = repo[newnode].rev()
   657                 self.state[rev] = repo[newnode].rev()
   652                 ui.debug(b'rebased as %s\n' % short(newnode))
   658                 ui.debug(b'rebased as %s\n' % short(newnode))
       
   659                 if repo[newnode].isempty():
       
   660                     ui.warn(
       
   661                         _(
       
   662                             b'note: created empty successor for %s, its '
       
   663                             b'destination already has all its changes\n'
       
   664                         )
       
   665                         % desc
       
   666                     )
   653             else:
   667             else:
   654                 if not self.collapsef:
   668                 if not self.collapsef:
   655                     ui.warn(
   669                     ui.warn(
   656                         _(
   670                         _(
   657                             b'note: not rebasing %s, its destination already '
   671                             b'note: not rebasing %s, its destination already '