diff options
| -rw-r--r-- | AUTHORS | 1 | ||||
| -rw-r--r-- | Makefile | 2 | ||||
| -rw-r--r-- | VERSION | 2 | ||||
| -rw-r--r-- | git/cmd.py | 4 | ||||
| m--------- | git/ext/gitdb | 0 | ||||
| -rw-r--r-- | git/objects/submodule/base.py | 10 | ||||
| -rw-r--r-- | git/remote.py | 1 | ||||
| -rw-r--r-- | git/repo/base.py | 16 | ||||
| -rw-r--r-- | git/test/test_docs.py | 4 | ||||
| -rw-r--r-- | git/util.py | 10 |
10 files changed, 28 insertions, 22 deletions
@@ -19,5 +19,6 @@ Contributors are: -Timothy B. Hartman <tbhartman _at_ gmail.com> -Konstantin Popov <konstantin.popov.89 _at_ yandex.ru> -Peter Jones <pjones _at_ redhat.com> +-Alexis Horgix Chotard Portions derived from other open source works and are clearly marked. @@ -14,5 +14,5 @@ release: clean force_release: clean git push --tags - python setup.py sdist bdist_wheel + python3 setup.py sdist bdist_wheel twine upload -s -i byronimo@gmail.com dist/* @@ -1 +1 @@ -2.1.5 +2.1.6 @@ -31,7 +31,7 @@ from git.compat import ( ) from git.exc import CommandError from git.odict import OrderedDict -from git.util import is_cygwin_git, cygpath +from git.util import is_cygwin_git, cygpath, expand_path from .exc import ( GitCommandError, @@ -405,7 +405,7 @@ class Git(LazyMixin): It is meant to be the working tree directory if available, or the .git directory in case of bare repositories.""" super(Git, self).__init__() - self._working_dir = working_dir + self._working_dir = expand_path(working_dir) self._git_options = () self._persistent_git_options = [] diff --git a/git/ext/gitdb b/git/ext/gitdb -Subproject 38866bc7c4956170c681a62c4508f934ac82646 +Subproject c0fd43b5ff8c356fcf9cdebbbbd1803a502b465 diff --git a/git/objects/submodule/base.py b/git/objects/submodule/base.py index e3912d88..a6b4caed 100644 --- a/git/objects/submodule/base.py +++ b/git/objects/submodule/base.py @@ -123,12 +123,12 @@ class Submodule(IndexObject, Iterable, Traversable): reader = self.config_reader() # default submodule values try: - self.path = reader.get_value('path') + self.path = reader.get('path') except cp.NoSectionError: raise ValueError("This submodule instance does not exist anymore in '%s' file" % osp.join(self.repo.working_tree_dir, '.gitmodules')) # end - self._url = reader.get_value('url') + self._url = reader.get('url') # git-python extension values - optional self._branch_path = reader.get_value(self.k_head_option, git.Head.to_full_path(self.k_head_default)) elif attr == '_name': @@ -1168,11 +1168,11 @@ class Submodule(IndexObject, Iterable, Traversable): for sms in parser.sections(): n = sm_name(sms) - p = parser.get_value(sms, 'path') - u = parser.get_value(sms, 'url') + p = parser.get(sms, 'path') + u = parser.get(sms, 'url') b = cls.k_head_default if parser.has_option(sms, cls.k_head_option): - b = str(parser.get_value(sms, cls.k_head_option)) + b = str(parser.get(sms, cls.k_head_option)) # END handle optional information # get the binsha diff --git a/git/remote.py b/git/remote.py index fd76e592..c3a51744 100644 --- a/git/remote.py +++ b/git/remote.py @@ -38,6 +38,7 @@ from .refs import ( log = logging.getLogger('git.remote') +log.addHandler(logging.NullHandler()) __all__ = ('RemoteProgress', 'PushInfo', 'FetchInfo', 'Remote') diff --git a/git/repo/base.py b/git/repo/base.py index d575466d..58e533aa 100644 --- a/git/repo/base.py +++ b/git/repo/base.py @@ -30,7 +30,7 @@ from git.index import IndexFile from git.objects import Submodule, RootModule, Commit from git.refs import HEAD, Head, Reference, TagReference from git.remote import Remote, add_progress, to_progress_instance -from git.util import Actor, finalize_process, decygpath, hex_to_bin +from git.util import Actor, finalize_process, decygpath, hex_to_bin, expand_path import os.path as osp from .fun import rev_parse, is_git_dir, find_submodule_git_dir, touch, find_worktree_git_dir @@ -51,13 +51,6 @@ BlameEntry = namedtuple('BlameEntry', ['commit', 'linenos', 'orig_path', 'orig_l __all__ = ('Repo',) -def _expand_path(p, expand_vars=True): - p = osp.expanduser(p) - if expand_vars: - p = osp.expandvars(p) - return osp.normpath(osp.abspath(p)) - - class Repo(object): """Represents a git repository and allows you to query references, gather commit information, generate diffs, create and clone repositories query @@ -126,11 +119,12 @@ class Repo(object): epath = os.getcwd() if Git.is_cygwin(): epath = decygpath(epath) + epath = epath or path or os.getcwd() if expand_vars and ("%" in epath or "$" in epath): warnings.warn("The use of environment variables in paths is deprecated" + "\nfor security reasons and may be removed in the future!!") - epath = _expand_path(epath, expand_vars) + epath = expand_path(epath, expand_vars) if not os.path.exists(epath): raise NoSuchPathError(epath) @@ -157,7 +151,7 @@ class Repo(object): sm_gitpath = find_worktree_git_dir(dotgit) if sm_gitpath is not None: - self.git_dir = _expand_path(sm_gitpath, expand_vars) + self.git_dir = expand_path(sm_gitpath, expand_vars) self._working_tree_dir = curpath break @@ -881,7 +875,7 @@ class Repo(object): :return: ``git.Repo`` (the newly created repo)""" if path: - path = _expand_path(path, expand_vars) + path = expand_path(path, expand_vars) if mkdir and path and not osp.exists(path): os.makedirs(path, 0o755) diff --git a/git/test/test_docs.py b/git/test/test_docs.py index cbbd9447..1ba3f482 100644 --- a/git/test/test_docs.py +++ b/git/test/test_docs.py @@ -289,9 +289,9 @@ class Tutorials(TestBase): assert len(headcommit.hexsha) == 40 assert len(headcommit.parents) > 0 assert headcommit.tree.type == 'tree' - assert headcommit.author.name == 'Sebastian Thiel' + assert len(headcommit.author.name) != 0 assert isinstance(headcommit.authored_date, int) - assert headcommit.committer.name == 'Sebastian Thiel' + assert len(headcommit.committer.name) != 0 assert isinstance(headcommit.committed_date, int) assert headcommit.message != '' # ![14-test_references_and_objects] diff --git a/git/util.py b/git/util.py index 5553a0aa..5baeee91 100644 --- a/git/util.py +++ b/git/util.py @@ -340,6 +340,16 @@ def finalize_process(proc, **kwargs): ## TODO: No close proc-streams?? proc.wait(**kwargs) + +def expand_path(p, expand_vars=True): + try: + p = osp.expanduser(p) + if expand_vars: + p = osp.expandvars(p) + return osp.normpath(osp.abspath(p)) + except: + return None + #} END utilities #{ Classes |
