Patchwork [1,of,2,STABLE] phase: properly compute ancestors of --rev on push (issue3786)

login
register
mail settings
Submitter Pierre-Yves David
Date Jan. 23, 2014, 10:48 p.m.
Message ID <af967baa28dec969bc5d.1390517281@marginatus.fb.com>
Download mbox | patch
Permalink /patch/3407/
State Accepted
Commit b396032e1bb8ee99b585f48744390df8af07d226
Headers show

Comments

Pierre-Yves David - Jan. 23, 2014, 10:48 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@logilab.fr>
# Date 1359382609 -3600
#      Mon Jan 28 15:16:49 2013 +0100
# Node ID af967baa28dec969bc5d2bd1c9cc79a2bc2b0af1
# Parent  082b2930fe2ca9a003b08439524384e097acaa0a
phase: properly compute ancestors of --rev on push (issue3786)

Now that discovery is working on unfiltered changeset, I had a good occasion to
look at that bug again. This let me realise that a trivial node vs rev
comparision was the cause of this two years old bugs…

Happy second birthday phases!
Matt Mackall - Jan. 24, 2014, midnight
On Thu, 2014-01-23 at 14:48 -0800, pierre-yves.david@ens-lyon.org wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@logilab.fr>
> # Date 1359382609 -3600
> #      Mon Jan 28 15:16:49 2013 +0100
> # Node ID af967baa28dec969bc5d2bd1c9cc79a2bc2b0af1
> # Parent  082b2930fe2ca9a003b08439524384e097acaa0a
> phase: properly compute ancestors of --rev on push (issue3786)
> 
> Now that discovery is working on unfiltered changeset, I had a good occasion to
> look at that bug again. This let me realise that a trivial node vs rev
> comparision was the cause of this two years old bugs…
> 
> Happy second birthday phases!

This one is queued for stable, thanks. Please resend the new test after
the freeze.

Patch

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1903,11 +1903,12 @@  class localrepository(object):
                     #     missing = ((commonheads::missingheads) - commonheads)
                     #
                     # We can pick:
                     # * missingheads part of common (::commonheads)
                     common = set(outgoing.common)
-                    cheads = [node for node in revs if node in common]
+                    nm = self.changelog.nodemap
+                    cheads = [node for node in revs if nm[node] in common]
                     # and
                     # * commonheads parents on missing
                     revset = unfi.set('%ln and parents(roots(%ln))',
                                      outgoing.commonheads,
                                      outgoing.missing)
diff --git a/tests/test-phases-exchange.t b/tests/test-phases-exchange.t
--- a/tests/test-phases-exchange.t
+++ b/tests/test-phases-exchange.t
@@ -90,10 +90,24 @@  push from alpha to beta should update ph
   |
   o  1 public a-B - 548a3d25dbf0
   |
   o  0 public a-A - 054250a37db4
   
+  $ hg push -r 2 ../beta
+  pushing to ../beta
+  searching for changes
+  no changes found
+  [1]
+  $ hgph
+  @  3 draft a-D - b555f63b6063
+  |
+  o  2 public a-C - 54acac6f23ab
+  |
+  o  1 public a-B - 548a3d25dbf0
+  |
+  o  0 public a-A - 054250a37db4
+  
   $ hg push ../beta
   pushing to ../beta
   searching for changes
   no changes found
   [1]