diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
index 4154338f0bc04502a65b11cdcb5d68a793d29ed7_bWVyY3VyaWFsL2xvY2FscmVwby5weQ==..b8696a6676bed4bea1b0da76cbee21a22ba886d6_bWVyY3VyaWFsL2xvY2FscmVwby5weQ== 100644
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1622,7 +1622,6 @@
                         self.ui.status(_(msg) % len(outgoing.excluded))
                     else:
                         self.ui.status(_("no changes found\n"))
-                    fut = outgoing.common
                     ret = 1
                 else:
                     # something to push
@@ -1653,12 +1652,11 @@
                         # we return an integer indicating remote head count change
                         ret = remote.addchangegroup(cg, 'push', self.url())
 
-                # compute what should be the now common
-                #
-                # XXX If push failed we should use strict common and not
-                # future to avoid pushing phase data on unknown changeset.
-                # This is to done later.
-                fut = outgoing.commonheads + outgoing.missingheads
+                cheads = outgoing.commonheads[:]
+                if ret:
+                    # push succeed, synchonize common + pushed
+                    # this is a no-op if there was nothing to push
+                    cheads += outgoing.missingheads
                 # even when we don't push, exchanging phase data is useful
                 remotephases = remote.listkeys('phases')
                 if not remotephases: # old server or public only repo
@@ -1662,6 +1660,6 @@
                 # even when we don't push, exchanging phase data is useful
                 remotephases = remote.listkeys('phases')
                 if not remotephases: # old server or public only repo
-                    phases.advanceboundary(self, phases.public, fut)
+                    phases.advanceboundary(self, phases.public, cheads)
                     # don't push any phase data as there is nothing to push
                 else:
@@ -1666,6 +1664,6 @@
                     # don't push any phase data as there is nothing to push
                 else:
-                    ana = phases.analyzeremotephases(self, fut, remotephases)
+                    ana = phases.analyzeremotephases(self, cheads, remotephases)
                     pheads, droots = ana
                     ### Apply remote phase on local
                     if remotephases.get('publishing', False):
@@ -1669,6 +1667,6 @@
                     pheads, droots = ana
                     ### Apply remote phase on local
                     if remotephases.get('publishing', False):
-                        phases.advanceboundary(self, phases.public, fut)
+                        phases.advanceboundary(self, phases.public, cheads)
                     else: # publish = False
                         phases.advanceboundary(self, phases.public, pheads)
@@ -1673,9 +1671,9 @@
                     else: # publish = False
                         phases.advanceboundary(self, phases.public, pheads)
-                        phases.advanceboundary(self, phases.draft, fut)
+                        phases.advanceboundary(self, phases.draft, cheads)
                     ### Apply local phase on remote
 
                     # Get the list of all revs draft on remote by public here.
                     # XXX Beware that revset break if droots is not strictly
                     # XXX root we may want to ensure it is but it is costly
                     outdated =  self.set('heads((%ln::%ln) and public())',
@@ -1676,10 +1674,10 @@
                     ### Apply local phase on remote
 
                     # Get the list of all revs draft on remote by public here.
                     # XXX Beware that revset break if droots is not strictly
                     # XXX root we may want to ensure it is but it is costly
                     outdated =  self.set('heads((%ln::%ln) and public())',
-                                         droots, fut)
+                                         droots, cheads)
                     for newremotehead in outdated:
                         r = remote.pushkey('phases',
                                            newremotehead.hex(),
diff --git a/tests/test-push-http.t b/tests/test-push-http.t
index 4154338f0bc04502a65b11cdcb5d68a793d29ed7_dGVzdHMvdGVzdC1wdXNoLWh0dHAudA==..b8696a6676bed4bea1b0da76cbee21a22ba886d6_dGVzdHMvdGVzdC1wdXNoLWh0dHAudA== 100644
--- a/tests/test-push-http.t
+++ b/tests/test-push-http.t
@@ -29,7 +29,7 @@
   searching for changes
   remote: ssl required
   remote: ssl required
-  updating ba677d0156c1 to public failed!
+  updating cb9a9f314b8b to public failed!
   % serve errors
 
 expect authorization error