Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: gitpython-developers/GitPython
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 751cb2d
Choose a base ref
...
head repository: gitpython-developers/GitPython
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: dc81244
Choose a head ref
  • 1 commit
  • 1 file changed
  • 1 contributor

Commits on Jun 26, 2015

  1. chore(remote): added debug helper

    Write debug files for stderr output as well as FETCH_INFO into
    the git repository, e.g. into `.git/`
    
    Help with #301
    Byron committed Jun 26, 2015
    Copy the full SHA
    dc81244 View commit details
Showing with 10 additions and 1 deletion.
  1. +10 −1 git/remote.py
11 changes: 10 additions & 1 deletion git/remote.py
Original file line number Diff line number Diff line change
@@ -346,7 +346,7 @@ class Remote(LazyMixin, Iterable):
NOTE: When querying configuration, the configuration accessor will be cached
to speed up subsequent accesses."""

__slots__ = ("repo", "name", "_config_reader")
__slots__ = ("repo", "name", "_config_reader", "fetch_no")
_id_attribute_ = "name"

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

if os.name == 'nt':
# 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):
progress_handler = progress.new_message_handler()

def my_progress_handler(line):
stderr_fetch = open(join(self.repo.git_dir, '%03i_debug_git-python_stderr' % self.fetch_no), 'ab')
stderr_fetch.write((line + '\n').encode(defenc))
stderr_fetch.close()
for pline in progress_handler(line):
if line.startswith('fatal:') or line.startswith('error:'):
raise GitCommandError(("Error when fetching: %s" % line,), 2)
@@ -567,6 +571,11 @@ def my_progress_handler(line):
# We are only interested in stderr here ...
handle_process_output(proc, None, my_progress_handler, finalize_process)

import shutil
shutil.copyfile(join(self.repo.git_dir, 'FETCH_HEAD'), join(self.repo.git_dir,
'%03i_debug_git-python_FETCH_HEAD' % self.fetch_no))
self.fetch_no += 1

# read head information
fp = open(join(self.repo.git_dir, 'FETCH_HEAD'), 'rb')
fetch_head_info = [l.decode(defenc) for l in fp.readlines()]