Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 598191b

Browse files
committed
Fix merge conflict
2 parents 593800e + 20f5e42 commit 598191b

File tree

4 files changed

+19
-10
lines changed

4 files changed

+19
-10
lines changed

git/cmd.py

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

77
import contextlib
8-
import re
9-
108
import io
119
import logging
1210
import os
@@ -21,7 +19,7 @@
2119
import threading
2220
from collections import OrderedDict
2321
from textwrap import dedent
24-
import unittest.mock
22+
import mock
2523

2624
from git.compat import (
2725
string_types,
@@ -62,6 +60,11 @@
6260
__all__ = ('Git',)
6361

6462

63+
@contextlib.contextmanager
64+
def nullcontext(enter_result=None):
65+
yield enter_result
66+
67+
6568
# ==============================================================================
6669
## @name Utilities
6770
# ------------------------------------------------------------------------------
@@ -756,7 +759,7 @@ def execute(self, command,
756759
cmd_not_found_exception = FileNotFoundError # NOQA # exists, flake8 unknown @UndefinedVariable
757760
else:
758761
cmd_not_found_exception = OSError
759-
patch_caller_env = contextlib.nullcontext()
762+
patch_caller_env = nullcontext()
760763
# end handle
761764

762765
stdout_sink = (PIPE
@@ -781,7 +784,7 @@ def execute(self, command,
781784
close_fds=is_posix, # unsupported on windows
782785
universal_newlines=universal_newlines,
783786
creationflags=PROC_CREATIONFLAGS,
784-
**subprocess_kwargs,
787+
**subprocess_kwargs
785788
)
786789
except cmd_not_found_exception as err:
787790
raise GitCommandNotFound(command, err)

git/test/test_git.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,16 @@
44
#
55
# This module is part of GitPython and is released under
66
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
7+
from __future__ import print_function
8+
79
import contextlib
810
import os
911
import shutil
1012
import subprocess
1113
import sys
12-
from tempfile import TemporaryDirectory, TemporaryFile
14+
from tempfile import TemporaryFile
15+
from backports.tempfile import TemporaryDirectory
16+
import six
1317

1418
from git import (
1519
Git,
@@ -122,12 +126,13 @@ def test_it_executes_git_not_from_cwd(self):
122126
else:
123127
# Create a shell script that doesn't do anything.
124128
impostor_path = os.path.join(tmpdir, "git")
125-
with open(impostor_path, mode="w", encoding="utf-8") as file:
129+
with open(impostor_path, mode="w") as file:
126130
print("#!/bin/sh", file=file)
127131
os.chmod(impostor_path, 0o755)
128132

129133
with _chdir(tmpdir):
130-
self.assertRegex(self.git.execute(["git", "version"]), r"^git version\b")
134+
# six.assertRegex(self.git.execute(["git", "version"]).encode("UTF-8"), r"^git version\b")
135+
self.assertRegexpMatches(self.git.execute(["git", "version"]), r"^git version\b")
131136

132137
def test_it_accepts_stdin(self):
133138
filename = fixture_path("cat_file_blob")

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
gitdb2>=2,<3
2+
mock

test-requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ coverage
44
flake8
55
nose
66
tox
7-
mock; python_version=='2.7'
8-
pathlib2; python_version=='2.7'
7+
backports.tempfile
8+
six

0 commit comments

Comments
 (0)