Skip to content

Commit

Permalink
Merge pull request gitpython-developers#737 from hugovk/rm-2.6
Browse files Browse the repository at this point in the history
Drop support for EOL Python 2.6 and 3.3
  • Loading branch information
Byron authored Mar 24, 2018
2 parents b5df434 + 97f0fb9 commit 558f03c
Show file tree
Hide file tree
Showing 47 changed files with 127 additions and 229 deletions.
3 changes: 0 additions & 3 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ 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%"
Expand Down
4 changes: 0 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
language: python
python:
- "2.6"
- "2.7"
- "3.3"
- "3.4"
- "3.5"
- "3.6"
Expand All @@ -12,7 +10,6 @@ python:
# - "pypy" - won't work as smmap doesn't work (see gitdb/.travis.yml for details)
matrix:
allow_failures:
- python: "2.6"
- python: "3.6-dev"
- python: "3.7-dev"
- python: "nightly"
Expand All @@ -26,7 +23,6 @@ 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
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
### How to contribute

* [fork this project](https://github.com/gitpython-developers/GitPython/fork) on github
* [fork this project](https://github.com/gitpython-developers/GitPython/fork) on GitHub
* For setting up the environment to run the self tests, look at `.travis.yml`.
* Add yourself to AUTHORS.md and write your patch. **Write a test that fails unless your patch is present.**
* Initiate a pull request
Expand Down
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ If it is not in your `PATH`, you can help GitPython find it by setting
the `GIT_PYTHON_GIT_EXECUTABLE=<path/to/git>` environment variable.

* Git (1.7.x or newer)
* Python 2.7 to 3.6, while python 2.6 is supported on a *best-effort basis*.
* Python 2.7 to 3.6.

The list of dependencies are listed in `./requirements.txt` and `./test-requirements.txt`.
The installer takes care of installing them for you.
Expand Down Expand Up @@ -68,10 +68,6 @@ For *Windows*, we do regularly test it on [Appveyor CI](https://www.appveyor.com
but not all test-cases pass - you may help improve them by exploring
[Issue #525](https://github.com/gitpython-developers/GitPython/issues/525).

#### Python 2.6

Python 2.6 is supported on best-effort basis; which means that it is likely to deteriorate over time.

### RUNNING TESTS

*Important*: Right after cloning this repository, please be sure to have executed
Expand Down
10 changes: 5 additions & 5 deletions doc/source/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,13 @@ Please note that due to breaking changes, we have to increase the major version.
with large repositories.
* CRITICAL: fixed incorrect `Commit` object serialization when authored or commit date had timezones which were not
divisiblej by 3600 seconds. This would happen if the timezone was something like `+0530` for instance.
* A list of all additional fixes can be found `on github <https://github.com/gitpython-developers/GitPython/issues?q=milestone%3A%22v1.0.2+-+Fixes%22+is%3Aclosed>`_
* A list of all additional fixes can be found `on GitHub <https://github.com/gitpython-developers/GitPython/issues?q=milestone%3A%22v1.0.2+-+Fixes%22+is%3Aclosed>`_
* CRITICAL: `Tree.cache` was removed without replacement. It is technically impossible to change individual trees and expect their serialization results to be consistent with what *git* expects. Instead, use the `IndexFile` facilities to adjust the content of the staging area, and write it out to the respective tree objects using `IndexFile.write_tree()` instead.

1.0.1 - Fixes
=============

* A list of all issues can be found `on github <https://github.com/gitpython-developers/GitPython/issues?q=milestone%3A%22v1.0.1+-+Fixes%22+is%3Aclosed>`_
* A list of all issues can be found `on GitHub <https://github.com/gitpython-developers/GitPython/issues?q=milestone%3A%22v1.0.1+-+Fixes%22+is%3Aclosed>`_

1.0.0 - Notes
=============
Expand All @@ -191,7 +191,7 @@ It follows the `semantic version scheme <http://semver.org>`_, and thus will not

- Those who support **GUI on windows** will now have to set `git.Git.USE_SHELL = True` to get the previous behaviour.

* A list of all issues can be found `on github <https://github.com/gitpython-developers/GitPython/issues?q=milestone%3A%22v0.3.7+-+Fixes%22+is%3Aclosed>`_
* A list of all issues can be found `on GitHub <https://github.com/gitpython-developers/GitPython/issues?q=milestone%3A%22v0.3.7+-+Fixes%22+is%3Aclosed>`_


0.3.6 - Features
Expand All @@ -207,11 +207,11 @@ It follows the `semantic version scheme <http://semver.org>`_, and thus will not
* Repo.working_tree_dir now returns None if it is bare. Previously it raised AssertionError.
* IndexFile.add() previously raised AssertionError when paths where used with bare repository, now it raises InvalidGitRepositoryError

* Added `Repo.merge_base()` implementation. See the `respective issue on github <https://github.com/gitpython-developers/GitPython/issues/169>`_
* Added `Repo.merge_base()` implementation. See the `respective issue on GitHub <https://github.com/gitpython-developers/GitPython/issues/169>`_
* `[include]` sections in git configuration files are now respected
* Added `GitConfigParser.rename_section()`
* Added `Submodule.rename()`
* A list of all issues can be found `on github <https://github.com/gitpython-developers/GitPython/issues?q=milestone%3A%22v0.3.6+-+Features%22+>`_
* A list of all issues can be found `on GitHub <https://github.com/gitpython-developers/GitPython/issues?q=milestone%3A%22v0.3.6+-+Features%22+>`_

0.3.5 - Bugfixes
================
Expand Down
10 changes: 1 addition & 9 deletions doc/source/intro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ Requirements
============

* `Python`_ 2.7 or newer
Since GitPython 2.0.0. Please note that python 2.6 is still reasonably well supported, but might
deteriorate over time. Support is provided on a best-effort basis only.
* `Git`_ 1.7.0 or newer
It should also work with older versions, but it may be that some operations
involving remotes will not work as expected.
Expand Down Expand Up @@ -75,12 +73,6 @@ codebase for `__del__` implementations and call these yourself when you see fit.
Another way assure proper cleanup of resources is to factor out GitPython into a
separate process which can be dropped periodically.

Best-effort for Python 2.6 and Windows support
----------------------------------------------

This means that support for these platforms is likely to worsen over time
as they are kept alive solely by their users, or not.

Getting Started
===============

Expand Down Expand Up @@ -124,7 +116,7 @@ http://stackoverflow.com/questions/tagged/gitpython

Issue Tracker
=============
The issue tracker is hosted by github:
The issue tracker is hosted by GitHub:

https://github.com/gitpython-developers/GitPython/issues

Expand Down
2 changes: 1 addition & 1 deletion doc/source/roadmap.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#######
Roadmap
#######
The full list of milestones including associated tasks can be found on github:
The full list of milestones including associated tasks can be found on GitHub:
https://github.com/gitpython-developers/GitPython/issues

Select the respective milestone to filter the list of issues accordingly.
Expand Down
27 changes: 13 additions & 14 deletions git/cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import subprocess
import sys
import threading
from collections import OrderedDict
from textwrap import dedent

from git.compat import (
Expand All @@ -31,7 +32,6 @@
is_win,
)
from git.exc import CommandError
from git.odict import OrderedDict
from git.util import is_cygwin_git, cygpath, expand_path

from .exc import (
Expand All @@ -44,10 +44,10 @@
)


execute_kwargs = set(('istream', 'with_extended_output',
'with_exceptions', 'as_process', 'stdout_as_string',
'output_stream', 'with_stdout', 'kill_after_timeout',
'universal_newlines', 'shell', 'env'))
execute_kwargs = {'istream', 'with_extended_output', 'with_exceptions',
'as_process', 'stdout_as_string', 'output_stream',
'with_stdout', 'kill_after_timeout', 'universal_newlines',
'shell', 'env'}

log = logging.getLogger(__name__)
log.addHandler(logging.NullHandler())
Expand Down Expand Up @@ -125,7 +125,7 @@ def dashify(string):


def slots_to_dict(self, exclude=()):
return dict((s, getattr(self, s)) for s in self.__slots__ if s not in exclude)
return {s: getattr(self, s) for s in self.__slots__ if s not in exclude}


def dict_to_slots_and__excluded_are_none(self, d, excluded=()):
Expand All @@ -143,8 +143,7 @@ def dict_to_slots_and__excluded_are_none(self, d, excluded=()):
## CREATE_NEW_PROCESS_GROUP is needed to allow killing it afterwards,
# 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 and sys.version_info >= (2, 7)
else 0)
if is_win else 0)


class Git(LazyMixin):
Expand Down Expand Up @@ -486,10 +485,10 @@ def readline(self, size=-1):

def readlines(self, size=-1):
if self._nbr == self._size:
return list()
return []

# leave all additional logic to our readline method, we just check the size
out = list()
out = []
nbr = 0
while True:
line = self.readline()
Expand Down Expand Up @@ -895,7 +894,7 @@ def transform_kwarg(self, name, value, split_single_char_options):

def transform_kwargs(self, split_single_char_options=True, **kwargs):
"""Transforms Python style kwargs into git command line options."""
args = list()
args = []
kwargs = OrderedDict(sorted(kwargs.items(), key=lambda x: x[0]))
for k, v in kwargs.items():
if isinstance(v, (list, tuple)):
Expand All @@ -914,7 +913,7 @@ def __unpack_args(cls, arg_list):
return [arg_list.encode(defenc)]
return [str(arg_list)]

outlist = list()
outlist = []
for arg in arg_list:
if isinstance(arg_list, (list, tuple)):
outlist.extend(cls.__unpack_args(arg))
Expand Down Expand Up @@ -973,8 +972,8 @@ 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.
exec_kwargs = dict((k, v) for k, v in kwargs.items() if k in execute_kwargs)
opts_kwargs = dict((k, v) for k, v in kwargs.items() if k not in execute_kwargs)
exec_kwargs = {k: v for k, v in kwargs.items() if k in execute_kwargs}
opts_kwargs = {k: v for k, v in kwargs.items() if k not in execute_kwargs}

insert_after_this_arg = opts_kwargs.pop('insert_kwargs_after', None)

Expand Down
2 changes: 1 addition & 1 deletion git/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import logging
import os
import re
from collections import OrderedDict

from git.compat import (
string_types,
Expand All @@ -21,7 +22,6 @@
with_metaclass,
PY3
)
from git.odict import OrderedDict
from git.util import LockFile

import os.path as osp
Expand Down
4 changes: 2 additions & 2 deletions git/diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class Diffable(object):
:note:
Subclasses require a repo member as it is the case for Object instances, for practical
reasons we do not derive from Object."""
__slots__ = tuple()
__slots__ = ()

# standin indicating you want to diff against the index
class Index(object):
Expand Down Expand Up @@ -106,7 +106,7 @@ def diff(self, other=Index, paths=None, create_patch=False, **kwargs):
:note:
On a bare repository, 'other' needs to be provided as Index or as
as Tree/Commit, or a git command error will occur"""
args = list()
args = []
args.append("--abbrev=40") # we need full shas
args.append("--full-index") # get full index paths, not only filenames

Expand Down
32 changes: 16 additions & 16 deletions git/index/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def _set_cache_(self, attr):
ok = True
except OSError:
# in new repositories, there may be no index, which means we are empty
self.entries = dict()
self.entries = {}
return
finally:
if not ok:
Expand Down Expand Up @@ -316,7 +316,7 @@ def from_tree(cls, repo, *treeish, **kwargs):
if len(treeish) == 0 or len(treeish) > 3:
raise ValueError("Please specify between 1 and 3 treeish, got %i" % len(treeish))

arg_list = list()
arg_list = []
# ignore that working tree and index possibly are out of date
if len(treeish) > 1:
# drop unmerged entries when reading our index and merging
Expand Down Expand Up @@ -463,9 +463,9 @@ def unmerged_blobs(self):
are at stage 3 will not have a stage 3 entry.
"""
is_unmerged_blob = lambda t: t[0] != 0
path_map = dict()
path_map = {}
for stage, blob in self.iter_blobs(is_unmerged_blob):
path_map.setdefault(blob.path, list()).append((stage, blob))
path_map.setdefault(blob.path, []).append((stage, blob))
# END for each unmerged blob
for l in mviter(path_map):
l.sort()
Expand Down Expand Up @@ -568,8 +568,8 @@ def _to_relative_path(self, path):

def _preprocess_add_items(self, items):
""" Split the items into two lists of path strings and BaseEntries. """
paths = list()
entries = list()
paths = []
entries = []

for item in items:
if isinstance(item, string_types):
Expand Down Expand Up @@ -602,7 +602,7 @@ def _store_path(self, filepath, fprogress):
@unbare_repo
@git_working_dir
def _entries_for_paths(self, paths, path_rewriter, fprogress, entries):
entries_added = list()
entries_added = []
if path_rewriter:
for path in paths:
if osp.isabs(path):
Expand Down Expand Up @@ -734,7 +734,7 @@ def add(self, items, force=True, fprogress=lambda *args: None, path_rewriter=Non
# automatically
# paths can be git-added, for everything else we use git-update-index
paths, entries = self._preprocess_add_items(items)
entries_added = list()
entries_added = []
# This code needs a working tree, therefore we try not to run it unless required.
# That way, we are OK on a bare repository as well.
# If there are no paths, the rewriter has nothing to do either
Expand Down Expand Up @@ -801,7 +801,7 @@ def handle_null_entries(self):
def _items_to_rela_paths(self, items):
"""Returns a list of repo-relative paths from the given items which
may be absolute or relative paths, entries or blobs"""
paths = list()
paths = []
for item in items:
if isinstance(item, (BaseIndexEntry, (Blob, Submodule))):
paths.append(self._to_relative_path(item.path))
Expand Down Expand Up @@ -850,7 +850,7 @@ def remove(self, items, working_tree=False, **kwargs):
been removed effectively.
This is interesting to know in case you have provided a directory or
globs. Paths are relative to the repository. """
args = list()
args = []
if not working_tree:
args.append("--cached")
args.append("--")
Expand Down Expand Up @@ -889,7 +889,7 @@ def move(self, items, skip_errors=False, **kwargs):
:raise ValueError: If only one item was given
GitCommandError: If git could not handle your request"""
args = list()
args = []
if skip_errors:
args.append('-k')

Expand All @@ -902,7 +902,7 @@ def move(self, items, skip_errors=False, **kwargs):

# first execute rename in dryrun so the command tells us what it actually does
# ( for later output )
out = list()
out = []
mvlines = self.repo.git.mv(args, paths, **kwargs).splitlines()

# parse result - first 0:n/2 lines are 'checking ', the remaining ones
Expand Down Expand Up @@ -1033,9 +1033,9 @@ def handle_stderr(proc, iter_checked_out_files):
# line contents:
stderr = stderr.decode(defenc)
# git-checkout-index: this already exists
failed_files = list()
failed_reasons = list()
unknown_lines = list()
failed_files = []
failed_reasons = []
unknown_lines = []
endings = (' already exists', ' is not in the cache', ' does not exist at stage', ' is unmerged')
for line in stderr.splitlines():
if not line.startswith("git checkout-index: ") and not line.startswith("git-checkout-index: "):
Expand Down Expand Up @@ -1098,7 +1098,7 @@ def handle_stderr(proc, iter_checked_out_files):
proc = self.repo.git.checkout_index(args, **kwargs)
# FIXME: Reading from GIL!
make_exc = lambda: GitCommandError(("git-checkout-index",) + tuple(args), 128, proc.stderr.read())
checked_out_files = list()
checked_out_files = []

for path in paths:
co_path = to_native_path_linux(self._to_relative_path(path))
Expand Down
Loading

0 comments on commit 558f03c

Please sign in to comment.