[PATCH 4 of 5 REVIEW] phases: mark content pushed as public in local repo on push

Pierre-Yves David pierre-yves.david at logilab.fr
Fri Oct 21 08:32:50 CDT 2011


New diff for this files.

The initial use of a generator was a micro optimisation to avoid computing the
set if not necessary. I dropped it. future have been renamed to futureheads
(should have been renamed futurecommonheads but…)


diff --git a/mercurial/discovery.py b/mercurial/discovery.py
--- a/mercurial/discovery.py
+++ b/mercurial/discovery.py
@@ -64,30 +64,33 @@ def findcommonoutgoing(repo, other, only
 def prepush(repo, remote, force, revs, newbranch):
     '''Analyze the local and remote repositories and determine which
     changesets need to be pushed to the remote. Return value depends
     on circumstances:
 
-    If we are not going to push anything, return a tuple (None,
-    outgoing) where outgoing is 0 if there are no outgoing
-    changesets and 1 if there are, but we refuse to push them
-    (e.g. would create new remote heads).
+    If we are not going to push anything, return a tuple (None, outgoing,
+    common) where outgoing is 0 if there are no outgoing changesets and 1 if
+    there are, but we refuse to push them (e.g. would create new remote heads).
+    common are the list of heads of the common set between local and remote.
 
-    Otherwise, return a tuple (changegroup, remoteheads), where
-    changegroup is a readable file-like object whose read() returns
-    successive changegroup chunks ready to be sent over the wire and
-    remoteheads is the list of remote heads.'''
+    Otherwise, return a tuple (changegroup, remoteheads, futureheads), where
+    changegroup is a readable file-like object whose read() returns successive
+    changegroup chunks ready to be sent over the wire and remoteheads is the
+    list of remote heads. futureheads heads ot the common set between local and
+    remote to be after push completion.
+
+    '''
     commoninc = findcommonincoming(repo, remote, force=force)
     common, revs = findcommonoutgoing(repo, remote, onlyheads=revs,
                                       commoninc=commoninc, force=force)
     _common, inc, remoteheads = commoninc
 
     cl = repo.changelog
     outg = cl.findmissing(common, revs)
 
     if not outg:
         repo.ui.status(_("no changes found\n"))
-        return None, 1
+        return None, 1, common
 
     if not force and remoteheads != [nullid]:
         if remote.capable('branchmap'):
             # Check for each named branch if we're creating new remote heads.
             # To be a remote head after push, node must be either:
@@ -187,6 +190,13 @@ def prepush(repo, remote, force, revs, n
     if revs is None:
         # use the fast path, no race possible on push
         cg = repo._changegroup(outg, 'push')
     else:
         cg = repo.getbundle('push', heads=revs, common=common)
-    return cg, remoteheads
+    # no need to compute outg ancestor. All node in outg have either:
+    # - parents in outg
+    # - parents in common
+    # - nullid parent
+    from itertools import chain
+    rset = repo.set('heads(%ln)', chain(common, outg))
+    futureheads = [ctx.node() for ctx in rset]
+    return cg, remoteheads, futureheads


-- 
Pierre-Yves David

http://www.logilab.fr/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20111021/29de4503/attachment.pgp>


More information about the Mercurial-devel mailing list