diff options
author | Sebastian Thiel <byronimo@gmail.com> | 2009-10-18 14:25:14 +0200 |
---|---|---|
committer | Sebastian Thiel <byronimo@gmail.com> | 2009-10-18 14:25:14 +0200 |
commit | 225999e9442c746333a8baa17a6dbf7341c135ca (patch) | |
tree | 82e4bdf8a59fae869bae41aa6b9b048fee2d3e09 /lib/git/repo.py | |
parent | 919164df96d9f956c8be712f33a9a037b097745b (diff) | |
parent | 9acc7806d6bdb306a929c460437d3d03e5e48dcd (diff) | |
download | gitpython-225999e9442c746333a8baa17a6dbf7341c135ca.tar.gz |
Merge branch 'diffing' into improvements
* diffing:
DiffIndex implemented including test
diff: implemented raw diff parsing which appears to be able to handle possible input types, DiffIndex still requires implementation though
resolved cyclic inclusion issue by moving the Diffable interface into the diff module, which probably is the right thing to do anyway
repo: fixed untracked files function which used git-commit before, it can open vim to get a message though which makes the program appear to freeze - using git-status now
implemented diff tests, but will have to move the diff module as it needs to create objects, whose import would create a dependency cycle
Removed a few diff-related test cases that fail now as the respective method is missing - these tests have to be redone in test-diff module accordingly
added Diffable interface to objects.base, its used by Commit and Tree objects.
Fixed object bug that would cause object ids not to be resolved to sha's as this was assumed - now there is a test for it as well
Diffstat (limited to 'lib/git/repo.py')
-rw-r--r-- | lib/git/repo.py | 40 |
1 files changed, 11 insertions, 29 deletions
diff --git a/lib/git/repo.py b/lib/git/repo.py index 6edb7f62..cc4a6c6b 100644 --- a/lib/git/repo.py +++ b/lib/git/repo.py @@ -107,6 +107,15 @@ class Repo(object): branches = heads @property + def head(self): + """ + Return + Head Object, reference pointing to the current head of the repository + """ + return Head(self,'HEAD') + + + @property def tags(self): """ A list of ``Tag`` objects that are available in this repo @@ -129,7 +138,7 @@ class Repo(object): if rev is None: rev = self.active_branch - c = Object(self, rev) + c = Object.new(self, rev) assert c.type == "commit", "Revision %s did not point to a commit, but to %s" % (rev, c) return c @@ -299,7 +308,7 @@ class Repo(object): ignored files will not appear here, i.e. files mentioned in .gitignore """ # make sure we get all files, no only untracked directores - proc = self.git.commit(untracked_files=True, as_process=True) + proc = self.git.status(untracked_files=True, as_process=True) stream = iter(proc.stdout) untracked_files = list() for line in stream: @@ -327,34 +336,7 @@ class Repo(object): """ return Head( self, self.git.symbolic_ref('HEAD').strip() ) - - def diff(self, a, b, *paths): - """ - The diff from commit ``a`` to commit ``b``, optionally restricted to the given file(s) - - ``a`` - is the base commit - ``b`` - is the other commit - - ``paths`` - is an optional list of file paths on which to restrict the diff - Returns - ``str`` - """ - return self.git.diff(a, b, '--', *paths) - - def commit_diff(self, commit): - """ - The commit diff for the given commit - ``commit`` is the commit name/id - - Returns - ``git.Diff[]`` - """ - return Commit.diff(self, commit) - def blame(self, rev, file): """ The blame information for the given file at the given revision. |