hgext/rebase.py
branchstable
changeset 21160 564f55b25122
parent 21027 25ee5dbebc6b
child 21197 cb4223c65f79
--- a/hgext/rebase.py	Tue Apr 15 03:21:59 2014 +0900
+++ b/hgext/rebase.py	Thu Apr 17 19:36:17 2014 -0400
@@ -289,6 +289,9 @@
                                                            inclusive=True)
                 external = externalparent(repo, state, targetancestors)
 
+            if dest.closesbranch() and not keepbranchesf:
+                ui.status(_('reopening closed branch head %s\n') % dest)
+
         if keepbranchesf:
             # insert _savebranch at the start of extrafns so if
             # there's a user-provided extrafn it can clobber branch if
@@ -330,14 +333,15 @@
                     repo.ui.debug('resuming interrupted rebase\n')
                 else:
                     try:
-                        ui.setconfig('ui', 'forcemerge', opts.get('tool', ''))
+                        ui.setconfig('ui', 'forcemerge', opts.get('tool', ''),
+                                     'rebase')
                         stats = rebasenode(repo, rev, p1, state, collapsef)
                         if stats and stats[3] > 0:
                             raise error.InterventionRequired(
                                 _('unresolved conflicts (see hg '
                                   'resolve, then hg rebase --continue)'))
                     finally:
-                        ui.setconfig('ui', 'forcemerge', '')
+                        ui.setconfig('ui', 'forcemerge', '', 'rebase')
                 cmdutil.duplicatecopies(repo, rev, target)
                 if not collapsef:
                     newrev = concludenode(repo, rev, p1, p2, extrafn=extrafn,
@@ -516,6 +520,12 @@
             if state.get(p.rev()) == repo[p1].rev():
                 base = p.node()
                 break
+        else: # fallback when base not found
+            base = None
+
+            # Raise because this function is called wrong (see issue 4106)
+            raise AssertionError('no base found to rebase on '
+                                 '(rebasenode called wrong)')
     if base is not None:
         repo.ui.debug("   detach base %d:%s\n" % (repo[base].rev(), repo[base]))
     # When collapsing in-place, the parent is the common ancestor, we
@@ -703,7 +713,8 @@
                 if new != nullrev and new in seen:
                     skipped.add(old)
                 seen.add(new)
-        repo.ui.debug('computed skipped revs: %s\n' % skipped)
+        repo.ui.debug('computed skipped revs: %s\n' %
+                      (' '.join(str(r) for r in sorted(skipped)) or None))
         repo.ui.debug('rebase status resumed\n')
         return (originalwd, target, state, skipped,
                 collapse, keep, keepbranches, external, activebookmark)
@@ -790,7 +801,7 @@
                 repo.ui.debug('source is a child of destination\n')
                 return None
 
-        repo.ui.debug('rebase onto %d starting from %s\n' % (dest, roots))
+        repo.ui.debug('rebase onto %d starting from %s\n' % (dest, root))
         state.update(dict.fromkeys(rebaseset, nullrev))
         # Rebase tries to turn <dest> into a parent of <root> while
         # preserving the number of parents of rebased changesets: