mirror of
https://gerrit.googlesource.com/git-repo
synced 2026-11-15 00:37:13 +00:00
style: use import subcmds everywhere
Align with Google style guides and `import subcmds` as a module rather than import symbols out of it. Change-Id: If19503b977798f8a30e5d54cea9cd63a5c7b81d1 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/654820 Commit-Queue: Mike Frysinger <vapier@google.com> Reviewed-by: Brian Gan <brgan@google.com> Tested-by: Mike Frysinger <vapier@google.com>
This commit is contained in:
1 parent
eb668be30d
commit
5b04e6e7c5
4 files changed
+11
-12
No files matched your search
@@ -44,7 +44,6 @@ per-file-ignores =
|
||||
tests/e2e/test_partial_clone.py: IMR241,
|
||||
tests/e2e/test_sync_modes.py: IMR241,
|
||||
tests/e2e/test_workflows.py: IMR241,
|
||||
tests/test_error.py: IMR241,
|
||||
tests/test_main.py: IMR241,
|
||||
tests/test_subcmds_sync.py: IMR241,
|
||||
extend-ignore =
|
||||
|
||||
@@ -53,7 +53,7 @@ import git_trace2_event_log
|
||||
import manifest_xml
|
||||
import pager
|
||||
import repo_trace
|
||||
from subcmds import all_commands
|
||||
import subcmds
|
||||
from subcmds.version import Version
|
||||
import wrapper
|
||||
|
||||
@@ -181,7 +181,7 @@ global_options.add_option(
|
||||
class _Repo:
|
||||
def __init__(self, repodir):
|
||||
self.repodir = repodir
|
||||
self.commands = all_commands
|
||||
self.commands = subcmds.all_commands
|
||||
|
||||
def _PrintHelp(self, short: bool = False, all_commands: bool = False):
|
||||
"""Show --help screen."""
|
||||
|
||||
+7
-7
@@ -20,7 +20,7 @@ import color
|
||||
from command import MirrorSafeCommand
|
||||
from command import PagedCommand
|
||||
import error
|
||||
from subcmds import all_commands
|
||||
import subcmds
|
||||
import wrapper
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ Displays detailed usage information about a command.
|
||||
fmt = " %%-%ds %%s" % maxlen
|
||||
|
||||
for name in commandNames:
|
||||
command = all_commands[name]()
|
||||
command = subcmds.all_commands[name]()
|
||||
try:
|
||||
summary = command.helpSummary.strip()
|
||||
except AttributeError:
|
||||
@@ -59,7 +59,7 @@ Displays detailed usage information about a command.
|
||||
|
||||
def PrintAllCommandsBody(self):
|
||||
print("The complete list of recognized repo commands is:")
|
||||
commandNames = sorted(all_commands)
|
||||
commandNames = sorted(subcmds.all_commands)
|
||||
self._PrintCommands(commandNames)
|
||||
print(
|
||||
"See 'repo help <command>' for more information on a "
|
||||
@@ -75,7 +75,7 @@ Displays detailed usage information about a command.
|
||||
print("The most commonly used repo commands are:")
|
||||
|
||||
commandNames = sorted(
|
||||
name for name, command in all_commands.items() if command.COMMON
|
||||
name for name, cmd in subcmds.all_commands.items() if cmd.COMMON
|
||||
)
|
||||
self._PrintCommands(commandNames)
|
||||
|
||||
@@ -146,8 +146,8 @@ Displays detailed usage information about a command.
|
||||
out._PrintSection("Description", "helpDescription")
|
||||
|
||||
def _PrintAllCommandHelp(self):
|
||||
for name in sorted(all_commands):
|
||||
cmd = all_commands[name](manifest=self.manifest)
|
||||
for name in sorted(subcmds.all_commands):
|
||||
cmd = subcmds.all_commands[name](manifest=self.manifest)
|
||||
self._PrintCommandHelp(cmd, header_prefix=f"[{name}] ")
|
||||
|
||||
def _Options(self, p):
|
||||
@@ -178,7 +178,7 @@ Displays detailed usage information about a command.
|
||||
name = args[0]
|
||||
|
||||
try:
|
||||
cmd = all_commands[name](manifest=self.manifest)
|
||||
cmd = subcmds.all_commands[name](manifest=self.manifest)
|
||||
except KeyError:
|
||||
print(
|
||||
"repo: '%s' is not a repo command." % name, file=sys.stderr
|
||||
|
||||
+2
-2
@@ -25,10 +25,10 @@ import error
|
||||
import fetch
|
||||
import git_command
|
||||
import project
|
||||
from subcmds import all_modules
|
||||
import subcmds
|
||||
|
||||
|
||||
_IMPORTS = all_modules + [
|
||||
_IMPORTS = subcmds.all_modules + [
|
||||
error,
|
||||
project,
|
||||
git_command,
|
||||
|
||||
Reference in new issue
Block a user