##// END OF EJS Templates
push: allow to specify multiple destinations...
marmoute -
r47536:066b8d8f default
parent child Browse files
Show More
@@ -5623,11 +5623,11 b' def purge(ui, repo, *dirs, **opts):'
5623 5623 ),
5624 5624 ]
5625 5625 + remoteopts,
5626 _(b'[-f] [-r REV]... [-e CMD] [--remotecmd CMD] [DEST]'),
5626 _(b'[-f] [-r REV]... [-e CMD] [--remotecmd CMD] [DEST]...'),
5627 5627 helpcategory=command.CATEGORY_REMOTE_REPO_MANAGEMENT,
5628 5628 helpbasic=True,
5629 5629 )
5630 def push(ui, repo, dest=None, **opts):
5630 def push(ui, repo, *dests, **opts):
5631 5631 """push changes to the specified destination
5632 5632
5633 5633 Push changesets from the local repository to the specified
@@ -5663,6 +5663,9 b' def push(ui, repo, dest=None, **opts):'
5663 5663 Please see :hg:`help urls` for important details about ``ssh://``
5664 5664 URLs. If DESTINATION is omitted, a default path will be used.
5665 5665
5666 When passed multiple destinations, push will process them one after the
5667 other, but stop should an error occur.
5668
5666 5669 .. container:: verbose
5667 5670
5668 5671 The --pushvars option sends strings to the server that become
@@ -5706,7 +5709,12 b' def push(ui, repo, dest=None, **opts):'
5706 5709 # if we try to push a deleted bookmark, translate it to null
5707 5710 # this lets simultaneous -r, -b options continue working
5708 5711 opts.setdefault(b'rev', []).append(b"null")
5709 if True:
5712
5713 if not dests:
5714 dests = [None]
5715 some_pushed = False
5716 result = 0
5717 for dest in dests:
5710 5718 path = ui.getpath(dest, default=(b'default-push', b'default'))
5711 5719 if not path:
5712 5720 raise error.ConfigError(
@@ -5753,9 +5761,9 b' def push(ui, repo, dest=None, **opts):'
5753 5761 c = repo[b'.']
5754 5762 subs = c.substate # only repos that are committed
5755 5763 for s in sorted(subs):
5756 result = c.sub(s).push(opts)
5757 if result == 0:
5758 return not result
5764 sub_result = c.sub(s).push(opts)
5765 if sub_result == 0:
5766 return 1
5759 5767 finally:
5760 5768 del repo._subtoppath
5761 5769
@@ -5775,15 +5783,24 b' def push(ui, repo, dest=None, **opts):'
5775 5783 opargs=opargs,
5776 5784 )
5777 5785
5778 result = not pushop.cgresult
5786 if pushop.cgresult == 0:
5787 result = 1
5788 elif pushop.cgresult is not None:
5789 some_pushed = True
5779 5790
5780 5791 if pushop.bkresult is not None:
5781 5792 if pushop.bkresult == 2:
5782 5793 result = 2
5783 5794 elif not result and pushop.bkresult:
5784 5795 result = 2
5796
5797 if result:
5798 break
5799
5785 5800 finally:
5786 5801 other.close()
5802 if result == 0 and not some_pushed:
5803 result = 1
5787 5804 return result
5788 5805
5789 5806
@@ -71,6 +71,9 b' Various other repositories'
71 71 Test simple bare operation
72 72 ==========================
73 73
74 pull
75 ----
76
74 77 $ hg clone main-repo test-repo-bare --rev 0 -U
75 78 adding changesets
76 79 adding manifests
@@ -121,9 +124,90 b' Test simple bare operation'
121 124 o A 0
122 125
123 126
127 push
128 ----
129
130 $ cp -R ./branch-E ./branch-E-push
131 $ cp -R ./branch-G ./branch-G-push
132 $ cp -R ./branch-H ./branch-H-push
133 $ hg push --force -R test-repo-bare ./branch-E-push ./branch-G-push ./branch-H-push
134 pushing to ./branch-E-push
135 searching for changes
136 adding changesets
137 adding manifests
138 adding file changes
139 added 3 changesets with 3 changes to 3 files (+2 heads)
140 pushing to ./branch-G-push
141 searching for changes
142 adding changesets
143 adding manifests
144 adding file changes
145 added 4 changesets with 4 changes to 4 files (+2 heads)
146 pushing to ./branch-H-push
147 searching for changes
148 adding changesets
149 adding manifests
150 adding file changes
151 added 4 changesets with 4 changes to 4 files (+2 heads)
152 $ hg log -R ./branch-E-push -T '{desc} {rev}\n' --rev 'sort(all(), "topo")' -G
153 o H 7
154 |
155 | o E 4
156 | |
157 | o D 3
158 |/
159 o C 2
160 |
161 | o G 6
162 | |
163 | o F 5
164 |/
165 o B 1
166 |
167 o A 0
168
169 $ hg log -R ./branch-G-push -T '{desc} {rev}\n' --rev 'sort(all(), "topo")' -G
170 o H 7
171 |
172 | o E 6
173 | |
174 | o D 5
175 |/
176 o C 4
177 |
178 | o G 3
179 | |
180 | o F 2
181 |/
182 o B 1
183 |
184 o A 0
185
186 $ hg log -R ./branch-H-push -T '{desc} {rev}\n' --rev 'sort(all(), "topo")' -G
187 o G 7
188 |
189 o F 6
190 |
191 | o E 5
192 | |
193 | o D 4
194 | |
195 | | o H 3
196 | |/
197 | o C 2
198 |/
199 o B 1
200 |
201 o A 0
202
203 $ rm -rf ./*-push
204
124 205 Test operation with a target
125 206 ============================
126 207
208 pull
209 ----
210
127 211 $ hg clone main-repo test-repo-rev --rev 0 -U
128 212 adding changesets
129 213 adding manifests
@@ -199,6 +283,125 b' different repositories.'
199 283 o A 0
200 284
201 285
286 push
287 ----
288
289 We only push a specific branch with --rev
290
291 $ cp -R ./branch-E ./branch-E-push
292 $ cp -R ./branch-G ./branch-G-push
293 $ cp -R ./branch-H ./branch-H-push
294 $ hg push --force -R test-repo-bare ./branch-E-push ./branch-G-push ./branch-H-push --rev default
295 pushing to ./branch-E-push
296 searching for changes
297 adding changesets
298 adding manifests
299 adding file changes
300 added 1 changesets with 1 changes to 1 files (+1 heads)
301 pushing to ./branch-G-push
302 searching for changes
303 adding changesets
304 adding manifests
305 adding file changes
306 added 2 changesets with 2 changes to 2 files (+1 heads)
307 pushing to ./branch-H-push
308 searching for changes
309 no changes found
310 $ hg log -R ./branch-E-push -T '{desc} {rev}\n' --rev 'sort(all(), "topo")' -G
311 o H 5
312 |
313 | o E 4
314 | |
315 | o D 3
316 |/
317 o C 2
318 |
319 o B 1
320 |
321 o A 0
322
323 $ hg log -R ./branch-G-push -T '{desc} {rev}\n' --rev 'sort(all(), "topo")' -G
324 o H 5
325 |
326 o C 4
327 |
328 | o G 3
329 | |
330 | o F 2
331 |/
332 o B 1
333 |
334 o A 0
335
336 $ hg log -R ./branch-H-push -T '{desc} {rev}\n' --rev 'sort(all(), "topo")' -G
337 o H 3
338 |
339 o C 2
340 |
341 o B 1
342 |
343 o A 0
344
345 $ rm -rf ./*-push
346
347 Same push, but the first one is a no-op
348
349 $ cp -R ./branch-E ./branch-E-push
350 $ cp -R ./branch-G ./branch-G-push
351 $ cp -R ./branch-H ./branch-H-push
352 $ hg push --force -R test-repo-bare ./branch-G-push ./branch-H-push ./branch-E-push --rev default
353 pushing to ./branch-G-push
354 searching for changes
355 adding changesets
356 adding manifests
357 adding file changes
358 added 2 changesets with 2 changes to 2 files (+1 heads)
359 pushing to ./branch-H-push
360 searching for changes
361 no changes found
362 pushing to ./branch-E-push
363 searching for changes
364 adding changesets
365 adding manifests
366 adding file changes
367 added 1 changesets with 1 changes to 1 files (+1 heads)
368 $ hg log -R ./branch-E-push -T '{desc} {rev}\n' --rev 'sort(all(), "topo")' -G
369 o H 5
370 |
371 | o E 4
372 | |
373 | o D 3
374 |/
375 o C 2
376 |
377 o B 1
378 |
379 o A 0
380
381 $ hg log -R ./branch-G-push -T '{desc} {rev}\n' --rev 'sort(all(), "topo")' -G
382 o H 5
383 |
384 o C 4
385 |
386 | o G 3
387 | |
388 | o F 2
389 |/
390 o B 1
391 |
392 o A 0
393
394 $ hg log -R ./branch-H-push -T '{desc} {rev}\n' --rev 'sort(all(), "topo")' -G
395 o H 3
396 |
397 o C 2
398 |
399 o B 1
400 |
401 o A 0
402
403 $ rm -rf ./*-push
404
202 405
203 406 Test with --update
204 407 ==================
General Comments 0
You need to be logged in to leave comments. Login now