8000 Merge pull request #737 from hugovk/rm-2.6 · pythonthings/GitPython@f3265bd · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f3265bd

Browse files
authored
Merge pull request gitpython-developers#737 from hugovk/rm-2.6
Drop support for EOL Python 2.6 and 3.3
2 parents 9f12b26 + 80b038f commit f3265bd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+127
-229
lines changed

.appveyor.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ environment:
77
matrix:
88
## MINGW
99
#
10-
- PYTHON: "C:\\Python26"
11-
PYTHON_VERSION: "2.6"
12-
GIT_PATH: "%GIT_DAEMON_PATH%"
1310
- PYTHON: "C:\\Python27"
1411
PYTHON_VERSION: "2.7"
1512
GIT_PATH: "%GIT_DAEMON_PATH%"

.travis.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
language: python
22
python:
3-
- "2.6"
43
- "2.7"
5-
- "3.3"
64
- "3.4"
75
- "3.5"
86
- "3.6"
@@ -12,7 +10,6 @@ python:
1210
# - "pypy" - won't work as smmap doesn't work (see gitdb/.travis.yml for details)
1311
matrix:
1412
allow_failures:
15-
- python: "2.6"
1613
- python: "3.6-dev"
1714
- python: "3.7-dev"
1815
- python: "nightly"
@@ -26,7 +23,6 @@ install:
2623
- git fetch --tags
2724
- pip install -r test-requirements.txt
2825
- pip install codecov sphinx
29-
- if [ "$TRAVIS_PYTHON_VERSION" == '2.6' ]; then pip install unittest2; fi
3026

3127
# generate some reflog as git-python tests need it (in master)
3228
- ./init-tests-after-clone.sh

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
### How to contribute
22

