Mercurial > public > mercurial-scm > hg
comparison mercurial/commands.py @ 50847:65e2cb23294e
summary: migrate `opts` to native kwargs
This has the added benefit of unconfusing PyCharm- it thought `opts` in the
nested functions were str based for some reason.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Sun, 20 Aug 2023 02:10:51 -0400 |
parents | fdf97ae05165 |
children | fa675fd648a3 |
comparison
equal
deleted
inserted
replaced
50846:fdf97ae05165 | 50847:65e2cb23294e |
---|---|
7113 incoming and outgoing changes. This can be time-consuming. | 7113 incoming and outgoing changes. This can be time-consuming. |
7114 | 7114 |
7115 Returns 0 on success. | 7115 Returns 0 on success. |
7116 """ | 7116 """ |
7117 | 7117 |
7118 opts = pycompat.byteskwargs(opts) | |
7119 ui.pager(b'summary') | 7118 ui.pager(b'summary') |
7120 ctx = repo[None] | 7119 ctx = repo[None] |
7121 parents = ctx.parents() | 7120 parents = ctx.parents() |
7122 pnode = parents[0].node() | 7121 pnode = parents[0].node() |
7123 marks = [] | 7122 marks = [] |
7302 if numtrouble > 0: | 7301 if numtrouble > 0: |
7303 ui.status(troublemsg[trouble] % numtrouble + b"\n") | 7302 ui.status(troublemsg[trouble] % numtrouble + b"\n") |
7304 | 7303 |
7305 cmdutil.summaryhooks(ui, repo) | 7304 cmdutil.summaryhooks(ui, repo) |
7306 | 7305 |
7307 if opts.get(b'remote'): | 7306 if opts.get('remote'): |
7308 needsincoming, needsoutgoing = True, True | 7307 needsincoming, needsoutgoing = True, True |
7309 else: | 7308 else: |
7310 needsincoming, needsoutgoing = False, False | 7309 needsincoming, needsoutgoing = False, False |
7311 for i, o in cmdutil.summaryremotehooks(ui, repo, opts, None): | 7310 for i, o in cmdutil.summaryremotehooks( |
7311 ui, repo, pycompat.byteskwargs(opts), None | |
7312 ): | |
7312 if i: | 7313 if i: |
7313 needsincoming = True | 7314 needsincoming = True |
7314 if o: | 7315 if o: |
7315 needsoutgoing = True | 7316 needsoutgoing = True |
7316 if not needsincoming and not needsoutgoing: | 7317 if not needsincoming and not needsoutgoing: |
7323 path = urlutil.get_unique_pull_path_obj(b'summary', ui, b'default') | 7324 path = urlutil.get_unique_pull_path_obj(b'summary', ui, b'default') |
7324 sbranch = path.branch | 7325 sbranch = path.branch |
7325 try: | 7326 try: |
7326 other = hg.peer(repo, {}, path) | 7327 other = hg.peer(repo, {}, path) |
7327 except error.RepoError: | 7328 except error.RepoError: |
7328 if opts.get(b'remote'): | 7329 if opts.get('remote'): |
7329 raise | 7330 raise |
7330 return path.loc, sbranch, None, None, None | 7331 return path.loc, sbranch, None, None, None |
7331 branches = (path.branch, []) | 7332 branches = (path.branch, []) |
7332 revs, checkout = hg.addbranchrevs(repo, other, branches, None) | 7333 revs, checkout = hg.addbranchrevs(repo, other, branches, None) |
7333 if revs: | 7334 if revs: |
7362 revs, checkout = hg.addbranchrevs(repo, repo, (dbranch, []), None) | 7363 revs, checkout = hg.addbranchrevs(repo, repo, (dbranch, []), None) |
7363 if source != dest: | 7364 if source != dest: |
7364 try: | 7365 try: |
7365 dother = hg.peer(repo, {}, path if path is not None else dest) | 7366 dother = hg.peer(repo, {}, path if path is not None else dest) |
7366 except error.RepoError: | 7367 except error.RepoError: |
7367 if opts.get(b'remote'): | 7368 if opts.get('remote'): |
7368 raise | 7369 raise |
7369 return dest, dbranch, None, None | 7370 return dest, dbranch, None, None |
7370 ui.debug(b'comparing with %s\n' % urlutil.hidepassword(dest)) | 7371 ui.debug(b'comparing with %s\n' % urlutil.hidepassword(dest)) |
7371 elif sother is None: | 7372 elif sother is None: |
7372 # there is no explicit destination peer, but source one is invalid | 7373 # there is no explicit destination peer, but source one is invalid |
7388 if needsoutgoing: | 7389 if needsoutgoing: |
7389 dest, dbranch, dother, outgoing = getoutgoing() | 7390 dest, dbranch, dother, outgoing = getoutgoing() |
7390 else: | 7391 else: |
7391 dest = dbranch = dother = outgoing = None | 7392 dest = dbranch = dother = outgoing = None |
7392 | 7393 |
7393 if opts.get(b'remote'): | 7394 if opts.get('remote'): |
7394 # Help pytype. --remote sets both `needsincoming` and `needsoutgoing`. | 7395 # Help pytype. --remote sets both `needsincoming` and `needsoutgoing`. |
7395 # The former always sets `sother` (or raises an exception if it can't); | 7396 # The former always sets `sother` (or raises an exception if it can't); |
7396 # the latter always sets `outgoing`. | 7397 # the latter always sets `outgoing`. |
7397 assert sother is not None | 7398 assert sother is not None |
7398 assert outgoing is not None | 7399 assert outgoing is not None |
7419 ui.status(_(b'remote: (synced)\n')) | 7420 ui.status(_(b'remote: (synced)\n')) |
7420 | 7421 |
7421 cmdutil.summaryremotehooks( | 7422 cmdutil.summaryremotehooks( |
7422 ui, | 7423 ui, |
7423 repo, | 7424 repo, |
7424 opts, | 7425 pycompat.byteskwargs(opts), |
7425 ( | 7426 ( |
7426 (source, sbranch, sother, commoninc), | 7427 (source, sbranch, sother, commoninc), |
7427 (dest, dbranch, dother, outgoing), | 7428 (dest, dbranch, dother, outgoing), |
7428 ), | 7429 ), |
7429 ) | 7430 ) |