[Python-modules-commits] [python-git] 02/05: New upstream version 2.1.1
Takaki Taniguchi
takaki at moszumanska.debian.org
Thu Feb 2 08:32:35 UTC 2017
This is an automated email from the git hooks/post-receive script.
takaki pushed a commit to branch master
in repository python-git.
commit 45af7b72ace8b54007e8867b06c85c171c212bd2
Author: TANIGUCHI Takaki <takaki at asis.media-as.org>
Date: Thu Feb 2 16:27:33 2017 +0900
New upstream version 2.1.1
---
GitPython.egg-info/PKG-INFO | 2 +-
PKG-INFO | 2 +-
VERSION | 2 +-
doc/source/changes.rst | 7 +++++++
git/__init__.py | 4 ++--
git/cmd.py | 15 ++++++++++-----
git/objects/submodule/base.py | 7 +++++--
git/objects/submodule/root.py | 2 +-
git/refs/head.py | 8 +++++++-
git/repo/base.py | 2 +-
git/test/lib/helper.py | 17 ++++++++++++-----
git/test/performance/test_odb.py | 6 ------
git/test/test_base.py | 6 ++++--
git/test/test_fun.py | 5 ++++-
git/test/test_index.py | 10 +++++++---
git/test/test_refs.py | 11 +++++++++++
git/test/test_remote.py | 5 ++++-
git/test/test_repo.py | 8 ++++----
git/test/test_submodule.py | 23 ++++++-----------------
git/test/test_tree.py | 5 ++++-
git/test/test_util.py | 6 +++++-
git/util.py | 18 ++++++++++++------
requirements.txt | 1 +
setup.py | 1 +
24 files changed, 111 insertions(+), 62 deletions(-)
diff --git a/GitPython.egg-info/PKG-INFO b/GitPython.egg-info/PKG-INFO
index 7399ab8..110059d 100644
--- a/GitPython.egg-info/PKG-INFO
+++ b/GitPython.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: GitPython
-Version: 2.1.0
+Version: 2.1.1
Summary: Python Git Library
Home-page: https://github.com/gitpython-developers/GitPython
Author: Sebastian Thiel, Michael Trier
diff --git a/PKG-INFO b/PKG-INFO
index 7399ab8..110059d 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: GitPython
-Version: 2.1.0
+Version: 2.1.1
Summary: Python Git Library
Home-page: https://github.com/gitpython-developers/GitPython
Author: Sebastian Thiel, Michael Trier
diff --git a/VERSION b/VERSION
index 7ec1d6d..3e3c2f1 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 f55c0e5..5fadf4b 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!
====================================
diff --git a/git/__init__.py b/git/__init__.py
index 9e0088d..c7a3388 100644
--- a/git/__init__.py
+++ b/git/__init__.py
@@ -12,13 +12,13 @@ import sys
import os.path as osp
-__version__ = '2.1.0'
+__version__ = '2.1.1'
#{ Initialization
def _init_externals():
"""Initialize external projects by putting them into the path"""
- if __version__ == '2.1.0':
+ if __version__ == '2.1.1':
sys.path.insert(0, osp.join(osp.dirname(__file__), 'ext', 'gitdb'))
try:
diff --git a/git/cmd.py b/git/cmd.py
index 72ba82c..245a7f6 100644
--- a/git/cmd.py
+++ b/git/cmd.py
@@ -135,13 +135,14 @@ 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
## 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 +246,7 @@ class Git(LazyMixin):
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 +832,12 @@ class Git(LazyMixin):
: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 18988b9..55e2ea2 100644
--- a/git/objects/submodule/base.py
+++ b/git/objects/submodule/base.py
@@ -3,7 +3,10 @@ from io import BytesIO
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
@@ -537,7 +540,7 @@ class Submodule(IndexObject, Iterable, Traversable):
# 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
diff --git a/git/objects/submodule/root.py b/git/objects/submodule/root.py
index 4fe856c..fbd658d 100644
--- a/git/objects/submodule/root.py
+++ b/git/objects/submodule/root.py
@@ -17,7 +17,6 @@ log.addHandler(logging.NullHandler())
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/refs/head.py b/git/refs/head.py
index 9a9a859..9ad890d 100644
--- a/git/refs/head.py
+++ b/git/refs/head.py
@@ -8,6 +8,12 @@ from .reference import Reference
__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 @@ class Head(Reference):
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/repo/base.py b/git/repo/base.py
index 0f85e3d..3d2abe4 100644
--- a/git/repo/base.py
+++ b/git/repo/base.py
@@ -875,7 +875,7 @@ class Repo(object):
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)
diff --git a/git/test/lib/helper.py b/git/test/lib/helper.py
index 1515f2a..743f720 100644
--- a/git/test/lib/helper.py
+++ b/git/test/lib/helper.py
@@ -7,20 +7,24 @@ from __future__ import print_function
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/performance/test_odb.py b/git/test/performance/test_odb.py
index 3879cb0..425af84 100644
--- a/git/test/performance/test_odb.py
+++ b/git/test/performance/test_odb.py
@@ -3,10 +3,6 @@ from __future__ import print_function
import sys
from time import time
-from unittest.case import skipIf
-
-from git.compat import PY3
-from git.util import HIDE_WINDOWS_KNOWN_ERRORS
from .lib import (
TestBigRepoR
@@ -15,8 +11,6 @@ from .lib import (
class TestObjDBPerformance(TestBigRepoR):
- @skipIf(HIDE_WINDOWS_KNOWN_ERRORS and PY3,
- "FIXME: smmp fails with: TypeError: Can't convert 'bytes' object to str implicitly")
def test_random_access(self):
results = [["Iterate Commits"], ["Iterate Blobs"], ["Retrieve Blob Data"]]
for repo in (self.gitrorepo, self.puregitrorepo):
diff --git a/git/test/test_base.py b/git/test/test_base.py
index cec40de..69f161b 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 @@ class TestBase(TestBase):
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 9d43665..b472fe1 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 1abe22f..071ac62 100644
--- a/git/test/test_index.py
+++ b/git/test/test_index.py
@@ -13,7 +13,10 @@ from stat import (
)
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 @@ class TestIndex(TestBase):
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_refs.py b/git/test/test_refs.py
index fd0be10..f885617 100644
--- a/git/test/test_refs.py
+++ b/git/test/test_refs.py
@@ -119,6 +119,17 @@ class TestRefs(TestBase):
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
diff --git a/git/test/test_remote.py b/git/test/test_remote.py
index 8b50ea3..aae4fb9 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 8b644f7..9ad80ee 100644
--- a/git/test/test_repo.py
+++ b/git/test/test_repo.py
@@ -11,7 +11,10 @@ import os
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.test.lib import (
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
@@ -808,8 +810,6 @@ class TestRepo(TestBase):
git_file_repo = Repo(rwrepo.working_tree_dir)
self.assertEqual(osp.abspath(git_file_repo.git_dir), real_path_abs)
- @skipIf(HIDE_WINDOWS_KNOWN_ERRORS and PY3,
- "FIXME: smmp fails with: TypeError: Can't convert 'bytes' object to str implicitly")
def test_file_handle_leaks(self):
def last_commit(repo, rev, path):
commit = next(repo.iter_commits(rev, path, max_count=1))
diff --git a/git/test/test_submodule.py b/git/test/test_submodule.py
index 0ebd9ec..0a6c488 100644
--- a/git/test/test_submodule.py
+++ b/git/test/test_submodule.py
@@ -3,11 +3,14 @@
# 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
-from git.compat import string_types, is_win
+from git.compat import string_types
from git.exc import (
InvalidGitRepositoryError,
RepositoryDirtyError
@@ -28,27 +31,13 @@ from git.util import to_native_path_linux, join_path_native
import os.path as osp
-# Change the configuration if possible to prevent the underlying memory manager
-# to keep file handles open. On windows we get problems as they are not properly
-# closed due to mmap bugs on windows (as it appears)
-if is_win:
- try:
- import smmap.util # @UnusedImport
- smmap.util.MapRegion._test_read_into_memory = True
- except ImportError:
- sys.stderr.write("The submodule tests will fail as some files cannot be removed due to open file handles.\n")
- sys.stderr.write(
- "The latest version of gitdb uses a memory map manager which can be configured to work around this problem")
-# END handle windows platform
-
-
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/test/test_tree.py b/git/test/test_tree.py
index f925987..ab85bc9 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 8f8d227..525c860 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 1e0d3eb..1dbbd35 100644
--- a/git/util.py
+++ b/git/util.py
@@ -3,19 +3,21 @@
#
# 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
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 +305,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 +318,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
@@ -940,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/requirements.txt b/requirements.txt
index 3964460..a8e7a7a 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,2 +1,3 @@
gitdb>=0.6.4
ddt>=1.1.1
+unittest2; python_version < '2.7'
diff --git a/setup.py b/setup.py
index cbf5cf5..ea1b631 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'],
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-git.git
More information about the Python-modules-commits
mailing list