##// END OF EJS Templates
outgoing: accept multiple destinations...
marmoute -
r47693:d4e4ccb7 default
parent child Browse files
Show More
@@ -4923,10 +4923,10 b' statemod.addunfinished('
4923 4923 + logopts
4924 4924 + remoteopts
4925 4925 + subrepoopts,
4926 _(b'[-M] [-p] [-n] [-f] [-r REV]... [DEST]'),
4926 _(b'[-M] [-p] [-n] [-f] [-r REV]... [DEST]...'),
4927 4927 helpcategory=command.CATEGORY_REMOTE_REPO_MANAGEMENT,
4928 4928 )
4929 def outgoing(ui, repo, dest=None, **opts):
4929 def outgoing(ui, repo, *dests, **opts):
4930 4930 """show changesets not found in the destination
4931 4931
4932 4932 Show changesets not found in the specified destination repository
@@ -4962,30 +4962,24 b' def outgoing(ui, repo, dest=None, **opts'
4962 4962
4963 4963 Returns 0 if there are outgoing changes, 1 otherwise.
4964 4964 """
4965 # hg._outgoing() needs to re-resolve the path in order to handle #branch
4966 # style URLs, so don't overwrite dest.
4967 path = ui.getpath(dest, default=(b'default-push', b'default'))
4968 if not path:
4969 raise error.ConfigError(
4970 _(b'default repository not configured!'),
4971 hint=_(b"see 'hg help config.paths'"),
4972 )
4973
4974 4965 opts = pycompat.byteskwargs(opts)
4975 4966 if opts.get(b'bookmarks'):
4976 dest = path.pushloc or path.loc
4977 other = hg.peer(repo, opts, dest)
4978 try:
4979 if b'bookmarks' not in other.listkeys(b'namespaces'):
4980 ui.warn(_(b"remote doesn't support bookmarks\n"))
4981 return 0
4982 ui.status(_(b'comparing with %s\n') % urlutil.hidepassword(dest))
4983 ui.pager(b'outgoing')
4984 return bookmarks.outgoing(ui, repo, other)
4985 finally:
4986 other.close()
4987
4988 return hg.outgoing(ui, repo, dest, opts)
4967 for path in urlutil.get_push_paths(repo, ui, dests):
4968 dest = path.pushloc or path.loc
4969 other = hg.peer(repo, opts, dest)
4970 try:
4971 if b'bookmarks' not in other.listkeys(b'namespaces'):
4972 ui.warn(_(b"remote doesn't support bookmarks\n"))
4973 return 0
4974 ui.status(
4975 _(b'comparing with %s\n') % urlutil.hidepassword(dest)
4976 )
4977 ui.pager(b'outgoing')
4978 return bookmarks.outgoing(ui, repo, other)
4979 finally:
4980 other.close()
4981
4982 return hg.outgoing(ui, repo, dests, opts)
4989 4983
4990 4984
4991 4985 @command(
@@ -1320,51 +1320,53 b' def incoming(ui, repo, source, opts):'
1320 1320 return _incoming(display, subreporecurse, ui, repo, source, opts)
1321 1321
1322 1322
1323 def _outgoing(ui, repo, dest, opts, subpath=None):
1324 path = ui.getpath(dest, default=(b'default-push', b'default'))
1325 if not path:
1326 raise error.Abort(
1327 _(b'default repository not configured!'),
1328 hint=_(b"see 'hg help config.paths'"),
1329 )
1330 dest = path.pushloc or path.loc
1331 if subpath is not None:
1332 subpath = urlutil.url(subpath)
1333 if subpath.isabs():
1334 dest = bytes(subpath)
1335 else:
1336 p = urlutil.url(dest)
1337 p.path = os.path.normpath(b'%s/%s' % (p.path, subpath))
1338 dest = bytes(p)
1323 def _outgoing(ui, repo, dests, opts, subpath=None):
1324 out = set()
1325 others = []
1326 for path in urlutil.get_push_paths(repo, ui, dests):
1327 dest = path.pushloc or path.loc
1328 if subpath is not None:
1329 subpath = urlutil.url(subpath)
1330 if subpath.isabs():
1331 dest = bytes(subpath)
1332 else:
1333 p = urlutil.url(dest)
1334 p.path = os.path.normpath(b'%s/%s' % (p.path, subpath))
1335 dest = bytes(p)
1336 branches = path.branch, opts.get(b'branch') or []
1339 1337
1340 branches = path.branch, opts.get(b'branch') or []
1341
1342 ui.status(_(b'comparing with %s\n') % urlutil.hidepassword(dest))
1343 revs, checkout = addbranchrevs(repo, repo, branches, opts.get(b'rev'))
1344 if revs:
1345 revs = [repo[rev].node() for rev in scmutil.revrange(repo, revs)]
1338 ui.status(_(b'comparing with %s\n') % urlutil.hidepassword(dest))
1339 revs, checkout = addbranchrevs(repo, repo, branches, opts.get(b'rev'))
1340 if revs:
1341 revs = [repo[rev].node() for rev in scmutil.revrange(repo, revs)]
1346 1342
1347 other = peer(repo, opts, dest)
1348 try:
1349 outgoing = discovery.findcommonoutgoing(
1350 repo, other, revs, force=opts.get(b'force')
1351 )
1352 o = outgoing.missing
1353 if not o:
1354 scmutil.nochangesfound(repo.ui, repo, outgoing.excluded)
1355 return o, other
1356 except: # re-raises
1357 other.close()
1358 raise
1343 other = peer(repo, opts, dest)
1344 try:
1345 outgoing = discovery.findcommonoutgoing(
1346 repo, other, revs, force=opts.get(b'force')
1347 )
1348 o = outgoing.missing
1349 out.update(o)
1350 if not o:
1351 scmutil.nochangesfound(repo.ui, repo, outgoing.excluded)
1352 others.append(other)
1353 except: # re-raises
1354 other.close()
1355 raise
1356 # make sure this is ordered by revision number
1357 outgoing_revs = list(out)
1358 cl = repo.changelog
1359 outgoing_revs.sort(key=cl.rev)
1360 return outgoing_revs, others
1359 1361
1360 1362
1361 def _outgoing_recurse(ui, repo, dest, opts):
1363 def _outgoing_recurse(ui, repo, dests, opts):
1362 1364 ret = 1
1363 1365 if opts.get(b'subrepos'):
1364 1366 ctx = repo[None]
1365 1367 for subpath in sorted(ctx.substate):
1366 1368 sub = ctx.sub(subpath)
1367 ret = min(ret, sub.outgoing(ui, dest, opts))
1369 ret = min(ret, sub.outgoing(ui, dests, opts))
1368 1370 return ret
1369 1371
1370 1372
@@ -1391,10 +1393,10 b' def _outgoing_filter(repo, revs, opts):'
1391 1393 yield n
1392 1394
1393 1395
1394 def outgoing(ui, repo, dest, opts, subpath=None):
1396 def outgoing(ui, repo, dests, opts, subpath=None):
1395 1397 if opts.get(b'graph'):
1396 1398 logcmdutil.checkunsupportedgraphflags([], opts)
1397 o, other = _outgoing(ui, repo, dest, opts, subpath=subpath)
1399 o, others = _outgoing(ui, repo, dests, opts, subpath=subpath)
1398 1400 ret = 1
1399 1401 try:
1400 1402 if o:
@@ -1415,11 +1417,13 b' def outgoing(ui, repo, dest, opts, subpa'
1415 1417 for n in _outgoing_filter(repo, o, opts):
1416 1418 displayer.show(repo[n])
1417 1419 displayer.close()
1418 cmdutil.outgoinghooks(ui, repo, other, opts, o)
1419 ret = min(ret, _outgoing_recurse(ui, repo, dest, opts))
1420 for oth in others:
1421 cmdutil.outgoinghooks(ui, repo, oth, opts, o)
1422 ret = min(ret, _outgoing_recurse(ui, repo, dests, opts))
1420 1423 return ret # exit code is zero since we found outgoing changes
1421 1424 finally:
1422 other.close()
1425 for oth in others:
1426 oth.close()
1423 1427
1424 1428
1425 1429 def verify(repo, level=None):
@@ -130,6 +130,46 b' push'
130 130 $ cp -R ./branch-E ./branch-E-push
131 131 $ cp -R ./branch-G ./branch-G-push
132 132 $ cp -R ./branch-H ./branch-H-push
133 $ hg out -G -R test-repo-bare ./branch-E-push ./branch-G-push ./branch-H-push
134 comparing with ./branch-E-push
135 searching for changes
136 comparing with ./branch-G-push
137 searching for changes
138 comparing with ./branch-H-push
139 searching for changes
140 o changeset: 7:40faebb2ec45
141 | tag: tip
142 | parent: 2:f838bfaca5c7
143 | user: test
144 | date: Thu Jan 01 00:00:00 1970 +0000
145 | summary: H
146 |
147 | o changeset: 6:c521a06b234b
148 | | user: test
149 | | date: Thu Jan 01 00:00:00 1970 +0000
150 | | summary: G
151 | |
152 | o changeset: 5:2f3a4c5c1417
153 | parent: 1:27547f69f254
154 | user: test
155 | date: Thu Jan 01 00:00:00 1970 +0000
156 | summary: F
157 |
158 | o changeset: 4:a603bfb5a83e
159 | | user: test
160 | | date: Thu Jan 01 00:00:00 1970 +0000
161 | | summary: E
162 | |
163 | o changeset: 3:b3325c91a4d9
164 |/ user: test
165 | date: Thu Jan 01 00:00:00 1970 +0000
166 | summary: D
167 |
168 o changeset: 2:f838bfaca5c7
169 user: test
170 date: Thu Jan 01 00:00:00 1970 +0000
171 summary: C
172
133 173 $ hg push --force -R test-repo-bare ./branch-E-push ./branch-G-push ./branch-H-push
134 174 pushing to ./branch-E-push
135 175 searching for changes
@@ -291,6 +331,26 b' We only push a specific branch with --re'
291 331 $ cp -R ./branch-E ./branch-E-push
292 332 $ cp -R ./branch-G ./branch-G-push
293 333 $ cp -R ./branch-H ./branch-H-push
334 $ hg out -G -R test-repo-bare ./branch-E-push ./branch-G-push ./branch-H-push --rev default
335 comparing with ./branch-E-push
336 searching for changes
337 comparing with ./branch-G-push
338 searching for changes
339 comparing with ./branch-H-push
340 searching for changes
341 no changes found
342 o changeset: 7:40faebb2ec45
343 | tag: tip
344 | parent: 2:f838bfaca5c7
345 | user: test
346 | date: Thu Jan 01 00:00:00 1970 +0000
347 | summary: H
348 |
349 o changeset: 2:f838bfaca5c7
350 user: test
351 date: Thu Jan 01 00:00:00 1970 +0000
352 summary: C
353
294 354 $ hg push --force -R test-repo-bare ./branch-E-push ./branch-G-push ./branch-H-push --rev default
295 355 pushing to ./branch-E-push
296 356 searching for changes
@@ -349,6 +409,26 b' Same push, but the first one is a no-op'
349 409 $ cp -R ./branch-E ./branch-E-push
350 410 $ cp -R ./branch-G ./branch-G-push
351 411 $ cp -R ./branch-H ./branch-H-push
412 $ hg out -G -R test-repo-bare ./branch-G-push ./branch-H-push ./branch-E-push --rev default
413 comparing with ./branch-G-push
414 searching for changes
415 comparing with ./branch-H-push
416 searching for changes
417 no changes found
418 comparing with ./branch-E-push
419 searching for changes
420 o changeset: 7:40faebb2ec45
421 | tag: tip
422 | parent: 2:f838bfaca5c7
423 | user: test
424 | date: Thu Jan 01 00:00:00 1970 +0000
425 | summary: H
426 |
427 o changeset: 2:f838bfaca5c7
428 user: test
429 date: Thu Jan 01 00:00:00 1970 +0000
430 summary: C
431
352 432 $ hg push --force -R test-repo-bare ./branch-G-push ./branch-H-push ./branch-E-push --rev default
353 433 pushing to ./branch-G-push
354 434 searching for changes
General Comments 0
You need to be logged in to leave comments. Login now