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

Commit0dd56ad

Browse files
committed
1)pump git-daemon stderr 2)nojoin pumps, 3)no submodules
1 parent3910abf commit0dd56ad

File tree

4 files changed

+29
-35
lines changed

4 files changed

+29
-35
lines changed

‎git/__init__.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,6 @@
1515
__version__='git'
1616

1717

18-
#{ Initialization
19-
def_init_externals():
20-
"""Initialize external projects by putting them into the path"""
21-
if__version__=='git':
22-
sys.path.insert(0,osp.join(osp.dirname(__file__),'ext','gitdb'))
23-
24-
try:
25-
importgitdb
26-
exceptImportError:
27-
raiseImportError("'gitdb' could not be found in your PYTHONPATH")
28-
# END verify import
29-
30-
#} END initialization
31-
32-
#################
33-
_init_externals()
34-
#################
35-
3618
#{ Imports
3719

3820
fromgit.configimportGitConfigParser# @NoMove @IgnorePep8

‎git/cmd.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
## @{
6262

6363
defhandle_process_output(process,stdout_handler,stderr_handler,
64-
finalizer=None,decode_streams=True):
64+
finalizer=None,decode_streams=True,nojoin=False):
6565
"""Registers for notifications to lean that process output is ready to read, and dispatches lines to
6666
the respective line handlers.
6767
This function returns once the finalizer returns
@@ -112,8 +112,9 @@ def pump_stream(cmdline, name, stream, is_decode, handler):
112112

113113
## FIXME: Why Join?? Will block if `stdin` needs feeding...
114114
#
115-
fortinthreads:
116-
t.join()
115+
ifnotnojoin:
116+
fortinthreads:
117+
t.join()
117118

118119
iffinalizer:
119120
returnfinalizer(process)
@@ -580,8 +581,9 @@ def execute(self, command,
580581
stdout_sink= (PIPE
581582
ifwith_stdout
582583
elsegetattr(subprocess,'DEVNULL',open(os.devnull,'wb')))
583-
log.debug("Popen(%s, cwd=%s, universal_newlines=%s, shell=%s)",
584-
command,cwd,universal_newlines,shell)
584+
importsubprocessassb
585+
log.debug("Popen(%s, cwd=%s, universal_newlines=%s, shell=%s,\n_active=%s)",
586+
command,cwd,universal_newlines,shell,sb._active)
585587
try:
586588
proc=Popen(command,
587589
env=env,

‎git/remote.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -686,14 +686,18 @@ def stdout_handler(line):
686686
# If an error happens, additional info is given which we parse below.
687687
pass
688688

689-
handle_process_output(proc,stdout_handler,progress_handler,finalizer=None,decode_streams=False)
689+
stdout,stderr=proc.communicate()
690+
forlinstderr.split('\n'):
691+
ifl:
692+
progress_handler(l)
690693
stderr_text=progress.error_linesand'\n'.join(progress.error_lines)or''
691-
try:
692-
proc.wait(stderr=stderr_text)
693-
exceptException:
694-
ifnotoutput:
695-
raise
696-
elifstderr_text:
694+
forlinstdout.split('\n'):
695+
stdout_handler(l)
696+
status=proc.proc.wait()
697+
ifstatusandnotoutput:
698+
raiseGitCommandError(getattr(proc,'args',''),status,stderr,stdout)
699+
else:
700+
ifstderr_text:
697701
log.warning("Error lines received while fetching: %s",stderr_text)
698702

699703
returnoutput

‎git/test/lib/helper.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ def git_daemon_launched(base_path, ip, port):
169169
'--enable=receive-pack',
170170
'--listen=%s'%ip,
171171
'--port=%s'%port,
172+
'--timeout=10',
172173
'--base-path=%s'%base_path,
173174
base_path]
174175
gd=Git().execute(daemon_cmd,as_process=True)
@@ -179,6 +180,9 @@ def git_daemon_launched(base_path, ip, port):
179180
port=port,
180181
base_path=base_path,
181182
as_process=True)
183+
fromgit.cmdimporthandle_process_output
184+
importfunctoolsasfnt
185+
handle_process_output(gd,fnt.partial(print,'GDout>>>'),fnt.partial(print,'GDerr>>>'),nojoin=True)
182186
# yes, I know ... fortunately, this is always going to work if sleep time is just large enough
183187
time.sleep(0.5* (1+is_win))
184188
exceptExceptionasex:
@@ -286,13 +290,15 @@ def remote_repo_creator(self):
286290
rw_repo.git.ls_remote(d_remote)
287291

288292
withcwd(rw_repo.working_dir):
293+
ok=False
289294
try:
290295
returnfunc(self,rw_repo,rw_daemon_repo)
291-
except:
292-
log.info("Keeping repos after failure:\n rw_repo_dir: %s\n rw_daemon_repo_dir: %s",
293-
rw_repo_dir,rw_daemon_repo_dir)
294-
rw_repo_dir=rw_daemon_repo_dir=None
295-
raise
296+
ok=True
297+
finally:
298+
ifnotok:
299+
log.info("Keeping repos after failure:\n rw_repo_dir: %s\n rw_daemon_repo_dir: %s",
300+
rw_repo_dir,rw_daemon_repo_dir)
301+
rw_repo_dir=rw_daemon_repo_dir=None
296302

297303
finally:
298304
rw_repo.git.clear_cache()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp