ssh: move all ssh logic to a common place

We had ssh logic sprinkled between two git modules, and neither was
quite the right home for it.  This largely moves the logic as-is to
its new home.  We'll leave major refactoring to followup commits.

Bug: https://crbug.com/gerrit/12389
Change-Id: I300a8f7dba74f2bd132232a5eb1e856a8490e0e9
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/305483
Reviewed-by: Chris Mcdonald <cjmcdonald@google.com>
Tested-by: Mike Frysinger <vapier@google.com>
This commit is contained in:
Mike Frysinger
2021-05-05 15:53:03 -04:00
parent 8e768eaaa7
commit 5291eafa41
6 changed files with 320 additions and 275 deletions

View File

@ -39,7 +39,7 @@ from color import SetDefaultColoring
import event_log
from repo_trace import SetTrace
from git_command import user_agent
from git_config import init_ssh, close_ssh, RepoConfig
from git_config import RepoConfig
from git_trace2_event_log import EventLog
from command import InteractiveCommand
from command import MirrorSafeCommand
@ -56,6 +56,7 @@ from error import RepoChangedException
import gitc_utils
from manifest_xml import GitcClient, RepoClient
from pager import RunPager, TerminatePager
import ssh
from wrapper import WrapperPath, Wrapper
from subcmds import all_commands
@ -592,7 +593,7 @@ def _Main(argv):
repo = _Repo(opt.repodir)
try:
try:
init_ssh()
ssh.init()
init_http()
name, gopts, argv = repo._ParseArgs(argv)
run = lambda: repo._Run(name, gopts, argv) or 0
@ -604,7 +605,7 @@ def _Main(argv):
else:
result = run()
finally:
close_ssh()
ssh.close()
except KeyboardInterrupt:
print('aborted by user', file=sys.stderr)
result = 1