Skip to content

Commit 3959556

Browse files
committed
FIX hook TC on PY3+Win & indeterministic lock timing.
+ Cannot `index.path` into ENV, it is bytes! + The hook TC never runs on linux! + Unblock removal of odbfile in perf-large streams TC. + Attempt to unblock removal of submodule file by intensive cleaning. more unblock files
1 parent f1d2d06 commit 3959556

File tree

6 files changed

+41
-18
lines changed

6 files changed

+41
-18
lines changed

Diff for: .appveyor.yml

+19-15
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,36 @@ environment:
55
CYGWIN64_GIT_PATH: "C:\\cygwin64\\bin;%GIT_DAEMON_PATH%"
66

77
matrix:
8+
## MINGW
9+
#
810
- PYTHON: "C:\\Python27"
911
PYTHON_VERSION: "2.7"
1012
GIT_PATH: "%GIT_DAEMON_PATH%"
11-
- PYTHON: "C:\\Miniconda-x64"
12-
PYTHON_VERSION: "2.7"
13-
IS_CONDA: "yes"
14-
GIT_PATH: "%CYGWIN_GIT_PATH%"
15-
1613
- PYTHON: "C:\\Python34-x64"
1714
PYTHON_VERSION: "3.4"
1815
GIT_PATH: "%GIT_DAEMON_PATH%"
19-
- PYTHON: "C:\\Python34-x64"
20-
PYTHON_VERSION: "3.4"
21-
GIT_PATH: "%CYGWIN_GIT_PATH%"
22-
2316
- PYTHON: "C:\\Python35-x64"
2417
PYTHON_VERSION: "3.5"
2518
GIT_PATH: "%GIT_DAEMON_PATH%"
26-
- PYTHON: "C:\\Python35-x64"
27-
PYTHON_VERSION: "3.5"
28-
GIT_PATH: "%CYGWIN64_GIT_PATH%"
2919
- PYTHON: "C:\\Miniconda35-x64"
3020
PYTHON_VERSION: "3.5"
3121
IS_CONDA: "yes"
3222
GIT_PATH: "%GIT_DAEMON_PATH%"
3323

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%"
36+
37+
3438
install:
3539
- set PATH=%PYTHON%;%PYTHON%\Scripts;%GIT_PATH%;%PATH%
3640

@@ -44,9 +48,9 @@ install:
4448
4549
- IF "%IS_CONDA%"=="yes" (
4650
conda info -a &
47-
conda install --yes --quiet pip
51+
conda install --yes --quiet pip
4852
)
49-
- pip install nose ddt wheel coveralls
53+
- pip install nose ddt wheel coveralls
5054
- IF "%PYTHON_VERSION%"=="2.7" (
5155
pip install mock
5256
)
@@ -73,7 +77,7 @@ install:
7377
build: false
7478

7579
test_script:
76-
- nosetests -v
80+
- nosetests
7781

7882
#on_success:
7983
# - IF "%PYTHON_VERSION%"=="3.4" (coveralls)

Diff for: git/compat.py

+10
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,16 @@ def safe_decode(s):
6666
raise TypeError('Expected bytes or text, but got %r' % (s,))
6767

6868

69+
def safe_encode(s):
70+
"""Safely decodes a binary string to unicode"""
71+
if isinstance(s, unicode):
72+
return s.encode(defenc)
73+
elif isinstance(s, bytes):
74+
return s
75+
elif s is not None:
76+
raise TypeError('Expected bytes or text, but got %r' % (s,))
77+
78+
6979
def with_metaclass(meta, *bases):
7080
"""copied from https://github.com/Byron/bcore/blob/master/src/python/butility/future.py#L15"""
7181
class metaclass(meta):

Diff for: git/index/fun.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,13 @@
4141
from gitdb.base import IStream
4242
from gitdb.typ import str_tree_type
4343
from git.compat import (
44+
PY3,
4445
defenc,
4546
force_text,
4647
force_bytes,
4748
is_posix,
49+
safe_encode,
50+
safe_decode,
4851
)
4952

5053
S_IFGITLINK = S_IFLNK | S_IFDIR # a submodule
@@ -69,7 +72,7 @@ def run_commit_hook(name, index):
6972
return
7073

7174
env = os.environ.copy()
72-
env['GIT_INDEX_FILE'] = index.path
75+
env['GIT_INDEX_FILE'] = safe_decode(index.path) if PY3 else safe_encode(index.path)
7376
env['GIT_EDITOR'] = ':'
7477
try:
7578
cmd = subprocess.Popen(hp,

Diff for: git/objects/submodule/base.py

+2
Original file line numberDiff line numberDiff line change
@@ -848,13 +848,15 @@ def remove(self, module=True, force=False, configuration=True, dry_run=False):
848848

849849
# finally delete our own submodule
850850
if not dry_run:
851+
self._clear_cache()
851852
wtd = mod.working_tree_dir
852853
del(mod) # release file-handles (windows)
853854
rmtree(wtd)
854855
# END delete tree if possible
855856
# END handle force
856857

857858
if not dry_run and os.path.isdir(git_dir):
859+
self._clear_cache()
858860
rmtree(git_dir)
859861
# end handle separate bare repository
860862
# END handle module deletion

Diff for: git/test/performance/test_streams.py

+3
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ def test_large_data_streaming(self, rwrepo):
8787
% (size_kib, desc, cs_kib, elapsed_readchunks, size_kib / elapsed_readchunks), file=sys.stderr)
8888

8989
# del db file so git has something to do
90+
ostream = None
91+
import gc
92+
gc.collect()
9093
os.remove(db_file)
9194

9295
# VS. CGIT

Diff for: git/test/test_util.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,11 @@ def test_blocking_lock_file(self):
9090
wait_lock = BlockingLockFile(my_file, 0.05, wait_time)
9191
self.failUnlessRaises(IOError, wait_lock._obtain_lock)
9292
elapsed = time.time() - start
93-
extra_time = 0.2
93+
extra_time = 0.02
9494
if is_win:
95+
# for Appveyor
9596
extra_time *= 6 # NOTE: Indeterministic failures here...
96-
self.assertLess(elapsed, wait_time + 0.02)
97+
self.assertLess(elapsed, wait_time + extra_time)
9798

9899
def test_user_id(self):
99100
assert '@' in get_user_id()

0 commit comments

Comments
 (0)