Skip to content

Commit 92a42c5

Browse files
committed
Fix git svn init command
1 parent fa38c49 commit 92a42c5

File tree

1 file changed

+32
-21
lines changed

1 file changed

+32
-21
lines changed

src/source_repo/svn.py

Lines changed: 32 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,33 @@ def _build_cli_commands(ctx: Context) -> dict:
156156
arg_repo_url = [repo_url]
157157

158158
# svn commands
159-
cmd_svn_info = ["svn", "info"] + arg_svn_non_interactive + arg_repo_url
159+
cmd_svn_info = ["svn", "info"] + arg_repo_url
160+
161+
162+
# Skip TLS verification, if needed
163+
if disable_tls_verification:
164+
165+
# This prompt only be required very rarely, ex. once per:
166+
# Deployment of the repo-converter container, ex. the ~/.subversion/auth/svn.ssl.server directory inside the container is empty, as the root volume is not retained
167+
# New Subversion server
168+
# New TLS cert on a server
169+
# However, it needs to be checked for on every job
170+
expect = []
171+
expect.append(
172+
("(R)eject, accept (t)emporarily or accept (p)ermanently?", "p"),
173+
)
174+
ctx.job["config"].update(
175+
{
176+
"expect": expect
177+
}
178+
)
179+
180+
# Trusting the TLS cert requires interactive mode
181+
else:
182+
183+
# If not needing to trust the TLS cert, then use non-interactive mode
184+
cmd_svn_info += arg_svn_non_interactive
185+
160186

161187
# Common git command args
162188
arg_git = ["git", "-C", local_repo_path]
@@ -166,12 +192,14 @@ def _build_cli_commands(ctx: Context) -> dict:
166192

167193
arg_git_svn = arg_git + ["svn"]
168194

195+
169196
# git commands
170197
cmd_git_default_branch = arg_git + ["symbolic-ref", "HEAD", f"refs/heads/{git_default_branch}"]
171198
cmd_git_garbage_collection = arg_git + ["gc"]
172199
cmd_git_svn_fetch = arg_git_svn + ["fetch", "--quiet"]
173200
cmd_git_svn_init = arg_git_svn + ["init"] + arg_repo_url
174201

202+
175203
# Add authentication, if provided
176204
if username:
177205
arg_username = ["--username", username]
@@ -183,25 +211,8 @@ def _build_cli_commands(ctx: Context) -> dict:
183211
arg_password = ["--password", password]
184212
cmd_svn_info += arg_password
185213

186-
# Skip TLS verification, if needed
187-
if disable_tls_verification:
188214

189-
# This prompt only be required very rarely, ex. once per:
190-
# Deployment of the repo-converter container, ex. the ~/.subversion/auth/svn.ssl.server directory inside the container is empty, as the root volume is not retained
191-
# New Subversion server
192-
# New TLS cert on a server
193-
# However, it needs to be checked for on every job
194-
expect = []
195-
expect.append(
196-
("(R)eject, accept (t)emporarily or accept (p)ermanently?", "p"),
197-
)
198-
ctx.job["config"].update(
199-
{
200-
"expect": expect
201-
}
202-
)
203-
204-
# git svn commands
215+
## git svn commands
205216
if layout:
206217
cmd_git_svn_init += ["--stdlayout"]
207218
# Warn the user if they provided an invalid value for the layout
@@ -227,6 +238,7 @@ def _build_cli_commands(ctx: Context) -> dict:
227238
for branch in branches:
228239
cmd_git_svn_init += ["--branches", branch]
229240

241+
230242
return {
231243
'cmd_git_default_branch': cmd_git_default_branch,
232244
'cmd_git_garbage_collection': cmd_git_garbage_collection,
@@ -518,10 +530,9 @@ def _initialize_git_repo(ctx: Context, commands: dict) -> None:
518530

519531
# Get config values
520532
job_config = ctx.job.get("config",{})
521-
local_repo_path = job_config.get("local_repo_path")
522533
bare_clone = job_config.get("bare_clone")
534+
local_repo_path = job_config.get("local_repo_path")
523535
password = job_config.get("password")
524-
repo_key = job_config.get("repo_key")
525536
cmd_git_svn_init = commands["cmd_git_svn_init"]
526537

527538
# If the directory does exist, then it failed the validation check, and needs to be destroyed and recreated

0 commit comments

Comments
 (0)