Show More
@@ -191,8 +191,41 b' def push(repo, remote, force=False, revs' | |||||
191 | _pushbookmark(pushop) |
|
191 | _pushbookmark(pushop) | |
192 | return pushop.ret |
|
192 | return pushop.ret | |
193 |
|
193 | |||
|
194 | # list of steps to perform discovery before push | |||
|
195 | pushdiscoveryorder = [] | |||
|
196 | ||||
|
197 | # Mapping between step name and function | |||
|
198 | # | |||
|
199 | # This exists to help extensions wrap steps if necessary | |||
|
200 | pushdiscoverymapping = {} | |||
|
201 | ||||
|
202 | def pushdiscovery(stepname): | |||
|
203 | """decorator for function performing discovery before push | |||
|
204 | ||||
|
205 | The function is added to the step -> function mapping and appended to the | |||
|
206 | list of steps. Beware that decorated function will be added in order (this | |||
|
207 | may matter). | |||
|
208 | ||||
|
209 | You can only use this decorator for a new step, if you want to wrap a step | |||
|
210 | from an extension, change the pushdiscovery dictionary directly.""" | |||
|
211 | def dec(func): | |||
|
212 | assert stepname not in pushdiscoverymapping | |||
|
213 | pushdiscoverymapping[stepname] = func | |||
|
214 | pushdiscoveryorder.append(stepname) | |||
|
215 | return func | |||
|
216 | return dec | |||
|
217 | ||||
|
218 | ||||
|
219 | ||||
194 | def _pushdiscovery(pushop): |
|
220 | def _pushdiscovery(pushop): | |
195 | # discovery |
|
221 | """Run all discovery steps""" | |
|
222 | for stepname in pushdiscoveryorder: | |||
|
223 | step = pushdiscoverymapping[stepname] | |||
|
224 | step(pushop) | |||
|
225 | ||||
|
226 | @pushdiscovery('changeset') | |||
|
227 | def _pushdiscoverychangeset(pushop): | |||
|
228 | """discover the changeset that need to be pushed""" | |||
196 | unfi = pushop.repo.unfiltered() |
|
229 | unfi = pushop.repo.unfiltered() | |
197 | fci = discovery.findcommonincoming |
|
230 | fci = discovery.findcommonincoming | |
198 | commoninc = fci(unfi, pushop.remote, force=pushop.force) |
|
231 | commoninc = fci(unfi, pushop.remote, force=pushop.force) |
General Comments 0
You need to be logged in to leave comments.
Login now