push: move `newbranch` argument into the push object
One more step toward a more modular push function.
--- 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