summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md9
-rw-r--r--doc/source/index.rst1
-rw-r--r--doc/source/intro.rst8
-rw-r--r--doc/source/whatsnew.rst25
-rw-r--r--git/index/base.py14
-rw-r--r--git/remote.py2
-rw-r--r--git/test/test_index.py19
-rw-r--r--git/test/test_repo.py1
8 files changed, 48 insertions, 31 deletions
diff --git a/README.md b/README.md
index c999dcaa..b7e2b139 100644
--- a/README.md
+++ b/README.md
@@ -54,6 +54,11 @@ codebase for `__del__` implementations and call these yourself when you see fit.
Another way assure proper cleanup of resources is to factor out GitPython into a
separate process which can be dropped periodically.
+#### Best-effort for Python 2.6 and Windows support
+
+This means that support for these platforms is likely to worsen over time
+as they are kept alive solely by their users, or not.
+
### RUNNING TESTS
*Important*: Right after cloning this repository, please be sure to have executed the `init-tests-after-clone.sh` script in the repository root. Otherwise you will encounter test failures.
@@ -105,10 +110,12 @@ New BSD License. See the LICENSE file.
[![Build Status](https://travis-ci.org/gitpython-developers/GitPython.svg)](https://travis-ci.org/gitpython-developers/GitPython)
[![Code Climate](https://codeclimate.com/github/gitpython-developers/GitPython/badges/gpa.svg)](https://codeclimate.com/github/gitpython-developers/GitPython)
[![Documentation Status](https://readthedocs.org/projects/gitpython/badge/?version=stable)](https://readthedocs.org/projects/gitpython/?badge=stable)
+[![Stories in Ready](https://badge.waffle.io/gitpython-developers/GitPython.png?label=ready&title=Ready)](https://waffle.io/gitpython-developers/GitPython)
+[![Throughput Graph](https://graphs.waffle.io/gitpython-developers/GitPython/throughput.svg)](https://waffle.io/gitpython-developers/GitPython/metrics/throughput)
Now that there seems to be a massive user base, this should be motivation enough to let git-python return to a proper state, which means
* no open pull requests
* no open issues describing bugs
-[contributing]: https://github.com/gitpython-developers/GitPython/blob/master/README.md
+[contributing]: https://github.com/gitpython-developers/GitPython/blob/master/CONTRIBUTING.md
diff --git a/doc/source/index.rst b/doc/source/index.rst
index 1079c5c7..69fb573a 100644
--- a/doc/source/index.rst
+++ b/doc/source/index.rst
@@ -9,7 +9,6 @@ GitPython Documentation
:maxdepth: 2
intro
- whatsnew
tutorial
reference
roadmap
diff --git a/doc/source/intro.rst b/doc/source/intro.rst
index 1c1b0d1b..1766f8ae 100644
--- a/doc/source/intro.rst
+++ b/doc/source/intro.rst
@@ -15,7 +15,7 @@ Requirements
* `Python`_ 2.7 or newer
Since GitPython 2.0.0. Please note that python 2.6 is still reasonably well supported, but might
- deteriorate over time.
+ deteriorate over time. Support is provided on a best-effort basis only.
* `Git`_ 1.7.0 or newer
It should also work with older versions, but it may be that some operations
involving remotes will not work as expected.
@@ -75,6 +75,12 @@ codebase for `__del__` implementations and call these yourself when you see fit.
Another way assure proper cleanup of resources is to factor out GitPython into a
separate process which can be dropped periodically.
+Best-effort for Python 2.6 and Windows support
+----------------------------------------------
+
+This means that support for these platforms is likely to worsen over time
+as they are kept alive solely by their users, or not.
+
Getting Started
===============
diff --git a/doc/source/whatsnew.rst b/doc/source/whatsnew.rst
deleted file mode 100644
index e0d39b09..00000000
--- a/doc/source/whatsnew.rst
+++ /dev/null
@@ -1,25 +0,0 @@
-
-################
-Whats New in 0.3
-################
-GitPython 0.3 is the first step in creating a hybrid which uses a pure python implementations for all simple git features which can be implemented without significant performance penalties. Everything else is still performed using the git command, which is nicely integrated and easy to use.
-
-Its biggest strength, being the support for all git features through the git command itself, is a weakness as well considering the possibly vast amount of times the git command is being started up. Depending on the actual command being performed, the git repository will be initialized on many of these invocations, causing additional overhead for possibly tiny operations.
-
-Keeping as many major operations in the python world will result in improved caching benefits as certain data structures just have to be initialized once and can be reused multiple times. This mode of operation may improve performance when altering the git database on a low level, and is clearly beneficial on operating systems where command invocations are very slow.
-
-****************
-Object Databases
-****************
-An object database provides a simple interface to query object information or to write new object data. Objects are generally identified by their 20 byte binary sha1 value during query.
-
-GitPython uses the ``gitdb`` project to provide a pure-python implementation of the git database, which includes reading and writing loose objects, reading pack files and handling alternate repositories.
-
-The great thing about this is that ``Repo`` objects can use any object database, hence it easily supports different implementations with different performance characteristics. If you are thinking in extremes, you can implement your own database representation, which may be more efficient for what you want to do specifically, like handling big files more efficiently.
-
-************************
-Reduced Memory Footprint
-************************
-Objects, such as commits, tags, trees and blobs now use 20 byte sha1 signatures internally, reducing their memory demands by 20 bytes per object, allowing you to keep more objects in memory at the same time.
-
-The internal caches of tree objects were improved to use less memory as well.
diff --git a/git/index/base.py b/git/index/base.py
index 524b4568..86eda41e 100644
--- a/git/index/base.py
+++ b/git/index/base.py
@@ -118,13 +118,17 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable):
# read the current index
# try memory map for speed
lfd = LockedFD(self._file_path)
+ ok = False
try:
fd = lfd.open(write=False, stream=False)
+ ok = True
except OSError:
- lfd.rollback()
# in new repositories, there may be no index, which means we are empty
self.entries = dict()
return
+ finally:
+ if not ok:
+ lfd.rollback()
# END exception handling
# Here it comes: on windows in python 2.5, memory maps aren't closed properly
@@ -209,8 +213,14 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable):
self.entries
lfd = LockedFD(file_path or self._file_path)
stream = lfd.open(write=True, stream=True)
+ ok = False
- self._serialize(stream, ignore_extension_data)
+ try:
+ self._serialize(stream, ignore_extension_data)
+ ok = True
+ finally:
+ if not ok:
+ lfd.rollback()
lfd.commit()
diff --git a/git/remote.py b/git/remote.py
index 12129460..4a8a5ee9 100644
--- a/git/remote.py
+++ b/git/remote.py
@@ -445,7 +445,7 @@ class Remote(LazyMixin, Iterable):
def iter_items(cls, repo):
""":return: Iterator yielding Remote objects of the given repository"""
for section in repo.config_reader("repository").sections():
- if not section.startswith('remote'):
+ if not section.startswith('remote '):
continue
lbound = section.find('"')
rbound = section.rfind('"')
diff --git a/git/test/test_index.py b/git/test/test_index.py
index ca877838..178a59d2 100644
--- a/git/test/test_index.py
+++ b/git/test/test_index.py
@@ -135,6 +135,25 @@ class TestIndex(TestBase):
raise AssertionError("CMP Failed: Missing entries in index: %s, missing in tree: %s" %
(bset - iset, iset - bset))
# END assertion message
+
+ @with_rw_repo('0.1.6')
+ def test_index_lock_handling(self, rw_repo):
+ def add_bad_blob():
+ rw_repo.index.add([Blob(rw_repo, b'f' * 20, 'bad-permissions', 'foo')])
+
+ try:
+ ## 1st fail on purpose adding into index.
+ add_bad_blob()
+ except Exception as ex:
+ msg_py3 = "required argument is not an integer"
+ msg_py2 = "cannot convert argument to integer"
+ assert msg_py2 in str(ex) or msg_py3 in str(ex)
+
+ ## 2nd time should not fail due to stray lock file
+ try:
+ add_bad_blob()
+ except Exception as ex:
+ assert "index.lock' could not be obtained" not in str(ex)
@with_rw_repo('0.1.6')
def test_index_file_from_tree(self, rw_repo):
diff --git a/git/test/test_repo.py b/git/test/test_repo.py
index e24062c1..d04a0f66 100644
--- a/git/test/test_repo.py
+++ b/git/test/test_repo.py
@@ -115,6 +115,7 @@ class TestRepo(TestBase):
assert commit.type == 'commit'
assert self.rorepo.commit(commit) == commit
+ def test_commits(self):
mc = 10
commits = list(self.rorepo.iter_commits('0.1.6', max_count=mc))
assert len(commits) == mc