<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Feb 11, 2014 at 10:32 PM,  <span dir="ltr"><<a href="mailto:pierre-yves.david@ens-lyon.org" target="_blank">pierre-yves.david@ens-lyon.org</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"># HG changeset patch<br>
# User Pierre-Yves David <<a href="mailto:pierre-yves.david@logilab.fr">pierre-yves.david@logilab.fr</a>><br>
# Date 1391144481 28800<br>
#      Thu Jan 30 21:01:21 2014 -0800<br>
# Node ID 2890c2e587627bd14728ccaf6eacc581ee7a4fa9<br>
# Parent  ee7be5db8f2443a3c97a33b3fe4276d2af7e36fd<br>
push: move outgoing check logic in its own function<br>
<br>
Now that every necessary information is held in the `pushoperation` object, we<br>
can extract the part responsible of aborting the push to it's own function.<br>
<br>
This changeset is mostly pure code movement. the exception is the fact this<br>
function a value to decide if changeset bundle should be pushed.<br></blockquote><div>you accidentally a word there:</div><div><br></div><div>This changeset is mostly pure code movement. the exception is the fact this</div>

<div>function returns a value to decide if changeset bundle should be pushed. </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">


<br>
diff --git a/mercurial/exchange.py b/mercurial/exchange.py<br>
--- a/mercurial/exchange.py<br>
+++ b/mercurial/exchange.py<br>
@@ -109,43 +109,11 @@ def push(repo, remote, force=False, revs<br>
                            commoninc=commoninc, force=pushop.force)<br>
             pushop.outgoing = outgoing<br>
             pushop.remoteheads = remoteheads<br>
             pushop.incoming = inc<br>
<br>
-<br>
-            if not outgoing.missing:<br>
-                # nothing to push<br>
-                scmutil.nochangesfound(unfi.ui, unfi, outgoing.excluded)<br>
-            else:<br>
-                # something to push<br>
-                if not pushop.force:<br>
-                    # if repo.obsstore == False --> no obsolete<br>
-                    # then, save the iteration<br>
-                    if unfi.obsstore:<br>
-                        # this message are here for 80 char limit reason<br>
-                        mso = _("push includes obsolete changeset: %s!")<br>
-                        mst = "push includes %s changeset: %s!"<br>
-                        # plain versions for i18n tool to detect them<br>
-                        _("push includes unstable changeset: %s!")<br>
-                        _("push includes bumped changeset: %s!")<br>
-                        _("push includes divergent changeset: %s!")<br>
-                        # If we are to push if there is at least one<br>
-                        # obsolete or unstable changeset in missing, at<br>
-                        # least one of the missinghead will be obsolete or<br>
-                        # unstable. So checking heads only is ok<br>
-                        for node in outgoing.missingheads:<br>
-                            ctx = unfi[node]<br>
-                            if ctx.obsolete():<br>
-                                raise util.Abort(mso % ctx)<br>
-                            elif ctx.troubled():<br>
-                                raise util.Abort(_(mst)<br>
-                                                 % (ctx.troubles()[0],<br>
-                                                    ctx))<br>
-                    newbm = pushop.ui.configlist('bookmarks', 'pushing')<br>
-                    discovery.checkheads(unfi, pushop.remote, outgoing,<br>
-                                         remoteheads, pushop.newbranch,<br>
-                                         bool(pushop.incoming), newbm)<br>
+            if _pushcheckoutgoing(pushop):<br>
                 _pushchangeset(pushop)<br>
             _pushsyncphase(pushop)<br>
             _pushobsolete(pushop)<br>
         finally:<br>
             if lock is not None:<br>
@@ -155,10 +123,49 @@ def push(repo, remote, force=False, revs<br>
             locallock.release()<br>
<br>
     _pushbookmark(pushop)<br>
     return pushop.ret<br>
<br>
+def _pushcheckoutgoing(pushop):<br>
+    outgoing = pushop.outgoing<br>
+    unfi = pushop.repo.unfiltered()<br>
+    if not outgoing.missing:<br>
+        # nothing to push<br>
+        scmutil.nochangesfound(unfi.ui, unfi, outgoing.excluded)<br>
+        return False<br>
+    # something to push<br>
+    if not pushop.force:<br>
+        # if repo.obsstore == False --> no obsolete<br>
+        # then, save the iteration<br>
+        if unfi.obsstore:<br>
+            # this message are here for 80 char limit reason<br>
+            mso = _("push includes obsolete changeset: %s!")<br>
+            mst = "push includes %s changeset: %s!"<br>
+            # plain versions for i18n tool to detect them<br>
+            _("push includes unstable changeset: %s!")<br>
+            _("push includes bumped changeset: %s!")<br>
+            _("push includes divergent changeset: %s!")<br>
+            # If we are to push if there is at least one<br>
+            # obsolete or unstable changeset in missing, at<br>
+            # least one of the missinghead will be obsolete or<br>
+            # unstable. So checking heads only is ok<br>
+            for node in outgoing.missingheads:<br>
+                ctx = unfi[node]<br>
+                if ctx.obsolete():<br>
+                    raise util.Abort(mso % ctx)<br>
+                elif ctx.troubled():<br>
+                    raise util.Abort(_(mst)<br>
+                                     % (ctx.troubles()[0],<br>
+                                        ctx))<br>
+        newbm = pushop.ui.configlist('bookmarks', 'pushing')<br>
+        discovery.checkheads(unfi, pushop.remote, outgoing,<br>
+                             pushop.remoteheads,<br>
+                             pushop.newbranch,<br>
+                             bool(pushop.incoming),<br>
+                             newbm)<br>
+    return True<br>
+<br>
 def _pushchangeset(pushop):<br>
     """Make the actual push of changeset bundle to remote repo"""<br>
     outgoing = pushop.outgoing<br>
     unbundle = pushop.remote.capable('unbundle')<br>
     # TODO: get bundlecaps from remote<br>
_______________________________________________<br>
Mercurial-devel mailing list<br>
<a href="mailto:Mercurial-devel@selenic.com">Mercurial-devel@selenic.com</a><br>
<a href="http://selenic.com/mailman/listinfo/mercurial-devel" target="_blank">http://selenic.com/mailman/listinfo/mercurial-devel</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Olle
</div></div>