hgext/rebase.py
changeset 33847 ddf77c0cc169
parent 33846 3b04a6ff625c
child 33848 bc9e075133c9
equal deleted inserted replaced
33846:3b04a6ff625c 33847:ddf77c0cc169
   146         # dict will be what contains most of the rebase progress state.
   146         # dict will be what contains most of the rebase progress state.
   147         self.state = {}
   147         self.state = {}
   148         self.activebookmark = None
   148         self.activebookmark = None
   149         self.dest = None
   149         self.dest = None
   150         self.skipped = set()
   150         self.skipped = set()
   151         self.destancestors = set()
       
   152 
   151 
   153         self.collapsef = opts.get('collapse', False)
   152         self.collapsef = opts.get('collapse', False)
   154         self.collapsemsg = cmdutil.logmessage(ui, opts)
   153         self.collapsemsg = cmdutil.logmessage(ui, opts)
   155         self.date = opts.get('date', None)
   154         self.date = opts.get('date', None)
   156 
   155 
   334                                   % root,
   333                                   % root,
   335                                   hint=_("see 'hg help phases' for details"))
   334                                   hint=_("see 'hg help phases' for details"))
   336 
   335 
   337         (self.originalwd, self.dest, self.state) = result
   336         (self.originalwd, self.dest, self.state) = result
   338         if self.collapsef:
   337         if self.collapsef:
   339             self.destancestors = self.repo.changelog.ancestors(
   338             destancestors = self.repo.changelog.ancestors([self.dest],
   340                                         [self.dest],
   339                                                           inclusive=True)
   341                                         inclusive=True)
   340             self.external = externalparent(self.repo, self.state, destancestors)
   342             self.external = externalparent(self.repo, self.state,
       
   343                                               self.destancestors)
       
   344 
   341 
   345         if dest.closesbranch() and not self.keepbranchesf:
   342         if dest.closesbranch() and not self.keepbranchesf:
   346             self.ui.status(_('reopening closed branch head %s\n') % dest)
   343             self.ui.status(_('reopening closed branch head %s\n') % dest)
   347 
   344 
   348     def _performrebase(self, tr):
   345     def _performrebase(self, tr):
   357                 for rev in self.state:
   354                 for rev in self.state:
   358                     branches.add(repo[rev].branch())
   355                     branches.add(repo[rev].branch())
   359                     if len(branches) > 1:
   356                     if len(branches) > 1:
   360                         raise error.Abort(_('cannot collapse multiple named '
   357                         raise error.Abort(_('cannot collapse multiple named '
   361                             'branches'))
   358                             'branches'))
   362 
       
   363         # Rebase
       
   364         if not self.destancestors:
       
   365             self.destancestors = repo.changelog.ancestors([self.dest],
       
   366                                                           inclusive=True)
       
   367 
   359 
   368         # Keep track of the active bookmarks in order to reset them later
   360         # Keep track of the active bookmarks in order to reset them later
   369         self.activebookmark = self.activebookmark or repo._activebookmark
   361         self.activebookmark = self.activebookmark or repo._activebookmark
   370         if self.activebookmark:
   362         if self.activebookmark:
   371             bookmarks.deactivate(repo)
   363             bookmarks.deactivate(repo)