hgext/rebase.py
changeset 10628 6227c8d669d5
parent 10436 6cebf27287de
child 10636 23ab3b05bd66
equal deleted inserted replaced
10627:adcd5bcb37ab 10628:6227c8d669d5
    12 
    12 
    13 For more information:
    13 For more information:
    14 http://mercurial.selenic.com/wiki/RebaseExtension
    14 http://mercurial.selenic.com/wiki/RebaseExtension
    15 '''
    15 '''
    16 
    16 
    17 from mercurial import util, repair, merge, cmdutil, commands, error
    17 from mercurial import hg, util, repair, merge, cmdutil, commands, error
    18 from mercurial import extensions, ancestor, copies, patch
    18 from mercurial import extensions, ancestor, copies, patch
    19 from mercurial.commands import templateopts
    19 from mercurial.commands import templateopts
    20 from mercurial.node import nullrev
    20 from mercurial.node import nullrev
    21 from mercurial.lock import release
    21 from mercurial.lock import release
    22 from mercurial.i18n import _
    22 from mercurial.i18n import _
   465             ui.debug('--update and --rebase are not compatible, ignoring '
   465             ui.debug('--update and --rebase are not compatible, ignoring '
   466                      'the update flag\n')
   466                      'the update flag\n')
   467 
   467 
   468         cmdutil.bail_if_changed(repo)
   468         cmdutil.bail_if_changed(repo)
   469         revsprepull = len(repo)
   469         revsprepull = len(repo)
   470         orig(ui, repo, *args, **opts)
   470         origpostincoming = commands.postincoming
       
   471         def _dummy(*args, **kwargs):
       
   472             pass
       
   473         commands.postincoming = _dummy
       
   474         try:
       
   475             orig(ui, repo, *args, **opts)
       
   476         finally:
       
   477             commands.postincoming = origpostincoming
   471         revspostpull = len(repo)
   478         revspostpull = len(repo)
   472         if revspostpull > revsprepull:
   479         if revspostpull > revsprepull:
   473             rebase(ui, repo, **opts)
   480             rebase(ui, repo, **opts)
   474             branch = repo[None].branch()
   481             branch = repo[None].branch()
   475             dest = repo[branch].rev()
   482             dest = repo[branch].rev()
   476             if dest != repo['.'].rev():
   483             if dest != repo['.'].rev():
   477                 # there was nothing to rebase we force an update
   484                 # there was nothing to rebase we force an update
   478                 merge.update(repo, dest, False, False, False)
   485                 hg.update(repo, dest)
   479     else:
   486     else:
   480         orig(ui, repo, *args, **opts)
   487         orig(ui, repo, *args, **opts)
   481 
   488 
   482 def uisetup(ui):
   489 def uisetup(ui):
   483     'Replace pull with a decorator to provide --rebase option'
   490     'Replace pull with a decorator to provide --rebase option'