summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2015-01-04 13:48:29 +0100
committerSebastian Thiel <byronimo@gmail.com>2015-01-04 13:48:29 +0100
commitc80d727e374321573bb00e23876a67c77ff466e3 (patch)
tree7590d6ae544eac56e83639d27e1f9013b38d8a4b
parent965a08c3f9f2fbd62691d533425c699c943cb865 (diff)
downloadgitpython-c80d727e374321573bb00e23876a67c77ff466e3.tar.gz
Bumped version, updated changelog, reduced code smell
There is more work to do though, as many imports are still incorrect. Also, there are still print statements
-rw-r--r--README.md2
-rw-r--r--VERSION2
-rw-r--r--doc/source/changes.rst3
-rw-r--r--git/cmd.py16
-rw-r--r--git/config.py8
-rw-r--r--git/diff.py5
m---------git/ext/gitdb0
-rw-r--r--git/index/__init__.py6
-rw-r--r--git/index/base.py16
-rw-r--r--git/index/fun.py9
-rw-r--r--git/index/typ.py3
-rw-r--r--git/objects/__init__.py21
-rw-r--r--git/objects/base.py1
-rw-r--r--git/objects/commit.py4
-rw-r--r--git/objects/submodule/base.py12
-rw-r--r--git/objects/submodule/root.py10
-rw-r--r--git/objects/tree.py3
-rw-r--r--git/objects/util.py9
-rw-r--r--git/odict.py7
-rw-r--r--git/refs/__init__.py17
-rw-r--r--git/refs/head.py3
-rw-r--r--git/refs/log.py4
-rw-r--r--git/refs/reference.py5
-rw-r--r--git/refs/symbolic.py4
-rw-r--r--git/remote.py4
-rw-r--r--git/repo/__init__.py4
-rw-r--r--git/repo/base.py5
-rw-r--r--git/test/lib/asserts.py1
-rw-r--r--git/test/lib/helper.py17
-rw-r--r--git/test/performance/lib.py3
-rw-r--r--git/test/performance/test_odb.py5
-rw-r--r--git/test/performance/test_streams.py20
-rw-r--r--git/test/test_actor.py1
-rw-r--r--git/test/test_base.py3
-rw-r--r--git/test/test_blob.py1
-rw-r--r--git/test/test_config.py4
-rw-r--r--git/test/test_diff.py2
-rw-r--r--git/test/test_index.py37
-rw-r--r--git/test/test_refs.py4
-rw-r--r--git/test/test_remote.py4
-rw-r--r--git/test/test_repo.py13
-rw-r--r--git/test/test_submodule.py4
-rw-r--r--git/test/test_tree.py5
-rw-r--r--git/test/test_util.py1
-rw-r--r--git/util.py4
-rw-r--r--requirements.txt2
-rwxr-xr-xsetup.py4
-rw-r--r--tox.ini2
48 files changed, 156 insertions, 164 deletions
diff --git a/README.md b/README.md
index b99c4c2f..4b678184 100644
--- a/README.md
+++ b/README.md
@@ -66,7 +66,7 @@ New BSD License. See the LICENSE file.
### DEVELOPMENT STATUS
[![Build Status](https://travis-ci.org/gitpython-developers/GitPython.svg?branch=0.3)](https://travis-ci.org/gitpython-developers/GitPython)
-[![Coverage Status](https://coveralls.io/repos/gitpython-developers/GitPython/badge.png)](https://coveralls.io/r/gitpython-developers/GitPython)
+[![Coverage Status](https://coveralls.io/repos/gitpython-developers/GitPython/badge.png?branch=0.3)](https://coveralls.io/r/gitpython-developers/GitPython?branch=0.3)
[![Documentation Status](https://readthedocs.org/projects/gitpython/badge/?version=stable)](https://readthedocs.org/projects/gitpython/?badge=stable)
diff --git a/VERSION b/VERSION
index e8a6b930..1c09c74e 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.3.2.1
+0.3.3
diff --git a/doc/source/changes.rst b/doc/source/changes.rst
index 1c34e629..924743bd 100644
--- a/doc/source/changes.rst
+++ b/doc/source/changes.rst
@@ -5,6 +5,9 @@ Changelog
0.3.3
=====
* When fetching, pulling or pushing, and an error occours, it will not be reported on stdout anymore. However, if there is a fatal error, it will still result in a GitCommandError to be thrown. This goes hand in hand with improved fetch result parsing.
+* Code Cleanup (in preparation for python 3 support)
+ * Applied autopep8 and cleaned up code
+ * Using python logging module instead of print statments to signal certain kinds of errors
0.3.2.1
=======
diff --git a/git/cmd.py b/git/cmd.py
index bfdefb17..d024b409 100644
--- a/git/cmd.py
+++ b/git/cmd.py
@@ -334,7 +334,7 @@ class Git(LazyMixin):
If you add additional keyword arguments to the signature of this method,
you must update the execute_kwargs tuple housed in this module."""
if self.GIT_PYTHON_TRACE and (self.GIT_PYTHON_TRACE != 'full' or as_process):
- print ' '.join(command)
+ print(' '.join(command))
# Allow the user to have the command executed in their working dir.
if with_keep_cwd or self._working_dir is None:
@@ -389,11 +389,11 @@ class Git(LazyMixin):
if self.GIT_PYTHON_TRACE == 'full':
cmdstr = " ".join(command)
if stderr_value:
- print "%s -> %d; stdout: '%s'; stderr: '%s'" % (cmdstr, status, stdout_value, stderr_value)
+ print("%s -> %d; stdout: '%s'; stderr: '%s'" % (cmdstr, status, stdout_value, stderr_value))
elif stdout_value:
- print "%s -> %d; stdout: '%s'" % (cmdstr, status, stdout_value)
+ print("%s -> %d; stdout: '%s'" % (cmdstr, status, stdout_value))
else:
- print "%s -> %d" % (cmdstr, status)
+ print("%s -> %d" % (cmdstr, status))
# END handle debug printing
if with_exceptions and status != 0:
@@ -522,14 +522,16 @@ class Git(LazyMixin):
raise
# END handle overridden variable
type(self).GIT_PYTHON_GIT_EXECUTABLE = self.git_exec_name_win
- call = [self.GIT_PYTHON_GIT_EXECUTABLE] + list(args)
try:
return self.execute(make_call(), **_kwargs)
finally:
import warnings
- msg = "WARNING: Automatically switched to use git.cmd as git executable, which reduces performance by ~70%."
- msg += "Its recommended to put git.exe into the PATH or to set the %s environment variable to the executable's location" % self._git_exec_env_var
+ msg = "WARNING: Automatically switched to use git.cmd as git executable"
+ msg += ", which reduces performance by ~70%."
+ msg += "Its recommended to put git.exe into the PATH or to "
+ msg += "set the %s " % self._git_exec_env_var
+ msg += "environment variable to the executable's location"
warnings.warn(msg)
# END print of warning
# END catch first failure
diff --git a/git/config.py b/git/config.py
index 8a15466f..51337db4 100644
--- a/git/config.py
+++ b/git/config.py
@@ -7,10 +7,8 @@
configuration files"""
import re
-import os
import ConfigParser as cp
import inspect
-import cStringIO
from git.odict import OrderedDict
from git.util import LockFile
@@ -188,8 +186,8 @@ class GitConfigParser(cp.RawConfigParser, object):
try:
try:
self.write()
- except IOError, e:
- print "Exception during destruction of GitConfigParser: %s" % str(e)
+ except IOError as e:
+ print("Exception during destruction of GitConfigParser: %s" % str(e))
finally:
self._lock._release_lock()
@@ -287,7 +285,7 @@ class GitConfigParser(cp.RawConfigParser, object):
try:
fp = open(file_object)
close_fp = True
- except IOError, e:
+ except IOError:
continue
# END fp handling
diff --git a/git/diff.py b/git/diff.py
index 456974af..5325ad6b 100644
--- a/git/diff.py
+++ b/git/diff.py
@@ -7,7 +7,6 @@
import re
from objects.blob import Blob
from objects.util import mode_str_to_int
-from exc import GitCommandError
from gitdb.util import hex_to_bin
@@ -106,7 +105,7 @@ class Diffable(object):
diff_method = Diff._index_from_patch_format
index = diff_method(self.repo, proc.stdout)
- status = proc.wait()
+ proc.wait()
return index
@@ -321,7 +320,7 @@ class Diff(object):
modify, delete and add files
:return: git.DiffIndex"""
# handles
- # :100644 100644 6870991011cc8d9853a7a8a6f02061512c6a8190 37c5e30c879213e9ae83b21e9d11e55fc20c54b7 M .gitignore
+ # :100644 100644 687099101... 37c5e30c8... M .gitignore
index = DiffIndex()
for line in stream:
if not line.startswith(":"):
diff --git a/git/ext/gitdb b/git/ext/gitdb
-Subproject ab4520683ab325046f2a9fe6ebf127dbbab60df
+Subproject ff7615321ee31d981a171f7677a56a971c55405
diff --git a/git/index/__init__.py b/git/index/__init__.py
index 4a495c33..c5080d2e 100644
--- a/git/index/__init__.py
+++ b/git/index/__init__.py
@@ -1,4 +1,6 @@
"""Initialize the index package"""
-from base import *
-from typ import *
+from __future__ import absolute_import
+
+from .base import *
+from .typ import *
diff --git a/git/index/base.py b/git/index/base.py
index 051423bf..fdcfcd12 100644
--- a/git/index/base.py
+++ b/git/index/base.py
@@ -24,7 +24,6 @@ from util import (
git_working_dir
)
-import git.objects
import git.diff as diff
from git.exc import (
@@ -43,13 +42,11 @@ from git.objects import (
from git.objects.util import Serializable
from git.util import (
- IndexFileSHA1Writer,
LazyMixin,
LockedFD,
join_path_native,
file_contents_ro,
to_native_path_linux,
- to_native_path
)
from fun import (
@@ -418,9 +415,6 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable):
iterator. A default filter, the BlobFilter, allows you to yield blobs
only if they match a given list of paths. """
for entry in self.entries.itervalues():
- # TODO: is it necessary to convert the mode ? We did that when adding
- # it to the index, right ?
- mode = stat_mode_to_index_mode(entry.mode)
blob = entry.to_blob(self.repo)
blob.size = entry.size
output = (entry.stage, blob)
@@ -602,7 +596,7 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable):
def add(self, items, force=True, fprogress=lambda *args: None, path_rewriter=None,
write=True):
"""Add files from the working tree, specific blobs or BaseIndexEntries
- to the index.
+ to the index.
:param items:
Multiple types of items are supported, types can be mixed within one call.
@@ -630,7 +624,7 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable):
must be a path relative to our repository.
If their sha is null ( 40*0 ), their path must exist in the file system
- relative to the git repository as an object will be created from
+ relative to the git repository as an object will be created from
the data at the path.
The handling now very much equals the way string paths are processed, except that
the mode you have set will be kept. This allows you to create symlinks
@@ -892,7 +886,8 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable):
:return:
Commit object representing the new commit"""
tree = self.write_tree()
- return Commit.create_from_tree(self.repo, tree, message, parent_commits, head, author=author, committer=committer)
+ return Commit.create_from_tree(self.repo, tree, message, parent_commits,
+ head, author=author, committer=committer)
@classmethod
def _flush_stdin_and_wait(cls, proc, ignore_stdout=False):
@@ -995,7 +990,8 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable):
if failed_files:
valid_files = list(set(iter_checked_out_files) - set(failed_files))
raise CheckoutError(
- "Some files could not be checked out from the index due to local modifications", failed_files, valid_files, failed_reasons)
+ "Some files could not be checked out from the index due to local modifications",
+ failed_files, valid_files, failed_reasons)
# END stderr handler
if paths is None:
diff --git a/git/index/fun.py b/git/index/fun.py
index 4750463c..eec90519 100644
--- a/git/index/fun.py
+++ b/git/index/fun.py
@@ -5,7 +5,6 @@ from stat import (
S_IFDIR,
S_IFLNK,
S_ISLNK,
- S_IFDIR,
S_ISDIR,
S_IFMT,
S_IFREG,
@@ -146,7 +145,7 @@ def read_cache(stream):
path = read(path_size)
real_size = ((tell() - beginoffset + 8) & ~7)
- data = read((beginoffset + real_size) - tell())
+ read((beginoffset + real_size) - tell())
entry = IndexEntry((mode, sha, flags, path, ctime, mtime, dev, ino, uid, gid, size))
# entry_key would be the method to use, but we safe the effort
entries[(path, entry.stage)] = entry
@@ -160,8 +159,8 @@ def read_cache(stream):
# 4 bytes length of chunk
# repeated 0 - N times
extension_data = stream.read(~0)
- assert len(extension_data) > 19, "Index Footer was not at least a sha on content as it was only %i bytes in size" % len(
- extension_data)
+ assert len(extension_data) > 19, "Index Footer was not at least a sha on content as it was only %i bytes in size"\
+ % len(extension_data)
content_sha = extension_data[-20:]
@@ -265,7 +264,7 @@ def aggressive_tree_merge(odb, tree_shas):
# it exists in all branches, if it was changed in both
# its a conflict, otherwise we take the changed version
# This should be the most common branch, so it comes first
- if( base[0] != ours[0] and base[0] != theirs[0] and ours[0] != theirs[0] ) or \
+ if(base[0] != ours[0] and base[0] != theirs[0] and ours[0] != theirs[0]) or \
(base[1] != ours[1] and base[1] != theirs[1] and ours[1] != theirs[1]):
# changed by both
out_append(_tree_entry_to_baseindexentry(base, 1))
diff --git a/git/index/typ.py b/git/index/typ.py
index a71fc2c6..222252c5 100644
--- a/git/index/typ.py
+++ b/git/index/typ.py
@@ -172,4 +172,5 @@ class IndexEntry(BaseIndexEntry):
def from_blob(cls, blob, stage=0):
""":return: Minimal entry resembling the given blob object"""
time = pack(">LL", 0, 0)
- return IndexEntry((blob.mode, blob.binsha, stage << CE_STAGESHIFT, blob.path, time, time, 0, 0, 0, 0, blob.size))
+ return IndexEntry((blob.mode, blob.binsha, stage << CE_STAGESHIFT, blob.path,
+ time, time, 0, 0, 0, 0, blob.size))
diff --git a/git/objects/__init__.py b/git/objects/__init__.py
index 0b40934c..1fe881f3 100644
--- a/git/objects/__init__.py
+++ b/git/objects/__init__.py
@@ -1,21 +1,22 @@
"""
Import all submodules main classes into the package space
"""
+from __future__ import absolute_import
import inspect
-from base import *
+from .base import *
# Fix import dependency - add IndexObject to the util module, so that it can be
# imported by the submodule.base
-import submodule.util
-submodule.util.IndexObject = IndexObject
-submodule.util.Object = Object
-from submodule.base import *
-from submodule.root import *
+from .submodule import util
+util.IndexObject = IndexObject
+util.Object = Object
+from .submodule.base import *
+from .submodule.root import *
# must come after submodule was made available
-from tag import *
-from blob import *
-from commit import *
-from tree import *
+from .tag import *
+from .blob import *
+from .commit import *
+from .tree import *
__all__ = [name for name, obj in locals().items()
if not (name.startswith('_') or inspect.ismodule(obj))]
diff --git a/git/objects/base.py b/git/objects/base.py
index 50647a3a..20147e57 100644
--- a/git/objects/base.py
+++ b/git/objects/base.py
@@ -6,7 +6,6 @@
from git.util import LazyMixin, join_path_native, stream_copy
from util import get_object_type_by_name
from gitdb.util import (
- hex_to_bin,
bin_to_hex,
basename
)
diff --git a/git/objects/commit.py b/git/objects/commit.py
index c6adcc94..4a4a314c 100644
--- a/git/objects/commit.py
+++ b/git/objects/commit.py
@@ -276,9 +276,9 @@ class Commit(base.Object, Iterable, Diffable, Traversable, Serializable):
If True, the HEAD will be advanced to the new commit automatically.
Else the HEAD will remain pointing on the previous commit. This could
lead to undesired results when diffing files.
- :param author: The name of the author, optional. If unset, the repository
+ :param author: The name of the author, optional. If unset, the repository
configuration is used to obtain this value.
- :param committer: The name of the committer, optional. If unset, the
+ :param committer: The name of the committer, optional. If unset, the
repository configuration is used to obtain this value.
:return: Commit object representing the new commit
diff --git a/git/objects/submodule/base.py b/git/objects/submodule/base.py
index e3d58077..6951fd63 100644
--- a/git/objects/submodule/base.py
+++ b/git/objects/submodule/base.py
@@ -28,7 +28,6 @@ import git
import os
import sys
-import time
__all__ = ["Submodule", "UpdateProgress"]
@@ -140,7 +139,8 @@ class Submodule(util.IndexObject, Iterable, Traversable):
return self._name
def __repr__(self):
- return "git.%s(name=%s, path=%s, url=%s, branch_path=%s)" % (type(self).__name__, self._name, self.path, self.url, self.branch_path)
+ return "git.%s(name=%s, path=%s, url=%s, branch_path=%s)"\
+ % (type(self).__name__, self._name, self.path, self.url, self.branch_path)
@classmethod
def _config_parser(cls, repo, parent_commit, read_only):
@@ -236,7 +236,7 @@ class Submodule(util.IndexObject, Iterable, Traversable):
# assure we never put backslashes into the url, as some operating systems
# like it ...
- if url != None:
+ if url is not None:
url = to_native_path_linux(url)
# END assure url correctness
@@ -449,7 +449,8 @@ class Submodule(util.IndexObject, Iterable, Traversable):
# handles dry_run
if mrepo is not None and mrepo.head.commit.binsha != binsha:
progress.update(BEGIN | UPDWKTREE, 0, 1, prefix +
- "Updating working tree at %s for submodule %r to revision %s" % (self.path, self.name, hexsha))
+ "Updating working tree at %s for submodule %r to revision %s"
+ % (self.path, self.name, hexsha))
if not dry_run:
if is_detached:
# NOTE: for now we force, the user is no supposed to change detached
@@ -638,7 +639,8 @@ class Submodule(util.IndexObject, Iterable, Traversable):
mod = self.module()
if mod.is_dirty(untracked_files=True):
raise InvalidGitRepositoryError(
- "Cannot delete module at %s with any modifications, unless force is specified" % mod.working_tree_dir)
+ "Cannot delete module at %s with any modifications, unless force is specified"
+ % mod.working_tree_dir)
# END check for dirt
# figure out whether we have new commits compared to the remotes
diff --git a/git/objects/submodule/root.py b/git/objects/submodule/root.py
index f68f7567..871cc21c 100644
--- a/git/objects/submodule/root.py
+++ b/git/objects/submodule/root.py
@@ -186,7 +186,9 @@ class RootModule(Submodule):
# in the new remote as well.
if len([r for r in smr.refs if r.remote_head == sm.branch_name]) == 0:
raise ValueError(
- "Submodule branch named %r was not available in new submodule remote at %r" % (sm.branch_name, sm.url))
+ "Submodule branch named %r was not available in new submodule remote at %r"
+ % (sm.branch_name, sm.url)
+ )
# END head is not detached
# now delete the changed one
@@ -245,7 +247,8 @@ class RootModule(Submodule):
# this way, it will be checked out in the next step
# This will change the submodule relative to us, so
# the user will be able to commit the change easily
- print >> sys.stderr, "WARNING: Current sha %s was not contained in the tracking branch at the new remote, setting it the the remote's tracking branch" % sm.hexsha
+ print >> sys.stderr, "WARNING: Current sha %s was not contained in the tracking\
+ branch at the new remote, setting it the the remote's tracking branch" % sm.hexsha
sm.binsha = rref.commit.binsha
# END reset binsha
@@ -262,7 +265,8 @@ class RootModule(Submodule):
# finally, create a new tracking branch which tracks the
# new remote branch
progress.update(BEGIN | BRANCHCHANGE, i, len_csms, prefix +
- "Changing branch of submodule %r from %s to %s" % (sm.name, psm.branch_path, sm.branch_path))
+ "Changing branch of submodule %r from %s to %s"
+ % (sm.name, psm.branch_path, sm.branch_path))
if not dry_run:
smm = sm.module()
smmr = smm.remotes
diff --git a/git/objects/tree.py b/git/objects/tree.py
index 9f63e4e3..beb5f1fd 100644
--- a/git/objects/tree.py
+++ b/git/objects/tree.py
@@ -187,7 +187,8 @@ class Tree(IndexObject, diff.Diffable, util.Traversable, util.Serializable):
else:
for info in self._cache:
if info[2] == file: # [2] == name
- return self._map_id_to_type[info[1] >> 12](self.repo, info[0], info[1], join_path(self.path, info[2]))
+ return self._map_id_to_type[info[1] >> 12](self.repo, info[0], info[1],
+ join_path(self.path, info[2]))
# END for each obj
raise KeyError(msg % file)
# END handle long paths
diff --git a/git/objects/util.py b/git/objects/util.py
index 76a24a6f..fdf9622b 100644
--- a/git/objects/util.py
+++ b/git/objects/util.py
@@ -15,7 +15,6 @@ from collections import deque as Deque
from string import digits
import time
import calendar
-import os
__all__ = ('get_object_type_by_name', 'parse_date', 'parse_actor_and_date',
'ProcessStreamAdapter', 'Traversable', 'altz_to_utctz_str', 'utctz_to_altz',
@@ -89,10 +88,10 @@ def verify_utctz(offset):
raise fmt_exc
if offset[0] not in "+-":
raise fmt_exc
- if offset[1] not in digits or \
- offset[2] not in digits or \
- offset[3] not in digits or \
- offset[4] not in digits:
+ if offset[1] not in digits or\
+ offset[2] not in digits or\
+ offset[3] not in digits or\
+ offset[4] not in digits:
raise fmt_exc
# END for each char
return offset
diff --git a/git/odict.py b/git/odict.py
index c4c80499..c505b7fd 100644
--- a/git/odict.py
+++ b/git/odict.py
@@ -616,8 +616,7 @@ class OrderedDict(dict):
TypeError: pop expected at most 2 arguments, got 3
"""
if len(args) > 1:
- raise TypeError, ('pop expected at most 2 arguments, got %s' %
- (len(args) + 1))
+ raise TypeError('pop expected at most 2 arguments, got %s' % (len(args) + 1))
if key in self:
val = self[key]
del self[key]
@@ -1199,7 +1198,7 @@ class Values(object):
keys = self._main._sequence[index]
if len(keys) != len(value):
raise ValueError('attempt to assign sequence of size %s '
- 'to slice of size %s' % (len(name), len(keys)))
+ 'to slice of size %s' % (len(value), len(keys)))
# FIXME: efficiency? Would be better to calculate the indexes
# directly from the slice object
# NOTE: the new keys can collide with existing keys (or even
@@ -1511,7 +1510,7 @@ class SequenceOrderedDict(OrderedDict):
def __setattr__(self, name, value):
"""Protect keys, items, and values."""
- if not '_att_dict' in self.__dict__:
+ if '_att_dict' not in self.__dict__:
object.__setattr__(self, name, value)
else:
try:
diff --git a/git/refs/__init__.py b/git/refs/__init__.py
index 3123b991..0281121a 100644
--- a/git/refs/__init__.py
+++ b/git/refs/__init__.py
@@ -1,21 +1,22 @@
+from __future__ import absolute_import
# import all modules in order, fix the names they require
-from symbolic import *
-from reference import *
-from head import *
-from tag import *
-from remote import *
+from .symbolic import *
+from .reference import *
+from .head import *
+from .tag import *
+from .remote import *
# name fixes
-import head
+from . import head
head.RemoteReference = RemoteReference
del(head)
-import symbolic
+from . import symbolic
for item in (HEAD, Head, RemoteReference, TagReference, Reference, SymbolicReference):
setattr(symbolic, item.__name__, item)
del(symbolic)
-from log import *
+from .log import *
diff --git a/git/refs/head.py b/git/refs/head.py
index 6f36a956..acdd37d6 100644
--- a/git/refs/head.py
+++ b/git/refs/head.py
@@ -210,9 +210,8 @@ class Head(Reference):
By default it is only allowed to checkout heads - everything else
will leave the HEAD detached which is allowed and possible, but remains
a special state that some tools might not be able to handle."""
- args = list()
kwargs['f'] = force
- if kwargs['f'] == False:
+ if kwargs['f'] is False:
kwargs.pop('f')
self.repo.git.checkout(self, **kwargs)
diff --git a/git/refs/log.py b/git/refs/log.py
index 742c9ccd..e3f3363c 100644
--- a/git/refs/log.py
+++ b/git/refs/log.py
@@ -1,5 +1,4 @@
from git.util import (
- join_path,
Actor,
LockedFD,
LockFile,
@@ -16,12 +15,10 @@ from gitdb.util import (
from git.objects.util import (
parse_date,
Serializable,
- utctz_to_altz,
altz_to_utctz_str,
)
import time
-import os
import re
__all__ = ["RefLog", "RefLogEntry"]
@@ -281,7 +278,6 @@ class RefLog(list, Serializable):
#{ Serializable Interface
def _serialize(self, stream):
- lm1 = len(self) - 1
write = stream.write
# write all entries
diff --git a/git/refs/reference.py b/git/refs/reference.py
index f71ded72..b07ac0cd 100644
--- a/git/refs/reference.py
+++ b/git/refs/reference.py
@@ -4,11 +4,6 @@ from git.util import (
Iterable,
)
-from gitdb.util import (
- isfile,
- hex_to_bin
-)
-
__all__ = ["Reference"]
#{ Utilities
diff --git a/git/refs/symbolic.py b/git/refs/symbolic.py
index 1e361244..2fa58d12 100644
--- a/git/refs/symbolic.py
+++ b/git/refs/symbolic.py
@@ -424,7 +424,7 @@ class SymbolicReference(object):
# in the line
# If we deleted the last line and this one is a tag-reference object,
# we drop it as well
- if ( line.startswith('#') or full_ref_path not in line ) and \
+ if (line.startswith('#') or full_ref_path not in line) and \
(not dropped_last_line or dropped_last_line and not line.startswith('^')):
new_lines.append(line)
dropped_last_line = False
@@ -623,6 +623,8 @@ class SymbolicReference(object):
if not path:
raise ValueError("Cannot create Reference from %r" % path)
+ # Names like HEAD are inserted after the refs module is imported - we have an import dependency
+ # cycle and don't want to import these names in-function
for ref_type in (HEAD, Head, RemoteReference, TagReference, Reference, SymbolicReference):
try:
instance = ref_type(repo, path)
diff --git a/git/remote.py b/git/remote.py
index 4742111a..44b7ffaa 100644
--- a/git/remote.py
+++ b/git/remote.py
@@ -32,7 +32,6 @@ from gitdb.util import join
import re
import os
-import sys
__all__ = ('RemoteProgress', 'PushInfo', 'FetchInfo', 'Remote')
@@ -329,7 +328,8 @@ class FetchInfo(object):
# always use actual type if we get absolute paths
# Will always be the case if something is fetched outside of refs/remotes (if its not a tag)
ref_path = remote_local_ref
- if ref_type is not TagReference and not remote_local_ref.startswith(RemoteReference._common_path_default + "/"):
+ if ref_type is not TagReference and not \
+ remote_local_ref.startswith(RemoteReference._common_path_default + "/"):
ref_type = Reference
# END downgrade remote reference
elif ref_type is TagReference and 'tags/' in remote_local_ref:
diff --git a/git/repo/__init__.py b/git/repo/__init__.py
index 09051bd4..3ae97e66 100644
--- a/git/repo/__init__.py
+++ b/git/repo/__init__.py
@@ -1,3 +1,3 @@
"""Initialize the Repo package"""
-
-from base import *
+from __future__ import absolute_import
+from .base import *
diff --git a/git/repo/base.py b/git/repo/base.py
index 174f29aa..d1af26e2 100644
--- a/git/repo/base.py
+++ b/git/repo/base.py
@@ -164,9 +164,6 @@ class Repo(object):
def __hash__(self):
return hash(self.git_dir)
- def __repr__(self):
- return "%s(%r)" % (type(self).__name__, self.git_dir)
-
# Description property
def _get_description(self):
filename = join(self.git_dir, 'description')
@@ -666,7 +663,7 @@ class Repo(object):
# git command automatically chdir into the directory
git = Git(path)
- output = git.init(**kwargs)
+ git.init(**kwargs)
return Repo(path)
@classmethod
diff --git a/git/test/lib/asserts.py b/git/test/lib/asserts.py
index 351901dc..6f6d8960 100644
--- a/git/test/lib/asserts.py
+++ b/git/test/lib/asserts.py
@@ -5,7 +5,6 @@
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
import re
-import unittest
from nose import tools
from nose.tools import *
import stat
diff --git a/git/test/lib/helper.py b/git/test/lib/helper.py
index 341f5789..a18f22ef 100644
--- a/git/test/lib/helper.py
+++ b/git/test/lib/helper.py
@@ -75,7 +75,7 @@ def _rmtree_onerror(osremove, fullpath, exec_info):
if os.name != 'nt' or osremove is not os.remove:
raise
- os.chmod(fullpath, 0777)
+ os.chmod(fullpath, 0o777)
os.remove(fullpath)
@@ -194,26 +194,27 @@ def with_rw_and_rw_remote_repo(working_tree_ref):
gd = Git().daemon(temp_dir, as_process=True)
# yes, I know ... fortunately, this is always going to work if sleep time is just large enough
time.sleep(0.5)
- except Exception as err:
+ except Exception:
gd = None
# end
# try to list remotes to diagnoes whether the server is up
try:
rw_repo.git.ls_remote(d_remote)
- except GitCommandError, e:
+ except GitCommandError as e:
# We assume in good faith that we didn't start the daemon - but make sure we kill it anyway
# Of course we expect it to work here already, but maybe there are timing constraints
# on some platforms ?
if gd is not None:
os.kill(gd.proc.pid, 15)
- print str(e)
+ print(str(e))
if os.name == 'nt':
- raise AssertionError(
- 'git-daemon needs to run this test, but windows does not have one. Otherwise, run: git-daemon "%s"' % temp_dir)
+ msg = "git-daemon needs to run this test, but windows does not have one. "
+ msg += 'Otherwise, run: git-daemon "%s"' % temp_dir
+ raise AssertionError(msg)
else:
- raise AssertionError(
- 'Please start a git-daemon to run this test, execute: git-daemon "%s"' % temp_dir)
+ msg = 'Please start a git-daemon to run this test, execute: git-daemon "%s"' % temp_dir
+ raise AssertionError(msg)
# END make assertion
# END catch ls remote error
diff --git a/git/test/performance/lib.py b/git/test/performance/lib.py
index e92e2b2d..928821ed 100644
--- a/git/test/performance/lib.py
+++ b/git/test/performance/lib.py
@@ -50,7 +50,8 @@ class TestBigRepoR(TestBase):
repo_path = os.environ.get(k_env_git_repo)
if repo_path is None:
logging.info(
- "You can set the %s environment variable to a .git repository of your choice - defaulting to the gitpython repository", k_env_git_repo)
+ ("You can set the %s environment variable to a .git repository of" % k_env_git_repo) +
+ "your choice - defaulting to the gitpython repository")
repo_path = os.path.dirname(__file__)
# end set some repo path
self.gitrorepo = Repo(repo_path, odbt=GitCmdObjectDB)
diff --git a/git/test/performance/test_odb.py b/git/test/performance/test_odb.py
index 9d857260..1b570fa7 100644
--- a/git/test/performance/test_odb.py
+++ b/git/test/performance/test_odb.py
@@ -61,9 +61,10 @@ class TestObjDBPerformance(TestBigRepoR):
# END for each bloblist
elapsed = time() - st
- print >> sys.stderr, "%s: Retrieved %i blob (%i KiB) and their data in %g s ( %f blobs / s, %f KiB / s )" % (
- type(repo.odb), nb, data_bytes / 1000, elapsed, nb / elapsed, (data_bytes / 1000) / elapsed)
+ msg = "%s: Retrieved %i blob (%i KiB) and their data in %g s ( %f blobs / s, %f KiB / s )"\
+ % (type(repo.odb), nb, data_bytes / 1000, elapsed, nb / elapsed, (data_bytes / 1000) / elapsed)
results[2].append(elapsed)
+ print >> sys.stderr, msg
# END for each repo type
# final results
diff --git a/git/test/performance/test_streams.py b/git/test/performance/test_streams.py
index facf9eed..18f19db3 100644
--- a/git/test/performance/test_streams.py
+++ b/git/test/performance/test_streams.py
@@ -44,8 +44,9 @@ class TestObjDBPerformance(TestBigRepoR):
fsize_kib = os.path.getsize(db_file) / 1000
size_kib = size / 1000
- print >> sys.stderr, "Added %i KiB (filesize = %i KiB) of %s data to loose odb in %f s ( %f Write KiB / s)" % (
- size_kib, fsize_kib, desc, elapsed_add, size_kib / elapsed_add)
+ msg = "Added %i KiB (filesize = %i KiB) of %s data to loose odb in %f s ( %f Write KiB / s)"
+ msg %= (size_kib, fsize_kib, desc, elapsed_add, size_kib / elapsed_add)
+ print >> sys.stderr, msg
# reading all at once
st = time()
@@ -55,8 +56,9 @@ class TestObjDBPerformance(TestBigRepoR):
stream.seek(0)
assert shadata == stream.getvalue()
- print >> sys.stderr, "Read %i KiB of %s data at once from loose odb in %f s ( %f Read KiB / s)" % (
- size_kib, desc, elapsed_readall, size_kib / elapsed_readall)
+ msg = "Read %i KiB of %s data at once from loose odb in %f s ( %f Read KiB / s)"
+ msg %= (size_kib, desc, elapsed_readall, size_kib / elapsed_readall)
+ print >> sys.stderr, msg
# reading in chunks of 1 MiB
cs = 512 * 1000
@@ -99,8 +101,9 @@ class TestObjDBPerformance(TestBigRepoR):
# as its the same sha, we reuse our path
fsize_kib = os.path.getsize(db_file) / 1000
- print >> sys.stderr, "Added %i KiB (filesize = %i KiB) of %s data to using git-hash-object in %f s ( %f Write KiB / s)" % (
- size_kib, fsize_kib, desc, gelapsed_add, size_kib / gelapsed_add)
+ msg = "Added %i KiB (filesize = %i KiB) of %s data to using git-hash-object in %f s ( %f Write KiB / s)"
+ msg %= (size_kib, fsize_kib, desc, gelapsed_add, size_kib / gelapsed_add)
+ print >> sys.stderr, msg
# compare ...
print >> sys.stderr, "Git-Python is %f %% faster than git when adding big %s files" % (
@@ -126,8 +129,9 @@ class TestObjDBPerformance(TestBigRepoR):
break
# END read stream
gelapsed_readchunks = time() - st
- print >> sys.stderr, "Read %i KiB of %s data in %i KiB chunks from git-cat-file in %f s ( %f Read KiB / s)" % (
- size_kib, desc, cs_kib, gelapsed_readchunks, size_kib / gelapsed_readchunks)
+ msg = "Read %i KiB of %s data in %i KiB chunks from git-cat-file in %f s ( %f Read KiB / s)"
+ msg %= (size_kib, desc, cs_kib, gelapsed_readchunks, size_kib / gelapsed_readchunks)
+ print >> sys.stderr, msg
# compare
print >> sys.stderr, "Git-Python is %f %% faster than git when reading big %s files in chunks" % (
diff --git a/git/test/test_actor.py b/git/test/test_actor.py
index 5ccf1d2e..ee968455 100644
--- a/git/test/test_actor.py
+++ b/git/test/test_actor.py
@@ -4,7 +4,6 @@
# This module is part of GitPython and is released under
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
-import os
from git.test.lib import *
from git import *
diff --git a/git/test/test_base.py b/git/test/test_base.py
index d1b57984..ea241f4c 100644
--- a/git/test/test_base.py
+++ b/git/test/test_base.py
@@ -5,15 +5,12 @@
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
import git.objects.base as base
-import git.refs as refs
import os
from git.test.lib import *
from git import *
-from itertools import chain
from git.objects.util import get_object_type_by_name
from gitdb.util import hex_to_bin
-import tempfile
class TestBase(TestBase):
diff --git a/git/test/test_blob.py b/git/test/test_blob.py
index ddd2893f..cf45d82a 100644
--- a/git/test/test_blob.py
+++ b/git/test/test_blob.py
@@ -6,7 +6,6 @@
from git.test.lib import *
from git import *
-from gitdb.util import hex_to_bin
class TestBlob(TestBase):
diff --git a/git/test/test_config.py b/git/test/test_config.py
index 0e5396a3..3e435c47 100644
--- a/git/test/test_config.py
+++ b/git/test/test_config.py
@@ -74,7 +74,7 @@ class TestBase(TestCase):
num_options = 0
# test reader methods
- assert r_config._is_initialized == False
+ assert r_config._is_initialized is False
for section in r_config.sections():
num_sections += 1
for option in r_config.options(section):
@@ -93,7 +93,7 @@ class TestBase(TestCase):
self.failUnlessRaises(IOError, r_config.remove_section, section)
# END for each section
assert num_sections and num_options
- assert r_config._is_initialized == True
+ assert r_config._is_initialized is True
# get value which doesnt exist, with default
default = "my default value"
diff --git a/git/test/test_diff.py b/git/test/test_diff.py
index 151a3d14..8e2cef4b 100644
--- a/git/test/test_diff.py
+++ b/git/test/test_diff.py
@@ -54,7 +54,7 @@ class TestDiff(TestBase):
for fixture_name in fixtures:
diff_proc = StringProcessAdapter(fixture(fixture_name))
- diffs = Diff._index_from_patch_format(self.rorepo, diff_proc.stdout)
+ Diff._index_from_patch_format(self.rorepo, diff_proc.stdout)
# END for each fixture
def test_diff_interface(self):
diff --git a/git/test/test_index.py b/git/test/test_index.py
index 3f85ea90..08dfdd12 100644
--- a/git/test/test_index.py
+++ b/git/test/test_index.py
@@ -7,13 +7,14 @@
from git.test.lib import *
from git import *
from gitdb.util import hex_to_bin
-import inspect
import os
import sys
import tempfile
-import glob
import shutil
-from stat import *
+from stat import (
+ S_ISLNK,
+ ST_MODE
+)
from StringIO import StringIO
from gitdb.base import IStream
@@ -60,7 +61,7 @@ class TestIndex(TestBase):
for entry in entries:
assert isinstance(entry, BaseIndexEntry)
assert not os.path.isabs(entry.path)
- assert not "\\" in entry.path
+ assert "\\" not in entry.path
# END for each entry
def test_index_file_base(self):
@@ -70,11 +71,10 @@ class TestIndex(TestBase):
assert index.version > 0
# test entry
- last_val = None
entry = index.entries.itervalues().next()
for attr in ("path", "ctime", "mtime", "dev", "inode", "mode", "uid",
"gid", "size", "binsha", "hexsha", "stage"):
- val = getattr(entry, attr)
+ getattr(entry, attr)
# END for each method
# test update
@@ -100,7 +100,6 @@ class TestIndex(TestBase):
if isinstance(tree, str):
tree = self.rorepo.commit(tree).tree
- num_blobs = 0
blist = list()
for blob in tree.traverse(predicate=lambda e, d: e.type == "blob", branch_first=False):
assert (blob.path, 0) in index.entries
@@ -240,7 +239,7 @@ class TestIndex(TestBase):
# resetting the head will leave the index in a different state, and the
# diff will yield a few changes
cur_head_commit = rw_repo.head.reference.commit
- ref = rw_repo.head.reset('HEAD~6', index=True, working_tree=False)
+ rw_repo.head.reset('HEAD~6', index=True, working_tree=False)
# diff against same index is 0
diff = index.diff()
@@ -468,7 +467,7 @@ class TestIndex(TestBase):
entries = index.reset(new_commit).add(
[os.path.abspath(os.path.join('lib', 'git', 'head.py'))] * 2, fprogress=self._fprogress_add)
self._assert_entries(entries)
- assert entries[0].mode & 0644 == 0644
+ assert entries[0].mode & 0o644 == 0o644
# would fail, test is too primitive to handle this case
# self._assert_fprogress(entries)
self._reset_progress()
@@ -492,9 +491,9 @@ class TestIndex(TestBase):
# add new file
new_file_relapath = "my_new_file"
- new_file_path = self._make_file(new_file_relapath, "hello world", rw_repo)
+ self._make_file(new_file_relapath, "hello world", rw_repo)
entries = index.reset(new_commit).add(
- [BaseIndexEntry((010644, null_bin_sha, 0, new_file_relapath))], fprogress=self._fprogress_add)
+ [BaseIndexEntry((0o10644, null_bin_sha, 0, new_file_relapath))], fprogress=self._fprogress_add)
self._assert_entries(entries)
self._assert_fprogress(entries)
assert len(entries) == 1 and entries[0].hexsha != null_hex_sha
@@ -519,7 +518,7 @@ class TestIndex(TestBase):
fake_symlink_relapath = "my_fake_symlink"
link_target = "/etc/that"
fake_symlink_path = self._make_file(fake_symlink_relapath, link_target, rw_repo)
- fake_entry = BaseIndexEntry((0120000, null_bin_sha, 0, fake_symlink_relapath))
+ fake_entry = BaseIndexEntry((0o120000, null_bin_sha, 0, fake_symlink_relapath))
entries = index.reset(new_commit).add([fake_entry], fprogress=self._fprogress_add)
self._assert_entries(entries)
self._assert_fprogress(entries)
@@ -527,7 +526,7 @@ class TestIndex(TestBase):
assert len(entries) == 1 and S_ISLNK(entries[0].mode)
# assure this also works with an alternate method
- full_index_entry = IndexEntry.from_base(BaseIndexEntry((0120000, entries[0].binsha, 0, entries[0].path)))
+ full_index_entry = IndexEntry.from_base(BaseIndexEntry((0o120000, entries[0].binsha, 0, entries[0].path)))
entry_key = index.entry_key(full_index_entry)
index.reset(new_commit)
@@ -605,7 +604,7 @@ class TestIndex(TestBase):
for fid in range(3):
fname = 'newfile%i' % fid
open(fname, 'wb').write("abcd")
- yield Blob(rw_repo, Blob.NULL_BIN_SHA, 0100644, fname)
+ yield Blob(rw_repo, Blob.NULL_BIN_SHA, 0o100644, fname)
# END for each new file
# END path producer
paths = list(make_paths())
@@ -627,7 +626,7 @@ class TestIndex(TestBase):
files = (arela, brela)
for fkey in keys:
- assert not fkey in index.entries
+ assert fkey not in index.entries
index.add(files, write=True)
nc = index.commit("2 files committed", head=False)
@@ -637,7 +636,7 @@ class TestIndex(TestBase):
# just the index
index.reset(paths=(arela, afile))
- assert not akey in index.entries
+ assert akey not in index.entries
assert bkey in index.entries
# now with working tree - files on disk as well as entries must be recreated
@@ -690,10 +689,10 @@ class TestIndex(TestBase):
filename = 'my-imaginary-file'
istream = rw_bare_repo.odb.store(
IStream(Blob.type, filesize, fileobj))
- entry = BaseIndexEntry((100644, istream.binsha, 0, filename))
+ entry = BaseIndexEntry((0o100644, istream.binsha, 0, filename))
try:
rw_bare_repo.index.add([entry])
- except AssertionError, e:
+ except AssertionError:
self.fail("Adding to the index of a bare repo is not allowed.")
# Adding using a path should still require a non-bare repository.
@@ -701,6 +700,6 @@ class TestIndex(TestBase):
path = os.path.join('git', 'test', 'test_index.py')
try:
rw_bare_repo.index.add([path])
- except Exception, e:
+ except Exception as e:
asserted = "does not have a working tree" in e.message
assert asserted, "Adding using a filename is not correctly asserted."
diff --git a/git/test/test_refs.py b/git/test/test_refs.py
index c4f7077b..4df3fa8a 100644
--- a/git/test/test_refs.py
+++ b/git/test/test_refs.py
@@ -155,10 +155,10 @@ class TestRefs(TestBase):
assert len(types_found) >= 3
def test_is_valid(self):
- assert Reference(self.rorepo, 'refs/doesnt/exist').is_valid() == False
+ assert not Reference(self.rorepo, 'refs/doesnt/exist').is_valid()
assert self.rorepo.head.is_valid()
assert self.rorepo.head.reference.is_valid()
- assert SymbolicReference(self.rorepo, 'hellothere').is_valid() == False
+ assert not SymbolicReference(self.rorepo, 'hellothere').is_valid()
def test_orig_head(self):
assert type(self.rorepo.head.orig_head()) == SymbolicReference
diff --git a/git/test/test_remote.py b/git/test/test_remote.py
index c9329f25..d49a9061 100644
--- a/git/test/test_remote.py
+++ b/git/test/test_remote.py
@@ -259,7 +259,6 @@ class TestRemote(TestBase):
def _assert_push_and_pull(self, remote, rw_repo, remote_repo):
# push our changes
lhead = rw_repo.head
- lindex = rw_repo.index
# assure we are on master and it is checked out where the remote is
try:
lhead.reference = rw_repo.heads.master
@@ -448,7 +447,8 @@ class TestRemote(TestBase):
def test_fetch_info(self):
# assure we can handle remote-tracking branches
- fetch_info_line_fmt = "c437ee5deb8d00cf02f03720693e4c802e99f390 not-for-merge %s '0.3' of git://github.com/gitpython-developers/GitPython"
+ fetch_info_line_fmt = "c437ee5deb8d00cf02f03720693e4c802e99f390 not-for-merge %s '0.3' of "
+ fetch_info_line_fmt += "git://github.com/gitpython-developers/GitPython"
remote_info_line_fmt = "* [new branch] nomatter -> %s"
fi = FetchInfo._from_line(self.rorepo,
remote_info_line_fmt % "local/master",
diff --git a/git/test/test_repo.py b/git/test/test_repo.py
index d4069670..3f1a3a3c 100644
--- a/git/test/test_repo.py
+++ b/git/test/test_repo.py
@@ -7,7 +7,6 @@ from git.test.lib import (patch,
TestBase,
with_rw_repo,
fixture,
- GIT_REPO,
assert_false,
assert_equal,
assert_true,
@@ -15,7 +14,7 @@ from git.test.lib import (patch,
from git import *
from git.util import join_path_native
from git.exc import BadObject
-from gitdb.util import hex_to_bin, bin_to_hex
+from gitdb.util import bin_to_hex
import os
import sys
@@ -143,7 +142,7 @@ class TestRepo(TestBase):
for path in (git_dir_rela, git_dir_abs):
r = Repo.init(path=path, bare=True)
assert isinstance(r, Repo)
- assert r.bare == True
+ assert r.bare is True
assert os.path.isdir(r.git_dir)
self._assert_empty_repo(r)
@@ -179,7 +178,7 @@ class TestRepo(TestBase):
os.makedirs(git_dir_rela)
os.chdir(git_dir_rela)
r = Repo.init(bare=False)
- r.bare == False
+ assert r.bare is False
self._assert_empty_repo(r)
finally:
@@ -230,7 +229,7 @@ class TestRepo(TestBase):
# END index
orig_val = self.rorepo._bare
self.rorepo._bare = True
- assert self.rorepo.is_dirty() == False
+ assert self.rorepo.is_dirty() is False
self.rorepo._bare = orig_val
def test_head(self):
@@ -280,7 +279,7 @@ class TestRepo(TestBase):
for item in self.rorepo.head.commit.tree.traverse(
predicate=lambda i, d: i.type == 'blob' and i.path.endswith('.py')):
c += 1
- b = self.rorepo.blame(self.rorepo.head, item.path)
+ self.rorepo.blame(self.rorepo.head, item.path)
# END for each item to traverse
assert c
@@ -503,7 +502,7 @@ class TestRepo(TestBase):
assert obj.type == ref.object.type
num_resolved += 1
except BadObject:
- print "failed on %s" % path_section
+ print ("failed on %s" % path_section)
# is fine, in case we have something like 112, which belongs to remotes/rname/merge-requests/112
pass
# END exception handling
diff --git a/git/test/test_submodule.py b/git/test/test_submodule.py
index 9c0085e8..e3223c42 100644
--- a/git/test/test_submodule.py
+++ b/git/test/test_submodule.py
@@ -32,7 +32,7 @@ class TestRootProgress(RootUpdateProgress):
"""Just prints messages, for now without checking the correctness of the states"""
def update(self, op, index, max_count, message=''):
- print message
+ print(message)
prog = TestRootProgress()
@@ -107,7 +107,6 @@ class TestSubmodule(TestBase):
# END handle bare repo
# make the old into a new - this doesn't work as the name changed
- prev_parent_commit = smold.parent_commit
self.failUnlessRaises(ValueError, smold.set_parent_commit, self.k_subm_current)
# the sha is properly updated
smold.set_parent_commit(self.k_subm_changed + "~1")
@@ -343,7 +342,6 @@ class TestSubmodule(TestBase):
# rename a module
nmp = join_path_native("new", "module", "dir") + "/" # new module path
pmp = nsm.path
- abspmp = nsm.abspath
assert nsm.move(nmp) is nsm
nmp = nmp[:-1] # cut last /
nmpl = to_native_path_linux(nmp)
diff --git a/git/test/test_tree.py b/git/test/test_tree.py
index 2c740f1a..adcb854f 100644
--- a/git/test/test_tree.py
+++ b/git/test/test_tree.py
@@ -7,10 +7,7 @@
import os
from git.test.lib import *
from git import *
-from git.objects.fun import (
- traverse_tree_recursive,
- traverse_trees_recursive
-)
+
from cStringIO import StringIO
diff --git a/git/test/test_util.py b/git/test/test_util.py
index 1ba855af..28aefa61 100644
--- a/git/test/test_util.py
+++ b/git/test/test_util.py
@@ -4,7 +4,6 @@
# This module is part of GitPython and is released under
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
-import os
import tempfile
from git.util import *
diff --git a/git/util.py b/git/util.py
index 0408e384..c29ed70b 100644
--- a/git/util.py
+++ b/git/util.py
@@ -17,6 +17,8 @@ import getpass
# Handle once test-cases are back up and running.
from exc import GitCommandError
+# Most of these are unused here, but are for use by git-python modules so these
+# don't see gitdb all the time. Flake of course doesn't like it.
from gitdb.util import (
make_sha,
LockedFD,
@@ -130,7 +132,7 @@ def finalize_process(proc):
"""Wait for the process (clone, fetch, pull or push) and handle its errors accordingly"""
try:
proc.wait()
- except GitCommandError, e:
+ except GitCommandError:
# if a push has rejected items, the command has non-zero return status
# a return status of 128 indicates a connection error - reraise the previous one
if proc.poll() == 128:
diff --git a/requirements.txt b/requirements.txt
index c9260b12..eedd6466 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,2 +1,2 @@
GitPython
-gitdb>=0.6.0
+gitdb>=0.6.1
diff --git a/setup.py b/setup.py
index 33f59c01..5a4dd9e3 100755
--- a/setup.py
+++ b/setup.py
@@ -66,7 +66,7 @@ def _stamp_version(filename):
else:
print >> sys.stderr, "WARNING: Couldn't find version line in file %s" % filename
-install_requires = ['gitdb >= 0.6.0']
+install_requires = ['gitdb >= 0.6.1']
setup(
name="GitPython",
@@ -81,7 +81,7 @@ setup(
package_data={'git.test': ['fixtures/*']},
package_dir={'git': 'git'},
license="BSD License",
- requires=['gitdb (>=0.6.0)'],
+ requires=['gitdb (>=0.6.1)'],
install_requires=install_requires,
test_requirements=['mock', 'nose'] + install_requires,
zip_safe=False,
diff --git a/tox.ini b/tox.ini
index 4d827357..2b743870 100644
--- a/tox.ini
+++ b/tox.ini
@@ -17,4 +17,6 @@ commands = {posargs}
[flake8]
#show-source = True
+ignore = E265,F403
+max-line-length = 120
exclude = .tox,.venv,build,dist,doc,git/ext/