From 307b10aa03957603a299861ebb08f0dab7a809c1 Mon Sep 17 00:00:00 2001 From: Andreas Maier Date: Fri, 21 Oct 2016 11:11:22 +0200 Subject: [PATCH 01/15] Fixes to support Python 2.6 again. Details: - Added Python 2.6 again to .travis.yml (it was removed in commit 4486bcb). - Replaced the use of dictionary comprehensions in `git/cmd.py` around line 800 with the code before that change (in commit 25a2ebf). Reason: dict comprehensions were introduced only in Python 2.7. - Changed the import source for `SkipTest` and `skipIf` from `unittest.case` to first trying `unittest` and upon ImportError from `unittest2`. This was done in `git/util.py` and in several testcases. Reason: `SkipTest` and `skipIf` were introduced to unittest only in Python 2.7, and `unittest2` is a backport of `unittest` additions to Python 2.6. - In git/test/lib/helper.py, fixed the definition of `assertRaisesRegex` to work on py26. - For Python 2.6, added the `unittest2` dependency to `requirements.txt` and changed `.travis.yml` to install `unittest2`. Because git/util.py uses SkipTest from unittest/unittest2, the dependency could not be added to `test-requirements.txt`. - Fixed an assertion in `git/test/test_index.py` to also allow a Python 2.6 specific exception message. - In `is_cygwin_git()` in `git/util.py`, replaced `check_output()` with `Popen()`. It was added in Python 2.7. - Enabled Python 2.6 for Windows: - Added Python 2.6 for MINGW in .appveyor.yml. - When defining `PROC_CREATIONFLAGS` in `git/cmd.py`, made use of certain win32 and subprocess flags that were introduced in Python 2.7, dependent on whether we run on Python 2.7 or higher. - In `AutoInterrupt.__del__()` in `git/cmd.py`, allowed for `os` not having `kill()`. `os.kill()` was added for Windows in Python 2.7 (For Linux, it existed in Python 2.6 already). --- .appveyor.yml | 3 +++ .travis.yml | 5 +++++ git/cmd.py | 14 +++++++++----- git/objects/submodule/base.py | 5 ++++- git/test/lib/helper.py | 17 ++++++++++++----- git/test/test_base.py | 6 ++++-- git/test/test_fun.py | 5 ++++- git/test/test_index.py | 10 +++++++--- git/test/test_remote.py | 5 ++++- git/test/test_repo.py | 6 ++++-- git/test/test_submodule.py | 5 ++++- git/test/test_tree.py | 5 ++++- git/test/test_util.py | 6 +++++- git/util.py | 15 +++++++++++---- requirements.txt | 1 + 15 files changed, 81 insertions(+), 27 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 701fc4ac2..69b7fe567 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -7,6 +7,9 @@ environment: matrix: ## MINGW # + - PYTHON: "C:\\Python26" + PYTHON_VERSION: "2.6" + GIT_PATH: "%GIT_DAEMON_PATH%" - PYTHON: "C:\\Python27" PYTHON_VERSION: "2.7" GIT_PATH: "%GIT_DAEMON_PATH%" diff --git a/.travis.yml b/.travis.yml index f7dd247ba..a3f8c7054 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,14 @@ language: python python: + - "2.6" - "2.7" - "3.3" - "3.4" - "3.5" # - "pypy" - won't work as smmap doesn't work (see gitdb/.travis.yml for details) +#matrix: +# allow_failures: +# - python: "2.6" git: # a higher depth is needed for most of the tests - must be high enough to not actually be shallow # as we clone our own repository in the process @@ -15,6 +19,7 @@ install: - git fetch --tags - pip install -r test-requirements.txt - pip install codecov sphinx + - if [ "$TRAVIS_PYTHON_VERSION" == '2.6' ]; then pip install unittest2; fi # generate some reflog as git-python tests need it (in master) - ./init-tests-after-clone.sh diff --git a/git/cmd.py b/git/cmd.py index 72ba82c3c..78b5ff70d 100644 --- a/git/cmd.py +++ b/git/cmd.py @@ -139,9 +139,9 @@ def dict_to_slots_and__excluded_are_none(self, d, excluded=()): CREATE_NO_WINDOW = 0x08000000 ## CREATE_NEW_PROCESS_GROUP is needed to allow killing it afterwards, -# seehttps://docs.python.org/3/library/subprocess.html#subprocess.Popen.send_signal +# see https://docs.python.org/3/library/subprocess.html#subprocess.Popen.send_signal PROC_CREATIONFLAGS = (CREATE_NO_WINDOW | subprocess.CREATE_NEW_PROCESS_GROUP - if is_win + if is_win and sys.version_info >= (2, 7) else 0) @@ -245,7 +245,7 @@ def __del__(self): return # can be that nothing really exists anymore ... - if os is None or os.kill is None: + if os is None or getattr(os, 'kill', None) is None: return # try to kill it @@ -831,8 +831,12 @@ def _call_process(self, method, *args, **kwargs): :return: Same as ``execute``""" # Handle optional arguments prior to calling transform_kwargs # otherwise these'll end up in args, which is bad. - _kwargs = {k: v for k, v in kwargs.items() if k in execute_kwargs} - kwargs = {k: v for k, v in kwargs.items() if k not in execute_kwargs} + _kwargs = dict() + for kwarg in execute_kwargs: + try: + _kwargs[kwarg] = kwargs.pop(kwarg) + except KeyError: + pass insert_after_this_arg = kwargs.pop('insert_kwargs_after', None) diff --git a/git/objects/submodule/base.py b/git/objects/submodule/base.py index 18988b975..a35240f1f 100644 --- a/git/objects/submodule/base.py +++ b/git/objects/submodule/base.py @@ -3,7 +3,10 @@ import logging import os import stat -from unittest.case import SkipTest +try: + from unittest import SkipTest +except ImportError: + from unittest2 import SkipTest import uuid import git diff --git a/git/test/lib/helper.py b/git/test/lib/helper.py index 1515f2a1f..743f720c8 100644 --- a/git/test/lib/helper.py +++ b/git/test/lib/helper.py @@ -7,20 +7,24 @@ import contextlib from functools import wraps +import sys import io import logging import os import tempfile import textwrap import time -from unittest import TestCase -import unittest -from git.compat import string_types, is_win, PY3 +from git.compat import string_types, is_win from git.util import rmtree, cwd import os.path as osp +if sys.version_info[0:2] == (2, 6): + import unittest2 as unittest +else: + import unittest +TestCase = unittest.TestCase ospd = osp.dirname @@ -335,8 +339,11 @@ class TestBase(TestCase): of the project history ( to assure tests don't fail for others ). """ - if not PY3: - assertRaisesRegex = unittest.TestCase.assertRaisesRegexp + # On py26, unittest2 has assertRaisesRegex + # On py3, unittest has assertRaisesRegex + # On py27, we use unittest, which names it differently: + if sys.version_info[0:2] == (2, 7): + assertRaisesRegex = TestCase.assertRaisesRegexp def _small_repo_url(self): """:return" a path to a small, clonable repository""" diff --git a/git/test/test_base.py b/git/test/test_base.py index cec40de82..69f161bee 100644 --- a/git/test/test_base.py +++ b/git/test/test_base.py @@ -7,7 +7,10 @@ import os import sys import tempfile -from unittest import skipIf +try: + from unittest import SkipTest, skipIf +except ImportError: + from unittest2 import SkipTest, skipIf from git import ( Blob, @@ -131,7 +134,6 @@ def test_add_unicode(self, rw_repo): try: file_path.encode(sys.getfilesystemencoding()) except UnicodeEncodeError: - from unittest import SkipTest raise SkipTest("Environment doesn't support unicode filenames") with open(file_path, "wb") as fp: diff --git a/git/test/test_fun.py b/git/test/test_fun.py index 9d4366537..b472fe19c 100644 --- a/git/test/test_fun.py +++ b/git/test/test_fun.py @@ -1,6 +1,9 @@ from io import BytesIO from stat import S_IFDIR, S_IFREG, S_IFLNK -from unittest.case import skipIf +try: + from unittest import skipIf +except ImportError: + from unittest2 import skipIf from git.compat import PY3 from git.index import IndexFile diff --git a/git/test/test_index.py b/git/test/test_index.py index 1abe22f48..071ac623f 100644 --- a/git/test/test_index.py +++ b/git/test/test_index.py @@ -13,7 +13,10 @@ ) import sys import tempfile -from unittest.case import skipIf +try: + from unittest import skipIf +except ImportError: + from unittest2 import skipIf from git import ( IndexFile, @@ -149,8 +152,9 @@ def add_bad_blob(): except Exception as ex: msg_py3 = "required argument is not an integer" msg_py2 = "cannot convert argument to integer" - ## msg_py26 ="unsupported operand type(s) for &: 'str' and 'long'" - assert msg_py2 in str(ex) or msg_py3 in str(ex), str(ex) + msg_py26 = "unsupported operand type(s) for &: 'str' and 'long'" + assert msg_py2 in str(ex) or msg_py3 in str(ex) or \ + msg_py26 in str(ex), str(ex) ## 2nd time should not fail due to stray lock file try: diff --git a/git/test/test_remote.py b/git/test/test_remote.py index 8b50ea35c..aae4fb9f3 100644 --- a/git/test/test_remote.py +++ b/git/test/test_remote.py @@ -6,7 +6,10 @@ import random import tempfile -from unittest.case import skipIf +try: + from unittest import skipIf +except ImportError: + from unittest2 import skipIf from git import ( RemoteProgress, diff --git a/git/test/test_repo.py b/git/test/test_repo.py index 374a26eee..9ad80ee63 100644 --- a/git/test/test_repo.py +++ b/git/test/test_repo.py @@ -11,7 +11,10 @@ import pickle import sys import tempfile -from unittest.case import skipIf +try: + from unittest import skipIf, SkipTest +except ImportError: + from unittest2 import skipIf, SkipTest from git import ( InvalidGitRepositoryError, @@ -53,7 +56,6 @@ from git.util import HIDE_WINDOWS_KNOWN_ERRORS, cygpath from git.test.lib import with_rw_directory from git.util import join_path_native, rmtree, rmfile, bin_to_hex -from unittest import SkipTest import functools as fnt import os.path as osp diff --git a/git/test/test_submodule.py b/git/test/test_submodule.py index 7b05f49ab..59a40fa02 100644 --- a/git/test/test_submodule.py +++ b/git/test/test_submodule.py @@ -3,7 +3,10 @@ # the BSD License: http://www.opensource.org/licenses/bsd-license.php import os import sys -from unittest.case import skipIf +try: + from unittest import skipIf +except ImportError: + from unittest2 import skipIf import git from git.cmd import Git diff --git a/git/test/test_tree.py b/git/test/test_tree.py index f92598743..ab85bc9c6 100644 --- a/git/test/test_tree.py +++ b/git/test/test_tree.py @@ -6,7 +6,10 @@ from io import BytesIO import sys -from unittest.case import skipIf +try: + from unittest import skipIf +except ImportError: + from unittest2 import skipIf from git import ( Tree, diff --git a/git/test/test_util.py b/git/test/test_util.py index 8f8d22725..525c86092 100644 --- a/git/test/test_util.py +++ b/git/test/test_util.py @@ -6,7 +6,11 @@ import tempfile import time -from unittest.case import skipIf +try: + from unittest import skipIf +except ImportError: + from unittest2 import skipIf + import ddt diff --git a/git/util.py b/git/util.py index 1e0d3eb42..6e3ddfab4 100644 --- a/git/util.py +++ b/git/util.py @@ -11,11 +11,15 @@ import logging import os import platform +import subprocess import re import shutil import stat import time -from unittest.case import SkipTest +try: + from unittest import SkipTest +except ImportError: + from unittest2 import SkipTest from gitdb.util import (# NOQA @IgnorePep8 make_sha, @@ -303,7 +307,7 @@ def is_cygwin_git(git_executable): if not is_win: return False - from subprocess import check_output + #from subprocess import check_output is_cygwin = _is_cygwin_cache.get(git_executable) if is_cygwin is None: @@ -316,8 +320,11 @@ def is_cygwin_git(git_executable): ## Just a name given, not a real path. uname_cmd = osp.join(git_dir, 'uname') - uname = check_output(uname_cmd, universal_newlines=True) - is_cygwin = 'CYGWIN' in uname + process = subprocess.Popen([uname_cmd], stdout=subprocess.PIPE, + universal_newlines=True) + uname_out, _ = process.communicate() + #retcode = process.poll() + is_cygwin = 'CYGWIN' in uname_out except Exception as ex: log.debug('Failed checking if running in CYGWIN due to: %r', ex) _is_cygwin_cache[git_executable] = is_cygwin diff --git a/requirements.txt b/requirements.txt index 396446062..a8e7a7a8a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,3 @@ gitdb>=0.6.4 ddt>=1.1.1 +unittest2; python_version < '2.7' From d03e7dbb45f69f056b6b2b4a7551fb73224d8b85 Mon Sep 17 00:00:00 2001 From: Vincent Driessen Date: Wed, 7 Dec 2016 15:55:47 +0100 Subject: [PATCH 02/15] Don't change the meaning of string literals --- git/util.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/git/util.py b/git/util.py index 6e3ddfab4..ad2265e68 100644 --- a/git/util.py +++ b/git/util.py @@ -3,8 +3,6 @@ # # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php -from __future__ import unicode_literals - import contextlib from functools import wraps import getpass From 7e0e68253ca373c290dda10634706d7b196064bd Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Thu, 8 Dec 2016 12:47:12 +0100 Subject: [PATCH 03/15] fix(submodule): don't fail if tracking branch can't be setup Fixes #545 --- git/objects/submodule/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git/objects/submodule/base.py b/git/objects/submodule/base.py index a35240f1f..55e2ea27e 100644 --- a/git/objects/submodule/base.py +++ b/git/objects/submodule/base.py @@ -540,7 +540,7 @@ def update(self, recursive=False, init=True, to_latest_revision=False, progress= # make sure HEAD is not detached mrepo.head.set_reference(local_branch, logmsg="submodule: attaching head to %s" % local_branch) mrepo.head.ref.set_tracking_branch(remote_branch) - except IndexError: + except (IndexError, InvalidGitRepositoryError): log.warn("Failed to checkout tracking branch %s", self.branch_path) # END handle tracking branch From 8e8a45ec2b1d597198af864208f6f992cfdabb40 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Thu, 8 Dec 2016 12:54:34 +0100 Subject: [PATCH 04/15] chore(lint): flake8 Interestingly only shows in particular python versions on travis. Maybe some caching effect? Locally it is reproducible easily, with the latest flake8 --- git/cmd.py | 1 + git/objects/submodule/root.py | 2 +- git/test/test_submodule.py | 2 +- git/util.py | 1 + setup.py | 1 + 5 files changed, 5 insertions(+), 2 deletions(-) diff --git a/git/cmd.py b/git/cmd.py index 78b5ff70d..245a7f609 100644 --- a/git/cmd.py +++ b/git/cmd.py @@ -135,6 +135,7 @@ def dict_to_slots_and__excluded_are_none(self, d, excluded=()): ## -- End Utilities -- @} + # value of Windows process creation flag taken from MSDN CREATE_NO_WINDOW = 0x08000000 diff --git a/git/objects/submodule/root.py b/git/objects/submodule/root.py index 4fe856c2c..fbd658d7c 100644 --- a/git/objects/submodule/root.py +++ b/git/objects/submodule/root.py @@ -17,7 +17,6 @@ class RootUpdateProgress(UpdateProgress): - """Utility class which adds more opcodes to the UpdateProgress""" REMOVE, PATHCHANGE, BRANCHCHANGE, URLCHANGE = [ 1 << x for x in range(UpdateProgress._num_op_codes, UpdateProgress._num_op_codes + 4)] @@ -25,6 +24,7 @@ class RootUpdateProgress(UpdateProgress): __slots__ = tuple() + BEGIN = RootUpdateProgress.BEGIN END = RootUpdateProgress.END REMOVE = RootUpdateProgress.REMOVE diff --git a/git/test/test_submodule.py b/git/test/test_submodule.py index 59a40fa02..0a6c48807 100644 --- a/git/test/test_submodule.py +++ b/git/test/test_submodule.py @@ -32,12 +32,12 @@ class TestRootProgress(RootUpdateProgress): - """Just prints messages, for now without checking the correctness of the states""" def update(self, op, cur_count, max_count, message=''): print(op, cur_count, max_count, message) + prog = TestRootProgress() diff --git a/git/util.py b/git/util.py index ad2265e68..1dbbd35de 100644 --- a/git/util.py +++ b/git/util.py @@ -945,6 +945,7 @@ class NullHandler(logging.Handler): def emit(self, record): pass + # In Python 2.6, there is no NullHandler yet. Let's monkey-patch it for a workaround. if not hasattr(logging, 'NullHandler'): logging.NullHandler = NullHandler diff --git a/setup.py b/setup.py index cbf5cf57c..ea1b6316d 100755 --- a/setup.py +++ b/setup.py @@ -64,6 +64,7 @@ def _stamp_version(filename): else: print("WARNING: Couldn't find version line in file %s" % filename, file=sys.stderr) + install_requires = ['gitdb2 >= 2.0.0'] extras_require = { ':python_version == "2.6"': ['ordereddict'], From e1c997e291aa20945c34f6f9a3f9fc4a58417865 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Thu, 8 Dec 2016 14:32:58 +0100 Subject: [PATCH 05/15] chore(repo): remove comment As it does not appear to be the case. See https://github.com/gitpython-developers/GitPython/issues/547#issuecomment-257270026 [skip ci] --- git/repo/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git/repo/base.py b/git/repo/base.py index 0f85e3d96..3d2abe449 100644 --- a/git/repo/base.py +++ b/git/repo/base.py @@ -875,7 +875,7 @@ def _clone(cls, git, url, path, odb_default_type, progress, **kwargs): if progress: handle_process_output(proc, None, progress.new_message_handler(), finalize_process) else: - (stdout, stderr) = proc.communicate() # FIXME: Will block if outputs are big! + (stdout, stderr) = proc.communicate() log.debug("Cmd(%s)'s unused stdout: %s", getattr(proc, 'args', ''), stdout) finalize_process(proc, stderr=stderr) From d803684b5217a0825aa8cd1309efe8ef24c7af30 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Thu, 8 Dec 2016 16:01:35 +0100 Subject: [PATCH 06/15] fix(refs): handle quoted branch names Fixes #550 --- git/refs/head.py | 8 +++++++- git/test/test_refs.py | 12 ++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/git/refs/head.py b/git/refs/head.py index 9a9a85967..9ad890db8 100644 --- a/git/refs/head.py +++ b/git/refs/head.py @@ -8,6 +8,12 @@ __all__ = ["HEAD", "Head"] +def strip_quotes(string): + if string.startswith('"') and string.endswith('"'): + return string[1:-1] + return string + + class HEAD(SymbolicReference): """Special case of a Symbolic Reference as it represents the repository's @@ -152,7 +158,7 @@ def tracking_branch(self): from .remote import RemoteReference reader = self.config_reader() if reader.has_option(self.k_config_remote) and reader.has_option(self.k_config_remote_ref): - ref = Head(self.repo, Head.to_full_path(reader.get_value(self.k_config_remote_ref))) + ref = Head(self.repo, Head.to_full_path(strip_quotes(reader.get_value(self.k_config_remote_ref)))) remote_refpath = RemoteReference.to_full_path(join_path(reader.get_value(self.k_config_remote), ref.name)) return RemoteReference(self.repo, remote_refpath) # END handle have tracking branch diff --git a/git/test/test_refs.py b/git/test/test_refs.py index fd0be1080..0928c8cb7 100644 --- a/git/test/test_refs.py +++ b/git/test/test_refs.py @@ -119,6 +119,18 @@ def test_heads(self, rwrepo): assert head.tracking_branch() == remote_ref head.set_tracking_branch(None) assert head.tracking_branch() is None + + + special_name = 'feature#123' + special_name_remote_ref = SymbolicReference.create(rwrepo, 'refs/remotes/origin/%s' % special_name) + gp_tracking_branch = rwrepo.create_head('gp_tracking#123') + special_name_remote_ref = rwrepo.remotes[0].refs[special_name] # get correct type + gp_tracking_branch.set_tracking_branch(special_name_remote_ref) + assert gp_tracking_branch.tracking_branch().path == special_name_remote_ref.path + + git_tracking_branch = rwrepo.create_head('git_tracking#123') + rwrepo.git.branch('-u', special_name_remote_ref.name, git_tracking_branch.name) + assert git_tracking_branch.tracking_branch().name == special_name_remote_ref.name # END for each head # verify REFLOG gets altered From f6963f483cb6e1b10321bb0ef9ee0aac660b7a31 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Thu, 8 Dec 2016 16:07:11 +0100 Subject: [PATCH 07/15] chore(lint): flake8 pacification --- git/test/test_refs.py | 1 - 1 file changed, 1 deletion(-) diff --git a/git/test/test_refs.py b/git/test/test_refs.py index 0928c8cb7..f885617e8 100644 --- a/git/test/test_refs.py +++ b/git/test/test_refs.py @@ -120,7 +120,6 @@ def test_heads(self, rwrepo): head.set_tracking_branch(None) assert head.tracking_branch() is None - special_name = 'feature#123' special_name_remote_ref = SymbolicReference.create(rwrepo, 'refs/remotes/origin/%s' % special_name) gp_tracking_branch = rwrepo.create_head('gp_tracking#123') From c0a805f6ac4667560a80756dde0fd608b0ac9adf Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Thu, 8 Dec 2016 16:34:04 +0100 Subject: [PATCH 08/15] chore(version): 2.1.1 --- VERSION | 2 +- doc/source/changes.rst | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 7ec1d6db4..3e3c2f1e5 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.1.0 +2.1.1 diff --git a/doc/source/changes.rst b/doc/source/changes.rst index f55c0e5c3..5fadf4b5b 100644 --- a/doc/source/changes.rst +++ b/doc/source/changes.rst @@ -2,6 +2,13 @@ Changelog ========= +2.1.1 - Bugfixes +==================================== + +All issues and PRs can be viewed in all detail when following this URL: +https://github.com/gitpython-developers/GitPython/issues?q=is%3Aclosed+milestone%3A%22v2.1.1+-+Bugfixes%22 + + 2.1.0 - Much better windows support! ==================================== From 2d4844d157d79c4404dfe1a6fd61930dd6314916 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Thu, 22 Dec 2016 12:35:30 +0100 Subject: [PATCH 09/15] fix(tag): improve tag resolution handling The handling is similar, but the error message makes clear what is happening, and what can be done to handle such a case. Related to #561 --- git/refs/tag.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/git/refs/tag.py b/git/refs/tag.py index cf41d971a..dc7d020d9 100644 --- a/git/refs/tag.py +++ b/git/refs/tag.py @@ -22,14 +22,17 @@ class TagReference(Reference): @property def commit(self): - """:return: Commit object the tag ref points to""" + """:return: Commit object the tag ref points to + + :raise ValueError: if the tag points to a tree or blob""" obj = self.object while obj.type != 'commit': if obj.type == "tag": # it is a tag object which carries the commit as an object - we can point to anything obj = obj.object else: - raise ValueError("Tag %s points to a Blob or Tree - have never seen that before" % self) + raise ValueError(("Cannot resolve commit as tag %s points to a %s object - " + + "use the `.object` property instead to access it") % (self, obj.type)) return obj @property From 7cbd2c9d5e6b0e68550a4e2b2ba6019f138fb51d Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Thu, 22 Dec 2016 12:44:14 +0100 Subject: [PATCH 10/15] fix(remote): set_url() uses correct argument order Fixes #562 --- git/remote.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git/remote.py b/git/remote.py index c682837eb..336ac5c3b 100644 --- a/git/remote.py +++ b/git/remote.py @@ -468,7 +468,7 @@ def set_url(self, new_url, old_url=None, **kwargs): scmd = 'set-url' kwargs['insert_kwargs_after'] = scmd if old_url: - self.repo.git.remote(scmd, self.name, old_url, new_url, **kwargs) + self.repo.git.remote(scmd, self.name, new_url, old_url, **kwargs) else: self.repo.git.remote(scmd, self.name, new_url, **kwargs) return self From aea8184dd0491b97626033a8fa225752ddb65485 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Thu, 22 Dec 2016 12:48:59 +0100 Subject: [PATCH 11/15] chore(lint): fix --- git/refs/tag.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/git/refs/tag.py b/git/refs/tag.py index dc7d020d9..37ee1240d 100644 --- a/git/refs/tag.py +++ b/git/refs/tag.py @@ -31,8 +31,8 @@ def commit(self): # it is a tag object which carries the commit as an object - we can point to anything obj = obj.object else: - raise ValueError(("Cannot resolve commit as tag %s points to a %s object - " - + "use the `.object` property instead to access it") % (self, obj.type)) + raise ValueError(("Cannot resolve commit as tag %s points to a %s object - " + + "use the `.object` property instead to access it") % (self, obj.type)) return obj @property From 3f0318b0afe86aed6cc06c822da71e945dd26e59 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Thu, 22 Dec 2016 12:51:02 +0100 Subject: [PATCH 12/15] fix(remote): test Should have paid more attention to the test-failure before pushing the fix. --- git/test/test_remote.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git/test/test_remote.py b/git/test/test_remote.py index aae4fb9f3..4e06fbaf5 100644 --- a/git/test/test_remote.py +++ b/git/test/test_remote.py @@ -613,7 +613,7 @@ def test_multiple_urls(self, rw_repo): remote.set_url(test2, delete=True) self.assertEqual(list(remote.urls), [test1, test3]) # Testing changing an URL - remote.set_url(test3, test2) + remote.set_url(test2, test3) self.assertEqual(list(remote.urls), [test1, test2]) # will raise: fatal: --add --delete doesn't make sense From eefe4bef7bee44508acb980dba1875a77c4a2f17 Mon Sep 17 00:00:00 2001 From: Raphael Boidol Date: Sat, 31 Dec 2016 17:21:49 +0100 Subject: [PATCH 13/15] DOC: minor typo --- git/repo/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git/repo/base.py b/git/repo/base.py index 3d2abe449..85f2d0369 100644 --- a/git/repo/base.py +++ b/git/repo/base.py @@ -459,7 +459,7 @@ def iter_commits(self, rev=None, paths='', **kwargs): :note: to receive only commits between two named revisions, use the "revA...revB" revision specifier - :return ``git.Commit[]``""" + :return: ``git.Commit[]``""" if rev is None: rev = self.head.commit From 7052136af5c2b2c616e8961b50c494d4638ec22f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Garc=C3=ADa=20Garz=C3=B3n?= Date: Sun, 15 Jan 2017 18:10:47 +0100 Subject: [PATCH 14/15] pip install using camellcase package name --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1f02fd713..8df3ef4a7 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ If you have downloaded the source code: or if you want to obtain a copy from the Pypi repository: - pip install gitpython + pip install GitPython Both commands will install the required package dependencies. From 0429bc3ff88071d11b6095aa69f0fb205ae40452 Mon Sep 17 00:00:00 2001 From: Barry Scott Date: Thu, 2 Feb 2017 17:25:10 +0000 Subject: [PATCH 15/15] git expects boolean value to be lower case str(bool) returns capitialised True and False that is not what git expects or compatible with getboolean. --- git/config.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/git/config.py b/git/config.py index f530bac89..57c9f7b15 100644 --- a/git/config.py +++ b/git/config.py @@ -549,7 +549,13 @@ def get_value(self, section, option, default=None): return valuestr def _value_to_string(self, value): - if isinstance(value, (int, float, bool)): + # git expects bool to be lower case true or false + if isinstance(value, bool): + if value: + return 'true' + else: + return 'false' + if isinstance(value, (int, float)): return str(value) return force_text(value)