[PATCH] exchange: identify the troubled commit

timeless timeless at mozdev.org
Tue Dec 8 04:40:25 UTC 2015


# HG changeset patch
# User timeless <timeless at mozdev.org>
# Date 1449549446 0
#      Tue Dec 08 04:37:26 2015 +0000
# Node ID 7835c3c8bf67c5213c21276645442e21e4180b7d
# Parent  42aa0e570eaa364a622bc4443b0bcb79b1100a58
exchange: identify the troubled commit

Exchange iterates over heads to quickly identify if everything is
OK. But, users don't want to know the revision of the bad head,
they need to know the revision of the bad commit.

So, instead of identifying the faulty head, once we know there's
a faulty head, iterate over all of outgoing and identify the
specific commit that is troubled.

This could be improved by only looking at revisions relating to
the faulty head. But, since we're already failing, there's no real
need for an optimized algorithm.

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -569,7 +569,10 @@
                 if ctx.obsolete():
                     raise error.Abort(mso % ctx)
                 elif ctx.troubled():
-                    raise error.Abort(mst[ctx.troubles()[0]] % ctx)
+                    for tnode in outgoing.missing:
+                        tctx = unfi[tnode]
+                        if tctx.troubled():
+                            raise error.Abort(mst[tctx.troubles()[0]] % tctx)
 
         discovery.checkheads(pushop)
     return True
diff --git a/tests/test-obsolete-divergent.t b/tests/test-obsolete-divergent.t
--- a/tests/test-obsolete-divergent.t
+++ b/tests/test-obsolete-divergent.t
@@ -87,7 +87,7 @@
   $ hg push ../other
   pushing to ../other
   searching for changes
-  abort: push includes divergent changeset: 392fd25390da!
+  abort: push includes divergent changeset: 82623d38b9ba!
   [255]
 
   $ cd ..


More information about the Mercurial-devel mailing list