hgext/rebase.py
changeset 46836 80cac9936324
parent 46835 c2438f2f635c
child 46837 27ba8acd5684
child 50463 2cdb05da997d
equal deleted inserted replaced
46835:c2438f2f635c 46836:80cac9936324
   411 
   411 
   412     def _preparenewrebase(self, destmap):
   412     def _preparenewrebase(self, destmap):
   413         if not destmap:
   413         if not destmap:
   414             return _nothingtorebase()
   414             return _nothingtorebase()
   415 
   415 
       
   416         result = buildstate(self.repo, destmap, self.collapsef)
       
   417 
       
   418         if not result:
       
   419             # Empty state built, nothing to rebase
       
   420             self.ui.status(_(b'nothing to rebase\n'))
       
   421             return _nothingtorebase()
       
   422 
       
   423         (self.originalwd, self.destmap, self.state) = result
       
   424         if self.collapsef:
       
   425             dests = set(self.destmap.values())
       
   426             if len(dests) != 1:
       
   427                 raise error.InputError(
       
   428                     _(b'--collapse does not work with multiple destinations')
       
   429                 )
       
   430             destrev = next(iter(dests))
       
   431             destancestors = self.repo.changelog.ancestors(
       
   432                 [destrev], inclusive=True
       
   433             )
       
   434             self.external = externalparent(self.repo, self.state, destancestors)
       
   435 
       
   436         for destrev in sorted(set(destmap.values())):
       
   437             dest = self.repo[destrev]
       
   438             if dest.closesbranch() and not self.keepbranchesf:
       
   439                 self.ui.status(_(b'reopening closed branch head %s\n') % dest)
       
   440 
       
   441         # Calculate self.obsolete_* sets
       
   442         self._handleskippingobsolete()
       
   443 
   416         rebaseset = destmap.keys()
   444         rebaseset = destmap.keys()
   417         if not self.keepf:
   445         if not self.keepf:
   418             try:
   446             try:
   419                 rewriteutil.precheck(self.repo, rebaseset, action=b'rebase')
   447                 rewriteutil.precheck(self.repo, rebaseset, action=b'rebase')
   420             except error.Abort as e:
   448             except error.Abort as e:
   421                 if e.hint is None:
   449                 if e.hint is None:
   422                     e.hint = _(b'use --keep to keep original changesets')
   450                     e.hint = _(b'use --keep to keep original changesets')
   423                 raise e
   451                 raise e
   424 
       
   425         result = buildstate(self.repo, destmap, self.collapsef)
       
   426 
       
   427         if not result:
       
   428             # Empty state built, nothing to rebase
       
   429             self.ui.status(_(b'nothing to rebase\n'))
       
   430             return _nothingtorebase()
       
   431 
       
   432         (self.originalwd, self.destmap, self.state) = result
       
   433         if self.collapsef:
       
   434             dests = set(self.destmap.values())
       
   435             if len(dests) != 1:
       
   436                 raise error.InputError(
       
   437                     _(b'--collapse does not work with multiple destinations')
       
   438                 )
       
   439             destrev = next(iter(dests))
       
   440             destancestors = self.repo.changelog.ancestors(
       
   441                 [destrev], inclusive=True
       
   442             )
       
   443             self.external = externalparent(self.repo, self.state, destancestors)
       
   444 
       
   445         for destrev in sorted(set(destmap.values())):
       
   446             dest = self.repo[destrev]
       
   447             if dest.closesbranch() and not self.keepbranchesf:
       
   448                 self.ui.status(_(b'reopening closed branch head %s\n') % dest)
       
   449 
       
   450         # Calculate self.obsolete_* sets
       
   451         self._handleskippingobsolete()
       
   452 
   452 
   453         self.prepared = True
   453         self.prepared = True
   454 
   454 
   455     def _assignworkingcopy(self):
   455     def _assignworkingcopy(self):
   456         if self.inmemory:
   456         if self.inmemory: