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

Commitdc81244

Browse files
committed
chore(remote): added debug helper
Write debug files for stderr output as well as FETCH_INFO intothe git repository, e.g. into `.git/`Help with#301
1 parentcfc70fe commitdc81244

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

‎git/remote.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ class Remote(LazyMixin, Iterable):
346346
NOTE: When querying configuration, the configuration accessor will be cached
347347
to speed up subsequent accesses."""
348348

349-
__slots__= ("repo","name","_config_reader")
349+
__slots__= ("repo","name","_config_reader","fetch_no")
350350
_id_attribute_="name"
351351

352352
def__init__(self,repo,name):
@@ -356,6 +356,7 @@ def __init__(self, repo, name):
356356
:param name: the name of the remote, i.e. 'origin'"""
357357
self.repo=repo
358358
self.name=name
359+
self.fetch_no=0
359360

360361
ifos.name=='nt':
361362
# some oddity: on windows, python 2.5, it for some reason does not realize
@@ -551,6 +552,9 @@ def _get_fetch_info_from_stderr(self, proc, progress):
551552
progress_handler=progress.new_message_handler()
552553

553554
defmy_progress_handler(line):
555+
stderr_fetch=open(join(self.repo.git_dir,'%03i_debug_git-python_stderr'%self.fetch_no),'ab')
556+
stderr_fetch.write((line+'\n').encode(defenc))
557+
stderr_fetch.close()
554558
forplineinprogress_handler(line):
555559
ifline.startswith('fatal:')orline.startswith('error:'):
556560
raiseGitCommandError(("Error when fetching: %s"%line,),2)
@@ -567,6 +571,11 @@ def my_progress_handler(line):
567571
# We are only interested in stderr here ...
568572
handle_process_output(proc,None,my_progress_handler,finalize_process)
569573

574+
importshutil
575+
shutil.copyfile(join(self.repo.git_dir,'FETCH_HEAD'),join(self.repo.git_dir,
576+
'%03i_debug_git-python_FETCH_HEAD'%self.fetch_no))
577+
self.fetch_no+=1
578+
570579
# read head information
571580
fp=open(join(self.repo.git_dir,'FETCH_HEAD'),'rb')
572581
fetch_head_info= [l.decode(defenc)forlinfp.readlines()]

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp