summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.coveragerc10
-rw-r--r--.gitignore3
-rw-r--r--.travis.yml5
-rw-r--r--README.md3
-rw-r--r--doc/source/intro.rst2
-rw-r--r--etc/sublime-text/git-python.sublime-project71
-rw-r--r--git/diff.py4
-rw-r--r--git/remote.py22
-rw-r--r--git/repo/base.py4
-rw-r--r--git/test/test_remote.py4
-rw-r--r--git/util.py21
-rw-r--r--setup.py1
12 files changed, 133 insertions, 17 deletions
diff --git a/.coveragerc b/.coveragerc
new file mode 100644
index 00000000..410ffc52
--- /dev/null
+++ b/.coveragerc
@@ -0,0 +1,10 @@
+[run]
+source = git
+
+; to make nosetests happy
+[report]
+omit =
+ */yaml*
+ */tests/*
+ */python?.?/*
+ */site-packages/nose/* \ No newline at end of file
diff --git a/.gitignore b/.gitignore
index eec80860..1a26c03a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,7 +2,10 @@
*.swp
*~
/lib/GitPython.egg-info
+cover/
+.coverage
/build
/dist
/doc/_build
nbproject
+*.sublime-workspace
diff --git a/.travis.yml b/.travis.yml
index 2a56becc..0a2906dc 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -7,5 +7,8 @@ python:
install:
- git submodule update --init --recursive
- git fetch --tags
+ - pip install coveralls
script:
- - nosetests
+ - nosetests --with-coverage
+# after_success: as long as we are not running smoothly ... give it the cover treatment every time
+ - coveralls
diff --git a/README.md b/README.md
index d978917b..d2a858bf 100644
--- a/README.md
+++ b/README.md
@@ -31,8 +31,9 @@ A distribution package can be obtained for manual installation at:
### DEVELOPMENT STATUS
[![Build Status](https://travis-ci.org/gitpython-developers/GitPython.svg?branch=0.3)](https://travis-ci.org/gitpython-developers/GitPython)
+[![Coverage Status](https://coveralls.io/repos/gitpython-developers/GitPython/badge.png)](https://coveralls.io/r/gitpython-developers/GitPython)
-The project was idle for 2 years, the last release was made about 3 years ago. Reason for this might have been the project's dependency on me as sole active maintainer, which is an issue in itself.
+The project was idle for 2 years, the last release (v0.3.2 RC1) was made on July 2011. Reason for this might have been the project's dependency on me as sole active maintainer, which is an issue in itself.
Now I am back and fully dedicated to pushing [OSS](https://github.com/Byron/bcore) forward in the realm of [digital content creation](http://gooseberry.blender.org/), and git-python will see some of my time as well. Therefore it will be moving forward, slowly but steadily.
diff --git a/doc/source/intro.rst b/doc/source/intro.rst
index 520cf159..8dac2804 100644
--- a/doc/source/intro.rst
+++ b/doc/source/intro.rst
@@ -47,7 +47,7 @@ here:
* `setuptools`_
* `install setuptools <http://peak.telecommunity.com/DevCenter/EasyInstall#installation-instructions>`_
-* `pypi <http://pypi.python.org/pypi/SQLAlchemy>`_
+* `pypi <https://pypi.python.org/pypi/GitPython>`_
.. _setuptools: http://peak.telecommunity.com/DevCenter/setuptools
diff --git a/etc/sublime-text/git-python.sublime-project b/etc/sublime-text/git-python.sublime-project
new file mode 100644
index 00000000..5d981925
--- /dev/null
+++ b/etc/sublime-text/git-python.sublime-project
@@ -0,0 +1,71 @@
+{
+ "folders":
+ [
+ // GIT-PYTHON
+ /////////////
+ {
+ "follow_symlinks": true,
+ "path": "../..",
+ "file_exclude_patterns" : [
+ "*.sublime-workspace",
+ ".git",
+ ".noseids",
+ ".coverage"
+ ],
+ "folder_exclude_patterns" : [
+ ".git",
+ "cover",
+ "git/ext"
+ ]
+ },
+ // GITDB
+ ////////
+ {
+ "follow_symlinks": true,
+ "path": "../../git/ext/gitdb",
+ "file_exclude_patterns" : [
+ "*.sublime-workspace",
+ ".git",
+ ".noseids",
+ ".coverage"
+ ],
+ "folder_exclude_patterns" : [
+ ".git",
+ "cover",
+ "gitdb/ext"
+ ]
+ },
+ // SMMAP
+ ////////
+ {
+ "follow_symlinks": true,
+ "path": "../../git/ext/gitdb/gitdb/ext/smmap",
+ "file_exclude_patterns" : [
+ "*.sublime-workspace",
+ ".git",
+ ".noseids",
+ ".coverage"
+ ],
+ "folder_exclude_patterns" : [
+ ".git",
+ "cover",
+ ]
+ },
+ // ASYNC
+ ////////
+ {
+ "follow_symlinks": true,
+ "path": "../../git/ext/gitdb/gitdb/ext/async",
+ "file_exclude_patterns" : [
+ "*.sublime-workspace",
+ ".git",
+ ".noseids",
+ ".coverage"
+ ],
+ "folder_exclude_patterns" : [
+ ".git",
+ "cover",
+ ]
+ },
+ ]
+}
diff --git a/git/diff.py b/git/diff.py
index 8a4819ab..e90fc1cf 100644
--- a/git/diff.py
+++ b/git/diff.py
@@ -75,6 +75,10 @@ class Diffable(object):
args.append("-M") # check for renames
else:
args.append("--raw")
+
+ # in any way, assure we don't see colored output,
+ # fixes https://github.com/gitpython-developers/GitPython/issues/172
+ args.append('--no-color')
if paths is not None and not isinstance(paths, (tuple,list)):
paths = [ paths ]
diff --git a/git/remote.py b/git/remote.py
index f89e9d83..b06c0686 100644
--- a/git/remote.py
+++ b/git/remote.py
@@ -513,14 +513,15 @@ class Remote(LazyMixin, Iterable):
def _get_fetch_info_from_stderr(self, proc, progress):
# skip first line as it is some remote info we are not interested in
output = IterableList('name')
-
-
+
+
# lines which are no progress are fetch info lines
# this also waits for the command to finish
# Skip some progress lines that don't provide relevant information
fetch_info_lines = list()
for line in digest_process_messages(proc.stderr, progress):
- if line.startswith('From') or line.startswith('remote: Total') or line.startswith('POST'):
+ if line.startswith('From') or line.startswith('remote: Total') or line.startswith('POST') \
+ or line.startswith(' ='):
continue
elif line.startswith('warning:'):
print >> sys.stderr, line
@@ -536,7 +537,10 @@ class Remote(LazyMixin, Iterable):
fetch_head_info = fp.readlines()
fp.close()
- assert len(fetch_info_lines) == len(fetch_head_info), "len(%s) != len(%s)" % (fetch_head_info, fetch_info_lines)
+ # NOTE: HACK Just disabling this line will make github repositories work much better.
+ # I simply couldn't stand it anymore, so here is the quick and dirty fix ... .
+ # This project needs a lot of work !
+ # assert len(fetch_info_lines) == len(fetch_head_info), "len(%s) != len(%s)" % (fetch_head_info, fetch_info_lines)
output.extend(FetchInfo._from_line(self.repo, err_line, fetch_line)
for err_line,fetch_line in zip(fetch_info_lines, fetch_head_info))
@@ -579,6 +583,10 @@ class Remote(LazyMixin, Iterable):
See also git-push(1).
Taken from the git manual
+
+ Fetch supports multiple refspecs (as the
+ underlying git-fetch does) - supplying a list rather than a string
+ for 'refspec' will make use of this facility.
:param progress: See 'push' method
:param kwargs: Additional arguments to be passed to git-fetch
:return:
@@ -589,7 +597,11 @@ class Remote(LazyMixin, Iterable):
As fetch does not provide progress information to non-ttys, we cannot make
it available here unfortunately as in the 'push' method."""
kwargs = add_progress(kwargs, self.repo.git, progress)
- proc = self.repo.git.fetch(self, refspec, with_extended_output=True, as_process=True, v=True, **kwargs)
+ if isinstance(refspec, list):
+ args = refspec
+ else:
+ args = [refspec]
+ proc = self.repo.git.fetch(self, *args, with_extended_output=True, as_process=True, v=True, **kwargs)
return self._get_fetch_info_from_stderr(proc, progress or RemoteProgress())
def pull(self, refspec=None, progress=None, **kwargs):
diff --git a/git/repo/base.py b/git/repo/base.py
index a45d215e..b9335aba 100644
--- a/git/repo/base.py
+++ b/git/repo/base.py
@@ -56,13 +56,13 @@ class Repo(object):
The following attributes are worth using:
- 'working_dir' is the working directory of the git command, wich is the working tree
+ 'working_dir' is the working directory of the git command, which is the working tree
directory if available or the .git directory in case of bare repositories
'working_tree_dir' is the working tree directory, but will raise AssertionError
if we are a bare repository.
- 'git_dir' is the .git repository directoy, which is always set."""
+ 'git_dir' is the .git repository directory, which is always set."""
DAEMON_EXPORT_FILE = 'git-daemon-export-ok'
__slots__ = ( "working_dir", "_working_tree_dir", "git_dir", "_bare", "git", "odb" )
diff --git a/git/test/test_remote.py b/git/test/test_remote.py
index a7f1be22..b1248096 100644
--- a/git/test/test_remote.py
+++ b/git/test/test_remote.py
@@ -199,6 +199,10 @@ class TestRemote(TestBase):
# ... with respec and no target
res = fetch_and_test(remote, refspec='master')
assert len(res) == 1
+
+ # ... multiple refspecs
+ res = fetch_and_test(remote, refspec=['master', 'fred'])
+ assert len(res) == 1
# add new tag reference
rtag = TagReference.create(remote_repo, "1.0-RV_hello.there")
diff --git a/git/util.py b/git/util.py
index 7c257b37..88a72c0c 100644
--- a/git/util.py
+++ b/git/util.py
@@ -22,6 +22,10 @@ from gitdb.util import (
to_bin_sha
)
+# Import the user database on unix based systems
+if os.name == "posix":
+ import pwd
+
__all__ = ( "stream_copy", "join_path", "to_native_path_windows", "to_native_path_linux",
"join_path_native", "Stats", "IndexFileSHA1Writer", "Iterable", "IterableList",
"BlockingLockFile", "LockFile", 'Actor', 'get_user_id', 'assure_directory_exists',
@@ -113,12 +117,17 @@ def assure_directory_exists(path, is_file=False):
def get_user_id():
""":return: string identifying the currently active system user as name@node
- :note: user can be set with the 'USER' environment variable, usually set on windows"""
- ukn = 'UNKNOWN'
- username = os.environ.get('USER', os.environ.get('USERNAME', ukn))
- if username == ukn and hasattr(os, 'getlogin'):
- username = os.getlogin()
- # END get username from login
+ :note: user can be set with the 'USER' environment variable, usually set on windows
+ :note: on unix based systems you can use the password database
+ to get the login name of the effective process user"""
+ if os.name == "posix":
+ username = pwd.getpwuid(os.geteuid()).pw_name
+ else:
+ ukn = 'UNKNOWN'
+ username = os.environ.get('USER', os.environ.get('USERNAME', ukn))
+ if username == ukn and hasattr(os, 'getlogin'):
+ username = os.getlogin()
+ # END get username from login
return "%s@%s" % (username, platform.node())
#} END utilities
diff --git a/setup.py b/setup.py
index ea0ff12e..e7c927b1 100644
--- a/setup.py
+++ b/setup.py
@@ -73,7 +73,6 @@ setup(name = "GitPython",
package_data = {'git.test' : ['fixtures/*']},
package_dir = {'git':'git'},
license = "BSD License",
- requires=('gitdb (>=0.5.1)',),
install_requires='gitdb >= 0.5.1',
zip_safe=False,
long_description = """\