# HG changeset patch # User Pierre-Yves David # Date 2014-01-31 01:08:29 # Node ID c05ad450df23b1616ff1b628f88fdb1fd45c6e75 # Parent 8c85d968ee65d10ce3cfd5d32746f885712f7032 push: move `newbranch` argument into the push object One more step toward a more modular push function. diff --git a/mercurial/exchange.py b/mercurial/exchange.py --- a/mercurial/exchange.py +++ b/mercurial/exchange.py @@ -21,7 +21,7 @@ class pushoperation(object): 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 @@ class pushoperation(object): 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 @@ def push(repo, remote, force=False, revs 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 @@ def push(repo, remote, force=False, revs 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