Patchwork [3,of,6] rebase: move obsoleted not rebased messages earlier (BC)

login
register
mail settings
Submitter Jun Wu
Date July 9, 2017, 7:14 p.m.
Message ID <8ba4291b60f1b98903bd.1499627690@x1c>
Download mbox | patch
Permalink /patch/22179/
State Superseded
Headers show

Comments

Jun Wu - July 9, 2017, 7:14 p.m.
# HG changeset patch
# User Jun Wu <quark@fb.com>
# Date 1499570073 25200
#      Sat Jul 08 20:14:33 2017 -0700
# Node ID 8ba4291b60f1b98903bdac9f18057ae8b7f64d58
# Parent  85aa943fb16e8fe9f8fed13871a28bdd20ff31b0
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r 8ba4291b60f1
rebase: move obsoleted not rebased messages earlier (BC)

A later patch will clean up those states. This patch moves the messages
earlier.

Marked as BC since the order of message has changed.

Patch

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -447,12 +447,7 @@  class rebaseruntime(object):
                 ui.status(_('not rebasing ignored %s\n') % desc)
             elif self.state[rev] == revprecursor:
-                destctx = repo[self.obsoletenotrebased[rev]]
-                descdest = '%d:%s "%s"' % (destctx.rev(), destctx,
-                           destctx.description().split('\n', 1)[0])
-                msg = _('note: not rebasing %s, already in destination as %s\n')
-                ui.status(msg % (desc, descdest))
+                pass
             elif self.state[rev] == revpruned:
-                msg = _('note: not rebasing %s, it has no successor\n')
-                ui.status(msg % desc)
+                pass
             else:
                 ui.status(_('already rebased %s as %s\n') %
@@ -1326,9 +1321,19 @@  def buildstate(repo, dest, rebaseset, co
         for ignored in set(rebasedomain) - set(rebaseset):
             state[ignored] = revignored
+    unfi = repo.unfiltered()
     for r in obsoletenotrebased:
-        if obsoletenotrebased[r] is None:
+        desc = _ctxdesc(unfi[r])
+        succ = obsoletenotrebased[r]
+        if succ is None:
+            msg = _('note: not rebasing %s, it has no successor\n') % desc
             state[r] = revpruned
         else:
+            destctx = unfi[succ]
+            destdesc = '%d:%s "%s"' % (destctx.rev(), destctx,
+                                       destctx.description().split('\n', 1)[0])
+            msg = (_('note: not rebasing %s, already in destination as %s\n')
+                   % (desc, destdesc))
             state[r] = revprecursor
+        repo.ui.status(msg)
     return originalwd, dest.rev(), state
 
diff --git a/tests/test-rebase-obsolete.t b/tests/test-rebase-obsolete.t
--- a/tests/test-rebase-obsolete.t
+++ b/tests/test-rebase-obsolete.t
@@ -205,6 +205,6 @@  More complex case where part of the reba
   
   $ hg rebase --source 'desc(B)' --dest 'tip' --config experimental.rebaseskipobsolete=True
+  note: not rebasing 9:08483444fef9 "D", already in destination as 11:4596109a6a43 "D"
   rebasing 8:8877864f1edb "B"
-  note: not rebasing 9:08483444fef9 "D", already in destination as 11:4596109a6a43 "D"
   rebasing 10:5ae4c968c6ac "C"
   $ hg debugobsolete
@@ -712,6 +712,6 @@  Even when the chain include missing node
   $ hg debugobsolete `hg log -r 7 -T '{node}\n'` --config experimental.evolution=all
   $ hg rebase -d 6 -r "4::"
+  note: not rebasing 7:360bbaa7d3ce "O", it has no successor
   rebasing 4:ff2c4d47b71d "C"
-  note: not rebasing 7:360bbaa7d3ce "O", it has no successor
   rebasing 8:8d47583e023f "P" (tip)
 
@@ -878,4 +878,5 @@  Create the changes that we will rebase
   ~
   $ hg rebase -r ".^^ + .^ + ." -d 19
+  note: not rebasing 21:8b31da3c4919 "dummy change", already in destination as 19:601db7a18f51 "dummy change successor"
   rebasing 20:b82fb57ea638 "willconflict second version"
   merging willconflict
@@ -889,5 +890,4 @@  Create the changes that we will rebase
   $ hg rebase --continue
   rebasing 20:b82fb57ea638 "willconflict second version"
-  note: not rebasing 21:8b31da3c4919 "dummy change", already in destination as 19:601db7a18f51 "dummy change successor"
   rebasing 22:7bdc8a87673d "dummy change" (tip)
   $ cd ..