Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6e56b3c

Browse files
committed
daemon,#525: simplify exception handling
1 parentd78433b commit6e56b3c

File tree

1 file changed

+5
-33
lines changed

1 file changed

+5
-33
lines changed

‎git/test/lib/helper.py

Lines changed: 5 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
fromunittestimportTestCase
1616

1717
fromgit.compatimportstring_types,is_win
18-
fromgit.utilimportrmtree,HIDE_WINDOWS_KNOWN_ERRORS
18+
fromgit.utilimportrmtree
1919

2020
importos.pathasosp
2121

@@ -214,7 +214,7 @@ def case(self, rw_repo, rw_remote_repo)
214214
See working dir info in with_rw_repo
215215
:note: We attempt to launch our own invocation of git-daemon, which will be shutdown at the end of the test.
216216
"""
217-
fromgitimportGit,Remote,GitCommandError
217+
fromgitimportGit,Remote
218218

219219
assertisinstance(working_tree_ref,string_types),"Decorator requires ref name for working tree checkout"
220220

@@ -273,37 +273,8 @@ def remote_repo_creator(self):
273273
raiseAssertionError(ex,msg)
274274
# END make assertion
275275
else:
276-
# try to list remotes to diagnoes whether the server is up
277-
try:
278-
rw_repo.git.ls_remote(d_remote)
279-
exceptGitCommandErrorase:
280-
# We assume in good faith that we didn't start the daemon - but make sure we kill it anyway
281-
# Of course we expect it to work here already, but maybe there are timing constraints
282-
# on some platforms ?
283-
try:
284-
gd.proc.terminate()
285-
exceptExceptionasex:
286-
log.debug("Ignoring %r while terminating proc after %r.",ex,e)
287-
log.warning('git(%s) ls-remote failed due to:%s',
288-
rw_repo.git_dir,e)
289-
ifis_win:
290-
msg=textwrap.dedent("""
291-
MINGW yet has problems with paths, and `git-daemon.exe` must be in PATH
292-
(look into .\Git\mingw64\libexec\git-core\);
293-
CYGWIN has no daemon, but if one exists, it gets along fine (has also paths problems)
294-
Anyhow, alternatively try starting `git-daemon` manually:""")
295-
else:
296-
msg="Please try starting `git-daemon` manually:"
297-
298-
msg+=textwrap.dedent("""
299-
git daemon --enable=receive-pack '%s'
300-
You can also run the daemon on a different port by passing --port=<port>"
301-
and setting the environment variable GIT_PYTHON_TEST_GIT_DAEMON_PORT to <port>
302-
"""%base_path)
303-
fromunittestimportSkipTest
304-
raiseSkipTest(msg)ifHIDE_WINDOWS_KNOWN_ERRORSelseAssertionError(e,msg)
305-
# END make assertion
306-
# END catch ls remote error
276+
# Try listing remotes, to diagnose whether the daemon is up.
277+
rw_repo.git.ls_remote(d_remote)
307278

308279
# adjust working dir
309280
prev_cwd=os.getcwd()
@@ -321,6 +292,7 @@ def remote_repo_creator(self):
321292

322293
finally:
323294
try:
295+
log.debug("Killing git-daemon...")
324296
gd.proc.kill()
325297
except:
326298
## Either it has died (and we're here), or it won't die, again here...

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp