Show More
@@ -141,43 +141,7 b' def push(repo, remote, force=False, revs' | |||||
141 | discovery.checkheads(unfi, pushop.remote, outgoing, |
|
141 | discovery.checkheads(unfi, pushop.remote, outgoing, | |
142 | remoteheads, pushop.newbranch, |
|
142 | remoteheads, pushop.newbranch, | |
143 | bool(inc), newbm) |
|
143 | bool(inc), newbm) | |
144 |
|
144 | _pushchangeset(pushop) | ||
145 | # TODO: get bundlecaps from remote |
|
|||
146 | bundlecaps = None |
|
|||
147 | # create a changegroup from local |
|
|||
148 | if pushop.revs is None and not (outgoing.excluded |
|
|||
149 | or pushop.repo.changelog.filteredrevs): |
|
|||
150 | # push everything, |
|
|||
151 | # use the fast path, no race possible on push |
|
|||
152 | bundler = changegroup.bundle10(pushop.repo, bundlecaps) |
|
|||
153 | cg = pushop.repo._changegroupsubset(outgoing, |
|
|||
154 | bundler, |
|
|||
155 | 'push', |
|
|||
156 | fastpath=True) |
|
|||
157 | else: |
|
|||
158 | cg = pushop.repo.getlocalbundle('push', outgoing, |
|
|||
159 | bundlecaps) |
|
|||
160 |
|
||||
161 | # apply changegroup to remote |
|
|||
162 | if unbundle: |
|
|||
163 | # local repo finds heads on server, finds out what |
|
|||
164 | # revs it must push. once revs transferred, if server |
|
|||
165 | # finds it has different heads (someone else won |
|
|||
166 | # commit/push race), server aborts. |
|
|||
167 | if pushop.force: |
|
|||
168 | remoteheads = ['force'] |
|
|||
169 | else: |
|
|||
170 | remoteheads = pushop.remoteheads |
|
|||
171 | # ssh: return remote's addchangegroup() |
|
|||
172 | # http: return remote's addchangegroup() or 0 for error |
|
|||
173 | pushop.ret = pushop.remote.unbundle(cg, remoteheads, |
|
|||
174 | 'push') |
|
|||
175 | else: |
|
|||
176 | # we return an integer indicating remote head count |
|
|||
177 | # change |
|
|||
178 | pushop.ret = pushop.remote.addchangegroup(cg, 'push', |
|
|||
179 | pushop.repo.url()) |
|
|||
180 |
|
||||
181 | _pushsyncphase(pushop) |
|
145 | _pushsyncphase(pushop) | |
182 | _pushobsolete(pushop) |
|
146 | _pushobsolete(pushop) | |
183 | finally: |
|
147 | finally: | |
@@ -190,6 +154,45 b' def push(repo, remote, force=False, revs' | |||||
190 | _pushbookmark(pushop) |
|
154 | _pushbookmark(pushop) | |
191 | return pushop.ret |
|
155 | return pushop.ret | |
192 |
|
156 | |||
|
157 | def _pushchangeset(pushop): | |||
|
158 | """Make the actual push of changeset bundle to remote repo""" | |||
|
159 | outgoing = pushop.outgoing | |||
|
160 | unbundle = pushop.remote.capable('unbundle') | |||
|
161 | # TODO: get bundlecaps from remote | |||
|
162 | bundlecaps = None | |||
|
163 | # create a changegroup from local | |||
|
164 | if pushop.revs is None and not (outgoing.excluded | |||
|
165 | or pushop.repo.changelog.filteredrevs): | |||
|
166 | # push everything, | |||
|
167 | # use the fast path, no race possible on push | |||
|
168 | bundler = changegroup.bundle10(pushop.repo, bundlecaps) | |||
|
169 | cg = pushop.repo._changegroupsubset(outgoing, | |||
|
170 | bundler, | |||
|
171 | 'push', | |||
|
172 | fastpath=True) | |||
|
173 | else: | |||
|
174 | cg = pushop.repo.getlocalbundle('push', outgoing, bundlecaps) | |||
|
175 | ||||
|
176 | # apply changegroup to remote | |||
|
177 | if unbundle: | |||
|
178 | # local repo finds heads on server, finds out what | |||
|
179 | # revs it must push. once revs transferred, if server | |||
|
180 | # finds it has different heads (someone else won | |||
|
181 | # commit/push race), server aborts. | |||
|
182 | if pushop.force: | |||
|
183 | remoteheads = ['force'] | |||
|
184 | else: | |||
|
185 | remoteheads = pushop.remoteheads | |||
|
186 | # ssh: return remote's addchangegroup() | |||
|
187 | # http: return remote's addchangegroup() or 0 for error | |||
|
188 | pushop.ret = pushop.remote.unbundle(cg, remoteheads, | |||
|
189 | 'push') | |||
|
190 | else: | |||
|
191 | # we return an integer indicating remote head count | |||
|
192 | # change | |||
|
193 | pushop.ret = pushop.remote.addchangegroup(cg, 'push', | |||
|
194 | pushop.repo.url()) | |||
|
195 | ||||
193 | def _pushsyncphase(pushop): |
|
196 | def _pushsyncphase(pushop): | |
194 | """synchronise phase information locally and remotly""" |
|
197 | """synchronise phase information locally and remotly""" | |
195 | unfi = pushop.repo.unfiltered() |
|
198 | unfi = pushop.repo.unfiltered() |
General Comments 0
You need to be logged in to leave comments.
Login now