Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/commands.py @ 50868:fb0f07c64304
pull: avoid referencing a variable before it is initialized
If `urlutil.get_pull_paths()` somehow yields nothing, the reference after the
loop appears to be a problem. I noticed this because PyCharm flagged (and still
flags) the initialization of this inside the loop as somehow unused. I'm not
sure why 1 isn't returned directly where it is set to the result of
`postincoming()`, but maybe the code is structured this way in anticipation of
future work.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Sun, 20 Aug 2023 01:49:48 -0400 |
parents | 7ef29f8b723d |
children | e674941ad4eb |
comparison
equal
deleted
inserted
replaced
50867:7ef29f8b723d | 50868:fb0f07c64304 |
---|---|
5456 if ui.configbool(b'commands', b'update.requiredest') and opts.get('update'): | 5456 if ui.configbool(b'commands', b'update.requiredest') and opts.get('update'): |
5457 msg = _(b'update destination required by configuration') | 5457 msg = _(b'update destination required by configuration') |
5458 hint = _(b'use hg pull followed by hg update DEST') | 5458 hint = _(b'use hg pull followed by hg update DEST') |
5459 raise error.InputError(msg, hint=hint) | 5459 raise error.InputError(msg, hint=hint) |
5460 | 5460 |
5461 update_conflict = None | |
5462 | |
5461 for path in urlutil.get_pull_paths(repo, ui, sources): | 5463 for path in urlutil.get_pull_paths(repo, ui, sources): |
5462 ui.status(_(b'pulling from %s\n') % urlutil.hidepassword(path.loc)) | 5464 ui.status(_(b'pulling from %s\n') % urlutil.hidepassword(path.loc)) |
5463 ui.flush() | 5465 ui.flush() |
5464 other = hg.peer( | 5466 other = hg.peer( |
5465 repo, | 5467 repo, |