diff options
author | Sebastian Thiel <byronimo@gmail.com> | 2015-01-16 11:58:15 +0100 |
---|---|---|
committer | Sebastian Thiel <byronimo@gmail.com> | 2015-01-16 11:58:15 +0100 |
commit | 34802014ca0c9546e73292260aab5e4017ffcd9a (patch) | |
tree | ce55a3f4b91f0c3796e56fcbc32cb6fd6735f8a7 /git/remote.py | |
parent | a9a5414300a245b6e93ea4f39fbca792c3ec753f (diff) | |
download | gitpython-34802014ca0c9546e73292260aab5e4017ffcd9a.tar.gz |
Added debug code to keep lines fed into progress handler and the contents of FETCH_HEAD.
This data will be written into the git-repository itself, prefixed with the
number of the operation.
Thus, a test-run with exactly one fetch operation would look like this afterwards:
ls -l .git
total 96
-----> -rw-r--r-- 1 byron staff 141B Jan 16 11:54 000_debug_git-python_FETCH_HEAD <-----
-----> -rw-r--r-- 1 byron staff 180B Jan 16 11:54 000_debug_git-python_stderr <-----
-rw-r--r-- 1 byron staff 487B Jan 16 11:54 FETCH_HEAD
-rw-r--r-- 1 byron staff 22B Jan 16 11:54 HEAD
-rw-r--r-- 1 byron staff 41B Jan 16 11:54 ORIG_HEAD
drwxr-xr-x 2 byron staff 68B Jan 16 11:54 branches/
-rw-r--r-- 1 byron staff 560B Jan 16 11:54 config
-rw-r--r-- 1 byron staff 73B Jan 16 11:54 description
drwxr-xr-x 11 byron staff 374B Jan 16 11:54 hooks/
-rw-r--r-- 1 byron staff 13K Jan 16 11:54 index
drwxr-xr-x 3 byron staff 102B Jan 16 11:54 info/
drwxr-xr-x 4 byron staff 136B Jan 16 11:54 logs/
drwxr-xr-x 12 byron staff 408B Jan 16 11:54 objects/
-rw-r--r-- 1 byron staff 1.2K Jan 16 11:54 packed-refs
drwxr-xr-x 5 byron staff 170B Jan 16 11:54 refs/
[ci skip]
Diffstat (limited to 'git/remote.py')
-rw-r--r-- | git/remote.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/git/remote.py b/git/remote.py index 541f3c9e..216858c0 100644 --- a/git/remote.py +++ b/git/remote.py @@ -338,7 +338,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): @@ -348,6 +348,7 @@ class Remote(LazyMixin, Iterable): :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 @@ -523,7 +524,9 @@ class Remote(LazyMixin, Iterable): progress_handler = progress.new_message_handler() + stderr_fetch = open(join(self.repo.git_dir, '%03i_debug_git-python_stderr' % self.fetch_no), 'wb') def my_progress_handler(line): + stderr_fetch.write((line + '\n').encode(defenc)) for pline in progress_handler(line): if line.startswith('fatal:'): raise GitCommandError(("Error when fetching: %s" % line,), 2) @@ -539,8 +542,12 @@ class Remote(LazyMixin, Iterable): # We are only interested in stderr here ... handle_process_output(proc, None, my_progress_handler, finalize_process) + stderr_fetch.close() # read head information + 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 fp = open(join(self.repo.git_dir, 'FETCH_HEAD'), 'rb') fetch_head_info = [l.decode(defenc) for l in fp.readlines()] fp.close() |