summaryrefslogtreecommitdiffstats
path: root/project.py
diff options
context:
space:
mode:
authorMike Frysinger <vapier@google.com>2021-05-05 19:44:35 -0400
committerMike Frysinger <vapier@google.com>2021-05-10 21:10:29 +0000
commit19e409c81863878d5d313fdc40b3975b98602454 (patch)
tree491d08dbc32c2e5e8acb33fcecff09a5a51613f9 /project.py
parent4a58100251624ddd37c3046611c110fb3077668d (diff)
downloadgit-repo-19e409c81863878d5d313fdc40b3975b98602454.tar.gz
ssh: move proxy usage to the sync subcommand
The only time we really need ssh proxies is when we want to run many connections and reuse them. That only happens when running sync. Every other command makes at most two connections, and even then it's only one or none. So the effort of setting up & tearing down ssh proxies isn't worth it most of the time. The big reason we want to move this logic to sync is that it's now using multiprocessing for parallel work. The current ssh proxy code is all based on threads, which means none of the logic is working correctly. The current ssh design makes it hard to fix when all of the state lives in the global/module scope. So the first step to fixing this is top move the setup & teardown to the one place that really needs it: sync. No other commands will use proxies anymore, just direct connections. Bug: https://crbug.com/gerrit/12389 Change-Id: Ibd351acdec39a87562b3013637c5df4ea34e03c6 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/305485 Reviewed-by: Chris Mcdonald <cjmcdonald@google.com> Tested-by: Mike Frysinger <vapier@google.com>
Diffstat (limited to 'project.py')
-rw-r--r--project.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/project.py b/project.py
index 7b5b56d4..37558061 100644
--- a/project.py
+++ b/project.py
@@ -1050,6 +1050,7 @@ class Project(object):
1050 retry_fetches=0, 1050 retry_fetches=0,
1051 prune=False, 1051 prune=False,
1052 submodules=False, 1052 submodules=False,
1053 ssh_proxy=None,
1053 clone_filter=None, 1054 clone_filter=None,
1054 partial_clone_exclude=set()): 1055 partial_clone_exclude=set()):
1055 """Perform only the network IO portion of the sync process. 1056 """Perform only the network IO portion of the sync process.
@@ -1143,6 +1144,7 @@ class Project(object):
1143 alt_dir=alt_dir, current_branch_only=current_branch_only, 1144 alt_dir=alt_dir, current_branch_only=current_branch_only,
1144 tags=tags, prune=prune, depth=depth, 1145 tags=tags, prune=prune, depth=depth,
1145 submodules=submodules, force_sync=force_sync, 1146 submodules=submodules, force_sync=force_sync,
1147 ssh_proxy=ssh_proxy,
1146 clone_filter=clone_filter, retry_fetches=retry_fetches): 1148 clone_filter=clone_filter, retry_fetches=retry_fetches):
1147 return False 1149 return False
1148 1150
@@ -1994,6 +1996,7 @@ class Project(object):
1994 prune=False, 1996 prune=False,
1995 depth=None, 1997 depth=None,
1996 submodules=False, 1998 submodules=False,
1999 ssh_proxy=None,
1997 force_sync=False, 2000 force_sync=False,
1998 clone_filter=None, 2001 clone_filter=None,
1999 retry_fetches=2, 2002 retry_fetches=2,
@@ -2041,16 +2044,14 @@ class Project(object):
2041 if not name: 2044 if not name:
2042 name = self.remote.name 2045 name = self.remote.name
2043 2046
2044 ssh_proxy = False
2045 remote = self.GetRemote(name) 2047 remote = self.GetRemote(name)
2046 if remote.PreConnectFetch(): 2048 if not remote.PreConnectFetch():
2047 ssh_proxy = True 2049 ssh_proxy = False
2048 2050
2049 if initial: 2051 if initial:
2050 if alt_dir and 'objects' == os.path.basename(alt_dir): 2052 if alt_dir and 'objects' == os.path.basename(alt_dir):
2051 ref_dir = os.path.dirname(alt_dir) 2053 ref_dir = os.path.dirname(alt_dir)
2052 packed_refs = os.path.join(self.gitdir, 'packed-refs') 2054 packed_refs = os.path.join(self.gitdir, 'packed-refs')
2053 remote = self.GetRemote(name)
2054 2055
2055 all_refs = self.bare_ref.all 2056 all_refs = self.bare_ref.all
2056 ids = set(all_refs.values()) 2057 ids = set(all_refs.values())
@@ -2238,7 +2239,7 @@ class Project(object):
2238 name=name, quiet=quiet, verbose=verbose, output_redir=output_redir, 2239 name=name, quiet=quiet, verbose=verbose, output_redir=output_redir,
2239 current_branch_only=current_branch_only and depth, 2240 current_branch_only=current_branch_only and depth,
2240 initial=False, alt_dir=alt_dir, 2241 initial=False, alt_dir=alt_dir,
2241 depth=None, clone_filter=clone_filter) 2242 depth=None, ssh_proxy=ssh_proxy, clone_filter=clone_filter)
2242 2243
2243 return ok 2244 return ok
2244 2245