hgext/rebase.py
changeset 50643 cbcbf63b6dbf
parent 50429 771294224bf6
child 51554 a151fd01e98c
equal deleted inserted replaced
50641:5460424092e2 50643:cbcbf63b6dbf
    22     nullrev,
    22     nullrev,
    23     short,
    23     short,
    24     wdirrev,
    24     wdirrev,
    25 )
    25 )
    26 from mercurial.pycompat import open
    26 from mercurial.pycompat import open
    27 from mercurial.thirdparty.jaraco.collections import Projection
       
    28 from mercurial import (
    27 from mercurial import (
    29     bookmarks,
    28     bookmarks,
    30     cmdutil,
    29     cmdutil,
    31     commands,
    30     commands,
    32     copies,
    31     copies,
    84 
    83 
    85 def _nothingtorebase():
    84 def _nothingtorebase():
    86     return 1
    85     return 1
    87 
    86 
    88 
    87 
    89 def retained_extras():
       
    90     """
       
    91     Yield the names of the extras to be retained.
       
    92     """
       
    93     # graft
       
    94     yield b'source'
       
    95     yield b'intermediate-source'
       
    96 
       
    97 
       
    98 def _save_extras(ctx, extra):
       
    99     extra.update(Projection(retained_extras(), ctx.extra()))
       
   100 
       
   101 
       
   102 def _savebranch(ctx, extra):
    88 def _savebranch(ctx, extra):
   103     extra[b'branch'] = ctx.branch()
    89     extra[b'branch'] = ctx.branch()
   104 
    90 
   105 
    91 
   106 def _destrebase(repo, sourceset, destspace=None):
    92 def _destrebase(repo, sourceset, destspace=None):
   197         self.collapsef = opts.get('collapse', False)
   183         self.collapsef = opts.get('collapse', False)
   198         self.collapsemsg = cmdutil.logmessage(ui, pycompat.byteskwargs(opts))
   184         self.collapsemsg = cmdutil.logmessage(ui, pycompat.byteskwargs(opts))
   199         self.date = opts.get('date', None)
   185         self.date = opts.get('date', None)
   200 
   186 
   201         e = opts.get('extrafn')  # internal, used by e.g. hgsubversion
   187         e = opts.get('extrafn')  # internal, used by e.g. hgsubversion
   202         self.extrafns = [_save_extras]
   188         self.extrafns = [rewriteutil.preserve_extras_on_rebase]
   203         if e:
   189         if e:
   204             self.extrafns = [e]
   190             self.extrafns = [e]
   205 
   191 
   206         self.backupf = ui.configbool(b'rewrite', b'backup-bundle')
   192         self.backupf = ui.configbool(b'rewrite', b'backup-bundle')
   207         self.keepf = opts.get('keep', False)
   193         self.keepf = opts.get('keep', False)