changeset 20462:0031ef5df586

push: move `remoteheads` into the push object The heads of the remote repository are used to detect race when pushing changeset. We now store this information in `pushoperation` object to allow extraction of the changeset pushing part.
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Thu, 30 Jan 2014 20:34:35 -0800
parents abd8e56a1038
children f1b532a310e4
files mercurial/exchange.py
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/exchange.py	Tue Feb 04 15:07:03 2014 -0800
+++ b/mercurial/exchange.py	Thu Jan 30 20:34:35 2014 -0800
@@ -44,6 +44,8 @@
         self.ret = None
         # discover.outgoing object (contains common and outgoin data)
         self.outgoing = None
+        # all remote heads before the push
+        self.remoteheads = None
 
 def push(repo, remote, force=False, revs=None, newbranch=False):
     '''Push outgoing changesets (limited by revs) from a local
@@ -104,6 +106,7 @@
             outgoing = fco(unfi, pushop.remote, onlyheads=pushop.revs,
                            commoninc=commoninc, force=pushop.force)
             pushop.outgoing = outgoing
+            pushop.remoteheads = remoteheads
 
 
             if not outgoing.missing:
@@ -163,6 +166,8 @@
                     # commit/push race), server aborts.
                     if pushop.force:
                         remoteheads = ['force']
+                    else:
+                        remoteheads = pushop.remoteheads
                     # ssh: return remote's addchangegroup()
                     # http: return remote's addchangegroup() or 0 for error
                     pushop.ret = pushop.remote.unbundle(cg, remoteheads,