diff options
-rw-r--r-- | TODO | 26 | ||||
-rw-r--r-- | lib/git/index.py | 8 | ||||
-rw-r--r-- | lib/git/repo.py | 9 | ||||
-rw-r--r-- | test/git/test_repo.py | 6 |
4 files changed, 39 insertions, 10 deletions
@@ -50,32 +50,44 @@ Overhaul docs - check examples, check looks, improve existing docs Index ----- -* write_tree should write a tree directly, which would require ability to create +* [advanced] + write_tree should write a tree directly, which would require ability to create objects in the first place. Should be rather simple as it is "tree" bytes datablock | sha1sum and zipped. Currently we use some file swapping and the git command to do it which probably is much slower. The thing is that properly writing a tree from an index involves creating several tree objects, so in the end it might be slower. Hmm, probably its okay to use the command unless we go c(++) +* Proper merge handling with index and working copy +* Checkout individual blobs using the index and git-checkout. Blobs can already + be written using their stream_data method. Refs ----- -* If the HEAD is detached as it points to a specific commit, its not technically - a symbolic reference anymore. Currently, we cannot handle this that well - as we do not check for this case. This should be added though as it is - valid to have a detached head in some cases. - +* When adjusting the reference of a symbolic reference, the ref log might need + adjustments as well. This is not critical, but would make things totally 'right' +* Reference Objects should be able to set the commit they are pointing to, making + the commit property read-write. Tags are a special case of this and would need + to be handled as well ! +* Ability to create new heads and tags in the Repository ( but using the respective + Reference Type ), i.e. Head.create(repo, name, commit = 'HEAD') or + TagReference.create(repo, name +* Ability to rename references and tags +* Ability to remove references and tags + Remote ------ * 'push' method needs a test, a true test repository is required though, a fork of a fork would do :)! +* Fetch should return heads that where updated, pull as well. Repo ---- * Blame: Read the blame format making assumptions about its structure, currently regex are used a lot although we can deduct what will be next. - Read data from a stream directly from git command - +* Figure out how to implement a proper merge API + Submodules ---------- * add submodule support diff --git a/lib/git/index.py b/lib/git/index.py index 5f13790c..5452708d 100644 --- a/lib/git/index.py +++ b/lib/git/index.py @@ -289,7 +289,8 @@ class IndexFile(LazyMixin, diff.Diffable): ``file_path`` If None, we will write to our stored file path from which we have been initialized. Otherwise we write to the given file path. - Please note that this will not change the file_path of this index. + Please note that this will change the file_path of this index to + the one you gave. Returns self @@ -319,7 +320,10 @@ class IndexFile(LazyMixin, diff.Diffable): # write the sha over the content stream.write_sha() write_op._end_writing() - + + # make sure we represent what we have written + if file_path is not None: + self._file_path = file_path @classmethod def from_tree(cls, repo, *treeish, **kwargs): diff --git a/lib/git/repo.py b/lib/git/repo.py index 94555a31..569d6f1b 100644 --- a/lib/git/repo.py +++ b/lib/git/repo.py @@ -14,6 +14,7 @@ from errors import InvalidGitRepositoryError, NoSuchPathError from cmd import Git from actor import Actor from refs import * +from index import IndexFile from objects import * from config import GitConfigParser from remote import Remote @@ -145,6 +146,14 @@ class Repo(object): # alias heads branches = heads + + @property + def index(self): + """ + Returns + IndexFile representing this repository's index. + """ + return IndexFile(self) @property def head(self): diff --git a/test/git/test_repo.py b/test/git/test_repo.py index b02610f4..4995d901 100644 --- a/test/git/test_repo.py +++ b/test/git/test_repo.py @@ -170,7 +170,11 @@ class TestRepo(TestBase): def test_head(self): assert self.rorepo.head.reference.object == self.rorepo.active_branch.object - + + def test_index(self): + index = self.rorepo.index + assert isinstance(index, IndexFile) + def test_tag(self): assert self.rorepo.tag('refs/tags/0.1.5').commit |