Skip to content

Commit caa0ea7

Browse files
committed
Merge branch 'cygwin' of https://github.com/ankostis/GitPython into ankostis-cygwin
2 parents afcd64e + cc77e6b commit caa0ea7

Some content is hidden

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

44 files changed

+961
-686
lines changed

‎.appveyor.yml‎

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,17 @@ environment:
2121
IS_CONDA: "yes"
2222
GIT_PATH: "%GIT_DAEMON_PATH%"
2323

24-
# ## Cygwin
25-
# #
26-
# - PYTHON: "C:\\Miniconda-x64"
27-
# PYTHON_VERSION: "2.7"
28-
# IS_CONDA: "yes"
29-
# GIT_PATH: "%CYGWIN_GIT_PATH%"
30-
# - PYTHON: "C:\\Python34-x64"
31-
# PYTHON_VERSION: "3.4"
32-
# GIT_PATH: "%CYGWIN_GIT_PATH%"
33-
# - PYTHON: "C:\\Python35-x64"
34-
# PYTHON_VERSION: "3.5"
35-
# GIT_PATH: "%CYGWIN64_GIT_PATH%"
24+
## Cygwin
25+
#
26+
- PYTHON: "C:\\Miniconda-x64"
27+
PYTHON_VERSION: "2.7"
28+
IS_CONDA: "yes"
29+
IS_CYGWIN: "yes"
30+
GIT_PATH: "%CYGWIN_GIT_PATH%"
31+
- PYTHON: "C:\\Python35-x64"
32+
PYTHON_VERSION: "3.5"
33+
GIT_PATH: "%CYGWIN64_GIT_PATH%"
34+
IS_CYGWIN: "yes"
3635

3736

3837
install:
@@ -48,14 +47,12 @@ install:
4847
python --version
4948
python -c "import struct; print(struct.calcsize('P') * 8)"
5049
51-
- IF "%IS_CONDA%"=="yes" (
50+
- IF "%IS_CONDA%" == "yes" (
5251
conda info -a &
5352
conda install --yes --quiet pip
5453
)
55-
- pip install nose ddt wheel codecov
56-
- IF "%PYTHON_VERSION%"=="2.7" (
57-
pip install mock
58-
)
54+
- pip install -r test-requirements.txt
55+
- pip install codecov
5956

6057
## Copied from `init-tests-after-clone.sh`.
6158
#
@@ -79,7 +76,15 @@ install:
7976
build: false
8077

8178
test_script:
82-
- IF "%PYTHON_VERSION%"=="3.5" (nosetests -v --with-coverage) ELSE (nosetests -v)
79+
- IF "%IS_CYGWIN%" == "yes" (
80+
nosetests -v
81+
) ELSE (
82+
IF "%PYTHON_VERSION%" == "3.5" (
83+
nosetests -v --with-coverage
84+
) ELSE (
85+
nosetests -v
86+
)
87+
)
8388

8489
on_success:
85-
- IF "%PYTHON_VERSION%"=="3.5" (codecov)
90+
- IF "%PYTHON_VERSION%" == "3.5" IF NOT "%IS_CYGWIN%" == "yes" (codecov)

‎.travis.yml‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
language: python
22
python:
3-
- "2.6"
43
- "2.7"
54
- "3.3"
65
- "3.4"
76
- "3.5"
87
# - "pypy" - won't work as smmap doesn't work (see gitdb/.travis.yml for details)
9-
matrix:
10-
allow_failures:
11-
- python: "2.6"
128
git:
139
# a higher depth is needed for most of the tests - must be high enough to not actually be shallow
1410
# as we clone our own repository in the process
@@ -17,7 +13,8 @@ install:
1713
- python --version; git --version
1814
- git submodule update --init --recursive
1915
- git fetch --tags
20-
- pip install codecov flake8 ddt sphinx
16+
- pip install -r test-requirements.txt
17+
- pip install codecov sphinx
2118

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

‎git/__init__.py‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@
55
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
66
# flake8: noqa
77
#@PydevCodeAnalysisIgnore
8+
importinspect
89
importos
910
importsys
10-
importinspect
11+
12+
importos.pathasosp
13+
1114

1215
__version__='git'
1316

@@ -16,7 +19,7 @@
1619
def_init_externals():
1720
"""Initialize external projects by putting them into the path"""
1821
if__version__=='git':
19-
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'ext', 'gitdb'))
22+
sys.path.insert(0, osp.join(osp.dirname(__file__), 'ext', 'gitdb'))
2023

2124
try:
2225
importgitdb

‎git/cmd.py‎

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
)
3232
fromgit.excimportCommandError
3333
fromgit.odictimportOrderedDict
34+
fromgit.utilimportis_cygwin_git, cygpath
3435