3-
* [fork this project](https://github.com/gitpython-developers/GitPython/fork) on github
3+
* [fork this project](https://github.com/gitpython-developers/GitPython/fork) on GitHub
44
* For setting up the environment to run the self tests, look at `.travis.yml`.
55
* Add yourself to AUTHORS.md and write your patch. **Write a test that fails unless your patch is present.**
66
* Initiate a pull request

README.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ If it is not in your `PATH`, you can help GitPython find it by setting
1919
the `GIT_PYTHON_GIT_EXECUTABLE=<path/to/git>` environment variable.
2020

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

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

71-
#### Python 2.6
72-
73-
Python 2.6 is supported on best-effort basis; which means that it is likely to deteriorate over time.
74-
7571
### RUNNING TESTS
7672

7773
*Important*: Right after cloning this repository, please be sure to have executed

doc/source/changes.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -161,13 +161,13 @@ Please note that due to breaking changes, we have to increase the major version.
161161
with large repositories.
162162
* CRITICAL: fixed incorrect `Commit` object serialization when authored or commit date had timezones which were not
163163
divisiblej by 3600 seconds. This would happen if the timezone was something like `+0530` for instance.
164-
* 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>`_
164+
* 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>`_
165165
* 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.
166166

167167
1.0.1 - Fixes
168168
=============
169169

170-
* 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>`_
170+
* 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>`_
171171

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

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

194-
* 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>`_
194+
* 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>`_
195195

196196

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

210-
* Added `Repo.merge_base()` implementation. See the `respective issue on github <https://github.com/gitpython-developers/GitPython/issues/169>`_
210+
* Added `Repo.merge_base()` implementation. See the `respective issue on GitHub <https://github.com/gitpython-developers/GitPython/issues/169>`_
211211
* `[include]` sections in git configuration files are now respected
212212
* Added `GitConfigParser.rename_section()`
213213
* Added `Submodule.rename()`
214-
* 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+>`_
214+
* 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+>`_
215215

216216
0.3.5 - Bugfixes
217217
================

doc/source/intro.rst

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ Requirements
1414
============
1515

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

78-
Best-effort for Python 2.6 and Windows support
79-
----------------------------------------------
80-
81-
This means that support for these platforms is likely to worsen over time
82-
as they are kept alive solely by their users, or not.
83-
8476
Getting Started
8577
===============
8678

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

125117
Issue Tracker
126118
=============
127-
The issue tracker is hosted by github:
119+
The issue tracker is hosted by GitHub:
128120

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

doc/source/roadmap.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#######
33
Roadmap
44
#######
5-
The full list of milestones including associated tasks can be found on github:
5+
The full list of milestones including associated tasks can be found on GitHub:
66
https://github.com/gitpython-developers/GitPython/issues
77

88
Select the respective milestone to filter the list of issues accordingly.

git/cmd.py

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import subprocess
1818
import sys
1919
import threading
20+
from collections import OrderedDict
2021
from textwrap import dedent
2122

2223
from git.compat import (
@@ -31,7 +32,6 @@
3132
is_win,
3233
)
3334
from git.exc import CommandError
34-
from git.odict import OrderedDict
3535
from git.util import is_cygwin_git, cygpath, expand_path
3636

3737
from .exc import (
@@ -44,10 +44,10 @@
4444
)
4545

4646

47-
execute_kwargs = set(('istream', 'with_extended_output',
48-
'with_exceptions', 'as_process', 'stdout_as_string',
49-
'output_stream', 'with_stdout', 'kill_after_timeout',
50-
'universal_newlines', 'shell', 'env'))
47+
execute_kwargs = {'istream', 'with_extended_output', 'with_exceptions',
48+
'as_process', 'stdout_as_string', 'output_stream',
49+
'with_stdout', 'kill_after_timeout', 'universal_newlines',
50+
'shell', 'env'}
5151

5252
log = logging.getLogger(__name__)
5353
log.addHandler(logging.NullHandler())
@@ -125,7 +125,7 @@ def dashify(string):
125125

126126

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

130130

131131
def dict_to_slots_and__excluded_are_none(self, d, excluded=()):
@@ -143,8 +143,7 @@ def dict_to_slots_and__excluded_are_none(self, d, excluded=()):
143143
## CREATE_NEW_PROCESS_GROUP is needed to allow killing it afterwards,
144144
# see https://docs.python.org/3/library/subprocess.html#subprocess.Popen.send_signal
145145
PROC_CREATIONFLAGS = (CREATE_NO_WINDOW | subprocess.CREATE_NEW_PROCESS_GROUP
146-
if is_win and sys.version_info >= (2, 7)
147-
else 0)
146+
if is_win else 0)
148147

149148

150149
class Git(LazyMixin):
@@ -486,10 +485,10 @@ def readline(self, size=-1):
486485

487486
def readlines(self, size=-1):
488487
if self._nbr == self._size:
489-
return list()
488+
return []
490489

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

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

917-
outlist = list()
916+
outlist = []
918917
for arg in arg_list:
919918
if isinstance(arg_list, (list, tuple)):
920919
outlist.extend(cls.__unpack_args(arg))
@@ -973,8 +972,8 @@ def _call_process(self, method, *args, **kwargs):
973972
:return: Same as ``execute``"""
974973
# Handle optional arguments prior to calling transform_kwargs
975974
# otherwise these'll end up in args, which is bad.
976-
exec_kwargs = dict((k, v) for k, v in kwargs.items() if k in execute_kwargs)
977-
opts_kwargs = dict((k, v) for k, v in kwargs.items() if k not in execute_kwargs)
975+
exec_kwargs = {k: v for k, v in kwargs.items() if k in execute_kwargs}
976+
opts_kwargs = {k: v for k, v in kwargs.items() if k not in execute_kwargs}
978977

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

git/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import logging
1313
import os
1414
import re
15+
from collections import OrderedDict
1516

1617
from git.compat import (
1718
string_types,
@@ -21,7 +22,6 @@
2122
with_metaclass,
2223
PY3
2324
)
24-
from git.odict import OrderedDict
2525
from git.util import LockFile
2626

2727
import os.path as osp

git/diff.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class Diffable(object):
6161
:note:
6262
Subclasses require a repo member as it is the case for Object instances, for practical
6363
reasons we do not derive from Object."""
64-
__slots__ = tuple()
64+
__slots__ = ()
6565

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

git/index/base.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def _set_cache_(self, attr):
119119
ok = True
120120
except OSError:
121121
# in new repositories, there may be no index, which means we are empty
122-
self.entries = dict()
122+
self.entries = {}
123123
return
124124
finally:
125125
if not ok:
@@ -316,7 +316,7 @@ def from_tree(cls, repo, *treeish, **kwargs):
316316
if len(treeish) == 0 or len(treeish) > 3:
317317
raise ValueError("Please specify between 1 and 3 treeish, got %i" % len(treeish))
318318

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

569569
def _preprocess_add_items(self, items):
570570
""" Split the items into two lists of path strings and BaseEntries. """
571-
paths = list()
572-
entries = list()
571+
paths = []
572+
entries = []
573573

574574
for item in items:
575575
if isinstance(item, string_types):
@@ -602,7 +602,7 @@ def _store_path(self, filepath, fprogress):
602602
@unbare_repo
603603
@git_working_dir
604604
def _entries_for_paths(self, paths, path_rewriter, fprogress, entries):
605-
entries_added = list()
605+
entries_added = []
606606
if path_rewriter:
607607
for path in paths:
608608
if osp.isabs(path):
@@ -734,7 +734,7 @@ def add(self, items, force=True, fprogress=lambda *args: None, path_rewriter=Non
734734
# automatically
735735
# paths can be git-added, for everything else we use git-update-index
736736
paths, entries = self._preprocess_add_items(items)
737-
entries_added = list()
737+
entries_added = []
738738
# This code needs a working tree, therefore we try not to run it unless required.
739739
# That way, we are OK on a bare repository as well.
740740
# If there are no paths, the rewriter has nothing to do either
@@ -801,7 +801,7 @@ def handle_null_entries(self):
801801
def _items_to_rela_paths(self, items):
802802
"""Returns a list of repo-relative paths from the given items which
803803
may be absolute or relative paths, entries or blobs"""
804-
paths = list()
804+
paths = []
805805
for item in items:
806806
if isinstance(item, (BaseIndexEntry, (Blob, Submodule))):
807807
paths.append(self._to_relative_path(item.path))
@@ -850,7 +850,7 @@ def remove(self, items, working_tree=False, **kwargs):
850850
been removed effectively.
851851
This is interesting to know in case you have provided a directory or
852852
globs. Paths are relative to the repository. """
853-
args = list()
853+
args = []
854854
if not working_tree:
855855
args.append("--cached")
856856
args.append("--")
@@ -889,7 +889,7 @@ def move(self, items, skip_errors=False, **kwargs):
889889
890890
:raise ValueError: If only one item was given
891891
GitCommandError: If git could not handle your request"""
892-
args = list()
892+
args = []
893893
if skip_errors:
894894
args.append('-k')
895895

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

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

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

11031103
for path in paths:
11041104
co_path = to_native_path_linux(self._to_relative_path(path))

0 commit comments

Comments
 (0)
0