changeset 20351:c05ad450df23

push: move `newbranch` argument into the push object One more step toward a more modular push function.
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Thu, 30 Jan 2014 17:08:29 -0800
parents 8c85d968ee65
children 58300f61b139
files mercurial/exchange.py
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/exchange.py	Thu Jan 30 17:04:23 2014 -0800
+++ b/mercurial/exchange.py	Thu Jan 30 17:08:29 2014 -0800
@@ -21,7 +21,7 @@
     afterward.
     """
 
-    def __init__(self, repo, remote, force=False, revs=None):
+    def __init__(self, repo, remote, force=False, revs=None, newbranch=False):
         # repo we push from
         self.repo = repo
         self.ui = repo.ui
@@ -31,6 +31,8 @@
         self.force = force
         # revs to be pushed (None is "all")
         self.revs = revs
+        # allow push of new branch
+        self.newbranch = newbranch
 
 def push(repo, remote, force=False, revs=None, newbranch=False):
     '''Push outgoing changesets (limited by revs) from a local
@@ -41,7 +43,7 @@
         we have outgoing changesets but refused to push
       - other values as described by addchangegroup()
     '''
-    pushop = pushoperation(repo, remote, force, revs)
+    pushop = pushoperation(repo, remote, force, revs, newbranch)
     if pushop.remote.local():
         missing = (set(pushop.repo.requirements)
                    - pushop.remote.local().supported)
@@ -134,7 +136,7 @@
                                                     ctx))
                     newbm = pushop.ui.configlist('bookmarks', 'pushing')
                     discovery.checkheads(unfi, pushop.remote, outgoing,
-                                         remoteheads, newbranch,
+                                         remoteheads, pushop.newbranch,
                                          bool(inc), newbm)
 
                 # TODO: get bundlecaps from remote