hgext/rebase.py
changeset 38499 999e5c218daf
parent 38498 c892a30bafb9
child 38500 02004e5c6b56
equal deleted inserted replaced
38498:c892a30bafb9 38499:999e5c218daf
   323         skippedset = set(self.obsoletenotrebased)
   323         skippedset = set(self.obsoletenotrebased)
   324         skippedset.update(self.obsoletewithoutsuccessorindestination)
   324         skippedset.update(self.obsoletewithoutsuccessorindestination)
   325         skippedset.update(obsoleteextinctsuccessors)
   325         skippedset.update(obsoleteextinctsuccessors)
   326         _checkobsrebase(self.repo, self.ui, obsoleteset, skippedset)
   326         _checkobsrebase(self.repo, self.ui, obsoleteset, skippedset)
   327 
   327 
   328     def _prepareabortorcontinue(self, isabort, backup=True):
   328     def _prepareabortorcontinue(self, isabort, backup=True, suppwarns=False):
   329         try:
   329         try:
   330             self.restorestatus()
   330             self.restorestatus()
   331             self.collapsemsg = restorecollapsemsg(self.repo, isabort)
   331             self.collapsemsg = restorecollapsemsg(self.repo, isabort)
   332         except error.RepoLookupError:
   332         except error.RepoLookupError:
   333             if isabort:
   333             if isabort:
   340                 msg = _('cannot continue inconsistent rebase')
   340                 msg = _('cannot continue inconsistent rebase')
   341                 hint = _('use "hg rebase --abort" to clear broken state')
   341                 hint = _('use "hg rebase --abort" to clear broken state')
   342                 raise error.Abort(msg, hint=hint)
   342                 raise error.Abort(msg, hint=hint)
   343         if isabort:
   343         if isabort:
   344             return abort(self.repo, self.originalwd, self.destmap, self.state,
   344             return abort(self.repo, self.originalwd, self.destmap, self.state,
   345                          activebookmark=self.activebookmark, backup=backup)
   345                          activebookmark=self.activebookmark, backup=backup,
       
   346                          suppwarns=suppwarns)
   346 
   347 
   347     def _preparenewrebase(self, destmap):
   348     def _preparenewrebase(self, destmap):
   348         if not destmap:
   349         if not destmap:
   349             return _nothingtorebase()
   350             return _nothingtorebase()
   350 
   351 
   849         else:
   850         else:
   850             ui.status(_('there will be no conflict, you can rebase\n'))
   851             ui.status(_('there will be no conflict, you can rebase\n'))
   851             return 0
   852             return 0
   852         finally:
   853         finally:
   853             # no need to store backup in case of dryrun
   854             # no need to store backup in case of dryrun
   854             rbsrt._prepareabortorcontinue(isabort=True, backup=False)
   855             rbsrt._prepareabortorcontinue(isabort=True, backup=False,
       
   856                                           suppwarns=True)
   855 
   857 
   856 def _dorebase(ui, repo, inmemory=False, **opts):
   858 def _dorebase(ui, repo, inmemory=False, **opts):
   857     rbsrt = rebaseruntime(repo, ui, inmemory, pycompat.byteskwargs(opts))
   859     rbsrt = rebaseruntime(repo, ui, inmemory, pycompat.byteskwargs(opts))
   858     return _origrebase(ui, repo, rbsrt, inmemory=inmemory, **opts)
   860     return _origrebase(ui, repo, rbsrt, inmemory=inmemory, **opts)
   859 
   861 
  1552     if firstunrebased in parents:
  1554     if firstunrebased in parents:
  1553         return True
  1555         return True
  1554 
  1556 
  1555     return False
  1557     return False
  1556 
  1558 
  1557 def abort(repo, originalwd, destmap, state, activebookmark=None, backup=True):
  1559 def abort(repo, originalwd, destmap, state, activebookmark=None, backup=True,
       
  1560           suppwarns=False):
  1558     '''Restore the repository to its original state.  Additional args:
  1561     '''Restore the repository to its original state.  Additional args:
  1559 
  1562 
  1560     activebookmark: the name of the bookmark that should be active after the
  1563     activebookmark: the name of the bookmark that should be active after the
  1561         restore'''
  1564         restore'''
  1562 
  1565 
  1605             bookmarks.activate(repo, activebookmark)
  1608             bookmarks.activate(repo, activebookmark)
  1606 
  1609 
  1607     finally:
  1610     finally:
  1608         clearstatus(repo)
  1611         clearstatus(repo)
  1609         clearcollapsemsg(repo)
  1612         clearcollapsemsg(repo)
  1610         repo.ui.warn(_('rebase aborted\n'))
  1613         if not suppwarns:
       
  1614             repo.ui.warn(_('rebase aborted\n'))
  1611     return 0
  1615     return 0
  1612 
  1616 
  1613 def sortsource(destmap):
  1617 def sortsource(destmap):
  1614     """yield source revisions in an order that we only rebase things once
  1618     """yield source revisions in an order that we only rebase things once
  1615 
  1619