comparison mercurial/exchange.py @ 22623:cd7e17aa6040

push: pass list of bookmark to `exchange.push` Currently stored but not unused. This parameter will control bookmarks explicitly pushed (added to the server if missing).
author Pierre-Yves David <pierre-yves.david@fb.com>
date Thu, 25 Sep 2014 01:49:20 -0700
parents ce6b9edee725
children eef31f9a4c0f
comparison
equal deleted inserted replaced
22622:ce6b9edee725 22623:cd7e17aa6040
59 59
60 A new should be created at the beginning of each push and discarded 60 A new should be created at the beginning of each push and discarded
61 afterward. 61 afterward.
62 """ 62 """
63 63
64 def __init__(self, repo, remote, force=False, revs=None, newbranch=False): 64 def __init__(self, repo, remote, force=False, revs=None, newbranch=False,
65 bookmarks=()):
65 # repo we push from 66 # repo we push from
66 self.repo = repo 67 self.repo = repo
67 self.ui = repo.ui 68 self.ui = repo.ui
68 # repo we push to 69 # repo we push to
69 self.remote = remote 70 self.remote = remote
70 # force option provided 71 # force option provided
71 self.force = force 72 self.force = force
72 # revs to be pushed (None is "all") 73 # revs to be pushed (None is "all")
73 self.revs = revs 74 self.revs = revs
75 # bookmark explicitly pushed
76 self.bookmarks = bookmarks
74 # allow push of new branch 77 # allow push of new branch
75 self.newbranch = newbranch 78 self.newbranch = newbranch
76 # did a local lock get acquired? 79 # did a local lock get acquired?
77 self.locallocked = None 80 self.locallocked = None
78 # step already performed 81 # step already performed
143 if self.cgresult: 146 if self.cgresult:
144 return self.futureheads 147 return self.futureheads
145 else: 148 else:
146 return self.fallbackheads 149 return self.fallbackheads
147 150
148 def push(repo, remote, force=False, revs=None, newbranch=False): 151 def push(repo, remote, force=False, revs=None, newbranch=False, bookmarks=()):
149 '''Push outgoing changesets (limited by revs) from a local 152 '''Push outgoing changesets (limited by revs) from a local
150 repository to remote. Return an integer: 153 repository to remote. Return an integer:
151 - None means nothing to push 154 - None means nothing to push
152 - 0 means HTTP error 155 - 0 means HTTP error
153 - 1 means we pushed and remote head count is unchanged *or* 156 - 1 means we pushed and remote head count is unchanged *or*
154 we have outgoing changesets but refused to push 157 we have outgoing changesets but refused to push
155 - other values as described by addchangegroup() 158 - other values as described by addchangegroup()
156 ''' 159 '''
157 pushop = pushoperation(repo, remote, force, revs, newbranch) 160 pushop = pushoperation(repo, remote, force, revs, newbranch, bookmarks)
158 if pushop.remote.local(): 161 if pushop.remote.local():
159 missing = (set(pushop.repo.requirements) 162 missing = (set(pushop.repo.requirements)
160 - pushop.remote.local().supported) 163 - pushop.remote.local().supported)
161 if missing: 164 if missing:
162 msg = _("required features are not" 165 msg = _("required features are not"