3536
from .excimport (
3637
GitCommandError,
@@ -191,8 +192,26 @@ def __setstate__(self, d):
191192
USE_SHELL=False
192193

193194
@classmethod
194-
defpolish_url(cls, url):
195-
returnurl.replace("\\\\", "\\").replace("\\", "/")
195+
defis_cygwin(cls):
196+
returnis_cygwin_git(cls.GIT_PYTHON_GIT_EXECUTABLE)
197+
198+
@classmethod
199+
defpolish_url(cls, url, is_cygwin=None):
200+
ifis_cygwinisNone:
201+
is_cygwin=cls.is_cygwin()
202+
203+
ifis_cygwin:
204+
url=cygpath(url)
205+
else:
206+
"""Remove any backslahes from urls to be written in config files.
207+
208+
Windows might create config-files containing paths with backslashed,
209+
but git stops liking them as it will escape the backslashes.
210+
Hence we undo the escaping just to be sure.
211+
"""
212+
url=url.replace("\\\\", "\\").replace("\\", "/")
213+
214+
returnurl
196215

197216
classAutoInterrupt(object):
198217
"""Kill/Interrupt the stored process instance once this instance goes out of scope. It is

‎git/config.py‎

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,13 @@
66
"""Module containing module parser implementation able to properly read and write
77
configuration files"""
88

9-
importre
10-
try:
11-
importConfigParserascp
12-
exceptImportError:
13-
# PY3
14-
importconfigparserascp
9+
importabc
10+
fromfunctoolsimportwraps
1511
importinspect
1612
importlogging
17-
importabc
1813
importos
14+
importre
1915

20-
fromfunctoolsimportwraps
21-
22-
fromgit.odictimportOrderedDict
23-
fromgit.utilimportLockFile
2416
fromgit.compatimport (
2517
string_types,
2618
FileType,
@@ -29,6 +21,18 @@
2921
with_metaclass,
3022
PY3
3123
)
24+
fromgit.odictimportOrderedDict
25+
fromgit.utilimportLockFile
26+
27+
importos.pathasosp
28+
29+
30+
try:
31+
importConfigParserascp
32+
exceptImportError:
33+
# PY3
34+
importconfigparserascp
35+
3236

3337
__all__= ('GitConfigParser', 'SectionConstraint')
3438

@@ -408,15 +412,15 @@ def read(self):
408412
ifself._has_includes():
409413
for_, include_pathinself.items('include'):
410414
ifinclude_path.startswith('~'):
411-
include_path=os.path.expanduser(include_path)
412-
ifnotos.path.isabs(include_path):
415+
include_path=osp.expanduser(include_path)
416+
ifnotosp.isabs(include_path):
413417
ifnotfile_ok:
414418
continue
415419
# end ignore relative paths if we don't know the configuration file path
416-
assertos.path.isabs(file_path), "Need absolute paths to be sure our cycle checks will work"
417-
include_path=os.path.join(os.path.dirname(file_path), include_path)
420+
assertosp.isabs(file_path), "Need absolute paths to be sure our cycle checks will work"
421+
include_path=osp.join(osp.dirname(file_path), include_path)
418422
# end make include path absolute
419-
include_path=os.path.normpath(include_path)
423+
include_path=osp.normpath(include_path)
420424
ifinclude_pathinseenornotos.access(include_path, os.R_OK):
421425
continue
422426
seen.add(include_path)

‎git/db.py‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
"""Module with our own gitdb implementation - it uses the git command"""
2+
fromgit.utilimportbin_to_hex, hex_to_bin
23
fromgitdb.baseimport (
34
OInfo,
45
OStream
56
)
6-
fromgitdb.utilimport (
7-
bin_to_hex,
8-
hex_to_bin
9-
)
107
fromgitdb.dbimportGitDB# @UnusedImport
118
fromgitdb.dbimportLooseObjectDB
129

‎git/diff.py‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,17 @@
55
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
66
importre
77

8-
fromgitdb.utilimporthex_to_bin
8+
fromgit.cmdimporthandle_process_output
9+
fromgit.compatimport (
10+
defenc,
11+
PY3
12+
)
13+
fromgit.utilimportfinalize_process, hex_to_bin
914

1015
from .compatimportbinary_type
1116
from .objects.blobimportBlob
1217
from .objects.utilimportmode_str_to_int
1318

14-
fromgit.compatimport (
15-
defenc,
16-
PY3
17-
)
18-
fromgit.cmdimporthandle_process_output
19-
fromgit.utilimportfinalize_process
2019

2120
__all__= ('Diffable', 'DiffIndex', 'Diff', 'NULL_TREE')
2221

0 commit comments

Comments
(0)