diff options
author | Michael Trier <mtrier@gmail.com> | 2010-03-03 23:46:23 -0500 |
---|---|---|
committer | Michael Trier <mtrier@gmail.com> | 2010-03-03 23:46:23 -0500 |
commit | e3e2c8c14b861b4d4865a9574e812ef9f2609771 (patch) | |
tree | c71c7da3843389ea3b7041a0200d7abe3b0e580d | |
parent | acb0fa8b94ef421ad60c8507b634759a472cd56c (diff) | |
download | gitpython-e3e2c8c14b861b4d4865a9574e812ef9f2609771.tar.gz |
Corrected a bunch of whitespace that makes some folks crazy. Added Sebastian to the AUTHORS file.
35 files changed, 155 insertions, 154 deletions
@@ -10,5 +10,6 @@ Contributors are: -Steve Frécinaux <code _at_ istique.net> -Kai Lautaportti <kai _at_ lautaportti.fi> -Paul Sowden <paul _at_ idontsmoke.co.uk> +-Sebastian Thiel http://www.linkedin.com/in/sebastianthiel Portions derived from other open source works and are clearly marked. @@ -1,4 +1,4 @@ -Copyright (C) 2008, 2009 Michael Trier and contributors +Copyright (C) 2008-2010 Michael Trier and contributors All rights reserved. Redistribution and use in source and binary forms, with or without @@ -23,7 +23,7 @@ REQUIREMENTS INSTALL ======= - python setup.py install + python setup.py install SOURCE ====== @@ -4,32 +4,32 @@ TODO General ------- -* Classes requiring repo actually only need the git command - this should be +* Classes requiring repo actually only need the git command - this should be changed to limit their access level and make things a little safer. -* Check for correct usage of id, ref and hexsha and define their meanings, - currently its not so clear what id may be in cases or not - afaik its usually +* Check for correct usage of id, ref and hexsha and define their meanings, + currently its not so clear what id may be in cases or not - afaik its usually a sha or ref unless cat-file is used where it must be a sha * Derive all Object like items like types such as Commit, Tag(Object), Tree, Blob - from a common base. This allows to easily add __eq__, __ne__, __hash__ method + from a common base. This allows to easily add __eq__, __ne__, __hash__ method to make their use more comfortable and reduces code duplication. * References like Tag(Reference), Heads and Remotes should have an own Base class -* Optimize type size by adding __slots__ ( at least ), which would also make sure +* Optimize type size by adding __slots__ ( at least ), which would also make sure no one accidentally adds attributes to classes. * Add more performance tests, see branch "performance_testing" Configuration ------------- -* Native configuration handling, ideally without using git-config for it to keep +* Native configuration handling, ideally without using git-config for it to keep handling fast - + Docs ---- Overhaul docs - check examples, check looks, improve existing docs Remotes ------- -* Remote handling should be rather easy to implement as it is 'just' another - type of reference. It will be more work to do it right and allow convenient +* Remote handling should be rather easy to implement as it is 'just' another + type of reference. It will be more work to do it right and allow convenient access to the most common operations on remotes though. Submodules diff --git a/doc/conf.py b/doc/conf.py index c87d2b39..42200b8c 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -43,7 +43,7 @@ master_doc = 'index' # General information about the project. project = u'GitPython' -copyright = u'Copyright (C) 2008, 2009 Michael Trier and contributors' +copyright = u'Copyright (C) 2008-2010 Michael Trier and contributors' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the diff --git a/lib/git/__init__.py b/lib/git/__init__.py index 28d14d0c..393fb8a4 100644 --- a/lib/git/__init__.py +++ b/lib/git/__init__.py @@ -1,5 +1,5 @@ # __init__.py -# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors +# Copyright (C) 2008-2010 Michael Trier (mtrier@gmail.com) and contributors # # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php diff --git a/lib/git/actor.py b/lib/git/actor.py index bc1a4479..de85a202 100644 --- a/lib/git/actor.py +++ b/lib/git/actor.py @@ -1,5 +1,5 @@ # actor.py -# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors +# Copyright (C) 2008-2010 Michael Trier (mtrier@gmail.com) and contributors # # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php @@ -7,8 +7,8 @@ import re class Actor(object): - """Actors hold information about a person acting on the repository. They - can be committers and authors or anything with a name and an email as + """Actors hold information about a person acting on the repository. They + can be committers and authors or anything with a name and an email as mentioned in the git log entries.""" def __init__(self, name, email): self.name = name diff --git a/lib/git/blob.py b/lib/git/blob.py index 82a41f73..e63037d4 100644 --- a/lib/git/blob.py +++ b/lib/git/blob.py @@ -1,5 +1,5 @@ # blob.py -# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors +# Copyright (C) 2008-2010 Michael Trier (mtrier@gmail.com) and contributors # # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php @@ -49,7 +49,7 @@ class Blob(object): Returns int - + NOTE The size will be cached after the first access """ @@ -64,7 +64,7 @@ class Blob(object): Returns str - + NOTE The data will be cached after the first access. """ @@ -78,7 +78,7 @@ class Blob(object): Returns str - + NOTE Defaults to 'text/plain' in case the actual file type is unknown. """ @@ -102,7 +102,7 @@ class Blob(object): Returns list: [git.Commit, list: [<line>]] - A list of tuples associating a Commit object with a list of lines that + A list of tuples associating a Commit object with a list of lines that changed within the given commit. The Commit objects will be given in order of appearance. """ diff --git a/lib/git/cmd.py b/lib/git/cmd.py index aef53350..98314191 100644 --- a/lib/git/cmd.py +++ b/lib/git/cmd.py @@ -1,5 +1,5 @@ # cmd.py -# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors +# Copyright (C) 2008-2010 Michael Trier (mtrier@gmail.com) and contributors # # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php @@ -23,24 +23,24 @@ if sys.platform == 'win32': class Git(object): """ The Git class manages communication with the Git binary. - + It provides a convenient interface to calling the Git binary, such as in:: - + g = Git( git_dir ) g.init() # calls 'git init' program rval = g.ls_files() # calls 'git ls-files' program - + ``Debugging`` - Set the GIT_PYTHON_TRACE environment variable print each invocation + Set the GIT_PYTHON_TRACE environment variable print each invocation of the command to stdout. Set its value to 'full' to see details about the returned values. """ def __init__(self, git_dir=None): """ Initialize this instance with: - + ``git_dir`` - Git directory we should work in. If None, we always work in the current + Git directory we should work in. If None, we always work in the current directory as returned by os.getcwd() """ super(Git, self).__init__() @@ -48,7 +48,7 @@ class Git(object): def __getattr__(self, name): """ - A convenience method as it allows to call the command as if it was + A convenience method as it allows to call the command as if it was an object. Returns Callable object that will execute call _call_process with your arguments. @@ -99,15 +99,15 @@ class Git(object): Whether to avoid stripping off trailing whitespace. Returns:: - + str(output) # extended_output = False (Default) tuple(int(status), str(stdout), str(stderr)) # extended_output = True - + Raise - GitCommandError - + GitCommandError + NOTE - If you add additional keyword arguments to the signature of this method, + If you add additional keyword arguments to the signature of this method, you must update the execute_kwargs tuple housed in this module. """ if GIT_PYTHON_TRACE and not GIT_PYTHON_TRACE == 'full': diff --git a/lib/git/commit.py b/lib/git/commit.py index 1cb863ca..591fb38b 100644 --- a/lib/git/commit.py +++ b/lib/git/commit.py @@ -1,5 +1,5 @@ # commit.py -# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors +# Copyright (C) 2008-2010 Michael Trier (mtrier@gmail.com) and contributors # # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php @@ -16,16 +16,16 @@ import stats class Commit(LazyMixin): """ Wraps a git Commit object. - - This class will act lazily on some of its attributes and will query the + + This class will act lazily on some of its attributes and will query the value on demand only if it involves calling the git binary. """ def __init__(self, repo, id, tree=None, author=None, authored_date=None, committer=None, committed_date=None, message=None, parents=None): """ - Instantiate a new Commit. All keyword arguments taking None as default will - be implicitly set if id names a valid sha. - + Instantiate a new Commit. All keyword arguments taking None as default will + be implicitly set if id names a valid sha. + The parameter documentation indicates the type of the argument after a colon ':'. ``id`` @@ -75,7 +75,7 @@ class Commit(LazyMixin): def __bake__(self): """ - Called by LazyMixin superclass when the first uninitialized member needs + Called by LazyMixin superclass when the first uninitialized member needs to be set as it is queried. """ temp = Commit.find_all(self.repo, self.id, max_count=1)[0] @@ -133,7 +133,7 @@ class Commit(LazyMixin): is the ref from which to begin (SHA1 or name) ``path`` - is an optinal path, if set only Commits that include the path + is an optinal path, if set only Commits that include the path will be considered ``kwargs`` @@ -210,9 +210,9 @@ class Commit(LazyMixin): Returns git.Diff[]:: - + between tree and the index if only a is given - between two trees if a and b are given and are commits + between two trees if a and b are given and are commits """ paths = paths or [] @@ -234,7 +234,7 @@ class Commit(LazyMixin): """ Returns git.Diff[] - Diffs between this commit and its first parent or all changes if this + Diffs between this commit and its first parent or all changes if this commit is the first commit and has no parent. """ if not self.parents: @@ -252,9 +252,9 @@ class Commit(LazyMixin): @property def stats(self): """ - Create a git stat from changes between this commit and its first parent + Create a git stat from changes between this commit and its first parent or from all changes done if this is the very first commit. - + Return git.Stats """ diff --git a/lib/git/diff.py b/lib/git/diff.py index 0216e061..6c4ba65c 100644 --- a/lib/git/diff.py +++ b/lib/git/diff.py @@ -1,5 +1,5 @@ # diff.py -# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors +# Copyright (C) 2008-2010 Michael Trier (mtrier@gmail.com) and contributors # # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php diff --git a/lib/git/errors.py b/lib/git/errors.py index 2632d5f3..86debaac 100644 --- a/lib/git/errors.py +++ b/lib/git/errors.py @@ -1,5 +1,5 @@ # errors.py -# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors +# Copyright (C) 2008-2010 Michael Trier (mtrier@gmail.com) and contributors # # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php diff --git a/lib/git/head.py b/lib/git/head.py index 639cee40..f2e9e3f2 100644 --- a/lib/git/head.py +++ b/lib/git/head.py @@ -1,5 +1,5 @@ # head.py -# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors +# Copyright (C) 2008-2010 Michael Trier (mtrier@gmail.com) and contributors # # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php @@ -16,10 +16,10 @@ class Head(object): >>> repo = Repo("/path/to/repo") >>> head = repo.heads[0] - >>> head.name + >>> head.name 'master' - >>> head.commit + >>> head.commit <git.Commit "1c09f116cbc2cb4100fb6935bb162daa4723f455"> >>> head.commit.id @@ -53,7 +53,7 @@ class Head(object): Returns git.Head[] - + List is sorted by committerdate """ @@ -96,7 +96,7 @@ class Head(object): is the formatted head information Format:: - + name: [a-zA-Z_/]+ <null byte> id: [0-9A-Fa-f]{40} diff --git a/lib/git/lazy.py b/lib/git/lazy.py index 5e470181..59c5f062 100644 --- a/lib/git/lazy.py +++ b/lib/git/lazy.py @@ -1,5 +1,5 @@ # lazy.py -# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors +# Copyright (C) 2008-2010 Michael Trier (mtrier@gmail.com) and contributors # # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php diff --git a/lib/git/repo.py b/lib/git/repo.py index ae9b94c3..3490499c 100644 --- a/lib/git/repo.py +++ b/lib/git/repo.py @@ -1,5 +1,5 @@ # repo.py -# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors +# Copyright (C) 2008-2010 Michael Trier (mtrier@gmail.com) and contributors # # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php @@ -19,7 +19,7 @@ from tree import Tree class Repo(object): """ - Represents a git repository and allows you to query references, + Represents a git repository and allows you to query references, gather commit information, generate diffs, create and clone repositories query the log. """ @@ -125,7 +125,7 @@ class Repo(object): is the maximum number of commits to return (default 10) ``skip`` - is the number of commits to skip (default 0) which will effectively + is the number of commits to skip (default 0) which will effectively move your commit-window by the given number. Returns @@ -162,7 +162,7 @@ class Repo(object): ``path`` is an optinal path to limit the returned commits to. - + ``since`` is a string represeting a date/time @@ -215,7 +215,7 @@ class Repo(object): """ Returns a list of commits that is in ``other_repo`` but not in self - Returns + Returns git.Commit[] """ repo_refs = self.git.rev_list(ref, '--').strip().splitlines() @@ -256,7 +256,7 @@ class Repo(object): def log(self, commit='master', path=None, **kwargs): """ The Commit for a treeish, and all commits leading to it. - + ``kwargs`` keyword arguments specifying flags to be used in git-log command, i.e.: max_count=1 to limit the amount of commits returned @@ -283,7 +283,7 @@ class Repo(object): ``paths`` is an optional list of file paths on which to restrict the diff - + Returns ``str`` """ @@ -452,20 +452,20 @@ class Repo(object): Sets the alternates ``alts`` - is the array of string paths representing the alternates at which + is the array of string paths representing the alternates at which git should look for objects, i.e. /home/user/repo/.git/objects Raises NoSuchPathError - + Note The method does not check for the existance of the paths in alts as the caller is responsible. - + Returns None """ - alternates_path = os.path.join(self.path, 'objects', 'info', 'alternates') + alternates_path = os.path.join(self.path, 'objects', 'info', 'alternates') if not alts: if os.path.isfile(alternates_path): os.remove(alternates_path) @@ -475,7 +475,7 @@ class Repo(object): f.write("\n".join(alts)) finally: f.close() - # END file handling + # END file handling # END alts handling alternates = property(_get_alternates, _set_alternates, doc="Retrieve a list of alternates paths or set a list paths to be used as alternates") @@ -489,8 +489,8 @@ class Repo(object): ``True``, if the index has any uncommitted changes, otherwise ``False`` - NOTE - Working tree changes that have not been staged will not be detected ! + NOTE + Working tree changes that have not been staged will not be detected ! """ if self.bare: # Bare repositories with no associated working directory are diff --git a/lib/git/stats.py b/lib/git/stats.py index 307e2f2f..74f0aed9 100644 --- a/lib/git/stats.py +++ b/lib/git/stats.py @@ -1,35 +1,35 @@ # stats.py -# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors +# Copyright (C) 2008-2010 Michael Trier (mtrier@gmail.com) and contributors # # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php class Stats(object): """ - Represents stat information as presented by git at the end of a merge. It is + Represents stat information as presented by git at the end of a merge. It is created from the output of a diff operation. - + ``Example``:: - + c = Commit( sha1 ) s = c.stats s.total # full-stat-dict s.files # dict( filepath : stat-dict ) - + ``stat-dict`` - + A dictionary with the following keys and values:: - + deletions = number of deleted lines as int insertions = number of inserted lines as int lines = total number of lines changed as int, or deletions + insertions - + ``full-stat-dict`` - + In addition to the items in the stat-dict, it features additional information:: - + files = number of changed files as int - + """ def __init__(self, repo, total, files): self.repo = repo @@ -38,12 +38,12 @@ class Stats(object): @classmethod def list_from_string(cls, repo, text): - """ - Create a Stat object from output retrieved by git-diff. - - Returns - git.Stat - """ + """ + Create a Stat object from output retrieved by git-diff. + + Returns + git.Stat + """ hsh = {'total': {'insertions': 0, 'deletions': 0, 'lines': 0, 'files': 0}, 'files': {}} for line in text.splitlines(): (raw_insertions, raw_deletions, filename) = line.split("\t") diff --git a/lib/git/tag.py b/lib/git/tag.py index 8413ce73..8ec2f8ae 100644 --- a/lib/git/tag.py +++ b/lib/git/tag.py @@ -1,5 +1,5 @@ # tag.py -# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors +# Copyright (C) 2008-2010 Michael Trier (mtrier@gmail.com) and contributors # # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php @@ -29,12 +29,12 @@ class Tag(object): is the Repo ``kwargs`` - Additional options given as keyword arguments, will be passed + Additional options given as keyword arguments, will be passed to git-for-each-ref Returns ``git.Tag[]`` - + List is sorted by committerdate """ options = {'sort': "committerdate", @@ -75,11 +75,11 @@ class Tag(object): is the formatted tag information Format:: - + name: [a-zA-Z_/]+ <null byte> id: [0-9A-Fa-f]{40} - + Returns git.Tag """ diff --git a/lib/git/tree.py b/lib/git/tree.py index cfb0881c..aaeca828 100644 --- a/lib/git/tree.py +++ b/lib/git/tree.py @@ -1,5 +1,5 @@ # tree.py -# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors +# Copyright (C) 2008-2010 Michael Trier (mtrier@gmail.com) and contributors # # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php diff --git a/lib/git/utils.py b/lib/git/utils.py index 8425a728..a7d7543c 100644 --- a/lib/git/utils.py +++ b/lib/git/utils.py @@ -1,5 +1,5 @@ # utils.py -# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors +# Copyright (C) 2008-2010 Michael Trier (mtrier@gmail.com) and contributors # # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php diff --git a/test/__init__.py b/test/__init__.py index 757cbad1..ca6ed8dc 100644 --- a/test/__init__.py +++ b/test/__init__.py @@ -1,5 +1,5 @@ # __init__.py -# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors +# Copyright (C) 2008-2010 Michael Trier (mtrier@gmail.com) and contributors # # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php diff --git a/test/git/__init__.py b/test/git/__init__.py index 757cbad1..ca6ed8dc 100644 --- a/test/git/__init__.py +++ b/test/git/__init__.py @@ -1,5 +1,5 @@ # __init__.py -# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors +# Copyright (C) 2008-2010 Michael Trier (mtrier@gmail.com) and contributors # # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php diff --git a/test/git/test_actor.py b/test/git/test_actor.py index 862010fc..bdedf8d9 100644 --- a/test/git/test_actor.py +++ b/test/git/test_actor.py @@ -1,5 +1,5 @@ # test_actor.py -# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors +# Copyright (C) 2008-2010 Michael Trier (mtrier@gmail.com) and contributors # # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php diff --git a/test/git/test_blob.py b/test/git/test_blob.py index 5bd74ff7..607f2378 100644 --- a/test/git/test_blob.py +++ b/test/git/test_blob.py @@ -1,5 +1,5 @@ # test_blob.py -# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors +# Copyright (C) 2008-2010 Michael Trier (mtrier@gmail.com) and contributors # # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php @@ -11,7 +11,7 @@ from git import * class TestBlob(object): def setup(self): self.repo = Repo(GIT_REPO) - + @patch_object(Git, '_call_process') def test_should_return_blob_contents(self, git): git.return_value = fixture('cat_file_blob') @@ -27,7 +27,7 @@ class TestBlob(object): assert_equal("Hello world\n", blob.data) assert_true(git.called) assert_equal(git.call_args, (('cat_file', 'abc'), {'p': True, 'with_raw_output': True})) - + @patch_object(Git, '_call_process') def test_should_cache_data(self, git): git.return_value = fixture('cat_file_blob') @@ -55,15 +55,15 @@ class TestBlob(object): assert_true(git.called) assert_equal(git.call_count, 1) assert_equal(git.call_args, (('cat_file', 'abc'), {'s': True})) - + def test_mime_type_should_return_mime_type_for_known_types(self): blob = Blob(self.repo, **{'id': 'abc', 'name': 'foo.png'}) assert_equal("image/png", blob.mime_type) - + def test_mime_type_should_return_text_plain_for_unknown_types(self): blob = Blob(self.repo, **{'id': 'abc'}) assert_equal("text/plain", blob.mime_type) - + @patch_object(Git, '_call_process') def test_should_display_blame_information(self, git): git.return_value = fixture('blame') @@ -75,7 +75,7 @@ class TestBlob(object): c = b[0][0] assert_true(git.called) assert_equal(git.call_args, (('blame', 'master', '--', 'lib/git.py'), {'p': True})) - + assert_equal('634396b2f541a9f2d58b00be1a07f0c358b999b3', c.id) assert_equal('Tom Preston-Werner', c.author.name) assert_equal('tom@mojombo.com', c.author.email) @@ -84,14 +84,14 @@ class TestBlob(object): assert_equal('tom@mojombo.com', c.committer.email) assert_equal(time.gmtime(1191997100), c.committed_date) assert_equal('initial grit setup', c.message) - + # test the 'lines per commit' entries tlist = b[0][1] assert_true( tlist ) assert_true( isinstance( tlist[0], basestring ) ) - assert_true( len( tlist ) < sum( len(t) for t in tlist ) ) # test for single-char bug - - + assert_true( len( tlist ) < sum( len(t) for t in tlist ) ) # test for single-char bug + + def test_should_return_appropriate_representation(self): blob = Blob(self.repo, **{'id': 'abc'}) assert_equal('<git.Blob "abc">', repr(blob)) diff --git a/test/git/test_commit.py b/test/git/test_commit.py index 3e37a7a4..2fa47952 100644 --- a/test/git/test_commit.py +++ b/test/git/test_commit.py @@ -1,5 +1,5 @@ # test_commit.py -# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors +# Copyright (C) 2008-2010 Michael Trier (mtrier@gmail.com) and contributors # # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php diff --git a/test/git/test_diff.py b/test/git/test_diff.py index 65a27e98..61ab82fb 100644 --- a/test/git/test_diff.py +++ b/test/git/test_diff.py @@ -1,5 +1,5 @@ # test_diff.py -# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors +# Copyright (C) 2008-2010 Michael Trier (mtrier@gmail.com) and contributors # # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php diff --git a/test/git/test_git.py b/test/git/test_git.py index 6e28f4c0..079427ed 100644 --- a/test/git/test_git.py +++ b/test/git/test_git.py @@ -1,5 +1,5 @@ # test_git.py -# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors +# Copyright (C) 2008-2010 Michael Trier (mtrier@gmail.com) and contributors # # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php diff --git a/test/git/test_head.py b/test/git/test_head.py index e3408974..ab310276 100644 --- a/test/git/test_head.py +++ b/test/git/test_head.py @@ -1,5 +1,5 @@ # test_head.py -# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors +# Copyright (C) 2008-2010 Michael Trier (mtrier@gmail.com) and contributors # # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php @@ -14,11 +14,11 @@ class TestHead(object): @patch_object(Git, '_call_process') def test_repr(self, git): git.return_value = fixture('for_each_ref') - + head = self.repo.heads[0] - + assert_equal('<git.Head "%s">' % head.name, repr(head)) - + assert_true(git.called) assert_equal(git.call_args, (('for_each_ref', 'refs/heads'), {'sort': 'committerdate', 'format': '%(refname)%00%(objectname)'})) diff --git a/test/git/test_repo.py b/test/git/test_repo.py index abf17be8..19fb0691 100644 --- a/test/git/test_repo.py +++ b/test/git/test_repo.py @@ -1,5 +1,5 @@ # test_repo.py -# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors +# Copyright (C) 2008-2010 Michael Trier (mtrier@gmail.com) and contributors # # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php @@ -12,7 +12,7 @@ from git import * class TestRepo(object): def setup(self): self.repo = Repo(GIT_REPO) - + @raises(InvalidGitRepositoryError) def test_new_should_raise_on_invalid_repo_location(self): if sys.platform == "win32": @@ -199,12 +199,12 @@ class TestRepo(object): self.repo.archive_tar_gz() def test_disable_daemon_export(self): - prev_value = self.repo.daemon_export + prev_value = self.repo.daemon_export self.repo.daemon_export = not prev_value assert_equal(self.repo.daemon_export, not prev_value) self.repo.daemon_export = prev_value assert_equal(self.repo.daemon_export, prev_value) - + def test_alternates(self): cur_alternates = self.repo.alternates # empty alternates diff --git a/test/git/test_stats.py b/test/git/test_stats.py index b6f1b60e..c089bc39 100644 --- a/test/git/test_stats.py +++ b/test/git/test_stats.py @@ -1,5 +1,5 @@ # test_stats.py -# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors +# Copyright (C) 2008-2010 Michael Trier (mtrier@gmail.com) and contributors # # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php @@ -10,18 +10,18 @@ from git import * class TestStats(object): def setup(self): self.repo = Repo(GIT_REPO) - + def test_list_from_string(self): output = fixture('diff_numstat') stats = Stats.list_from_string(self.repo, output) - + assert_equal(2, stats.total['files']) assert_equal(52, stats.total['lines']) assert_equal(29, stats.total['insertions']) assert_equal(23, stats.total['deletions']) - + assert_equal(29, stats.files["a.txt"]['insertions']) assert_equal(18, stats.files["a.txt"]['deletions']) - + assert_equal(0, stats.files["b.txt"]['insertions']) assert_equal(5, stats.files["b.txt"]['deletions']) diff --git a/test/git/test_tag.py b/test/git/test_tag.py index 732bbd45..3df617ce 100644 --- a/test/git/test_tag.py +++ b/test/git/test_tag.py @@ -1,5 +1,5 @@ # test_tag.py -# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors +# Copyright (C) 2008-2010 Michael Trier (mtrier@gmail.com) and contributors # # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php @@ -15,22 +15,22 @@ class TestTag(object): @patch_object(Git, '_call_process') def test_list_from_string(self, git): git.return_value = fixture('for_each_ref_tags') - + tags = self.repo.tags - + assert_equal(1, len(tags)) assert_equal('v0.7.1', tags[0].name) assert_equal('634396b2f541a9f2d58b00be1a07f0c358b999b3', tags[0].commit.id) - + assert_true(git.called) assert_equal(git.call_args, (('for_each_ref', 'refs/tags'), {'sort': 'committerdate', 'format': '%(refname)%00%(objectname)'})) @patch_object(Git, '_call_process') def test_repr(self, git): git.return_value = fixture('for_each_ref') - + tag = self.repo.tags[0] assert_equal('<git.Tag "%s">' % tag.name, repr(tag)) - + assert_true(git.called) assert_equal(git.call_args, (('for_each_ref', 'refs/tags'), {'sort': 'committerdate', 'format': '%(refname)%00%(objectname)'})) diff --git a/test/git/test_tree.py b/test/git/test_tree.py index 947b0ffb..0ab6b9bc 100644 --- a/test/git/test_tree.py +++ b/test/git/test_tree.py @@ -1,5 +1,5 @@ # test_tree.py -# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors +# Copyright (C) 2008-2010 Michael Trier (mtrier@gmail.com) and contributors # # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php @@ -14,17 +14,17 @@ class TestTree(object): @patch_object(Git, '_call_process') def test_contents_should_cache(self, git): git.return_value = fixture('ls_tree_a') + fixture('ls_tree_b') - + tree = self.repo.tree('master') child = tree['grit'] child.items() child.items() - + assert_true(git.called) assert_equal(2, git.call_count) assert_equal(git.call_args, (('ls_tree', '34868e6e7384cb5ee51c543a8187fdff2675b5a7'), {})) - + def test_content_from_string_tree_should_return_tree(self): text = fixture('ls_tree_a').splitlines()[-1] tree = Tree.content_from_string(None, text) @@ -33,23 +33,23 @@ class TestTree(object): assert_equal("650fa3f0c17f1edb4ae53d8dcca4ac59d86e6c44", tree.id) assert_equal("040000", tree.mode) assert_equal("test", tree.name) - + def test_content_from_string_tree_should_return_blob(self): text = fixture('ls_tree_b').split("\n")[0] - + tree = Tree.content_from_string(None, text) assert_equal(Blob, tree.__class__) assert_equal("aa94e396335d2957ca92606f909e53e7beaf3fbb", tree.id) assert_equal("100644", tree.mode) assert_equal("grit.rb", tree.name) - + def test_content_from_string_tree_should_return_commit(self): text = fixture('ls_tree_commit').split("\n")[1] - + tree = Tree.content_from_string(None, text) assert_none(tree) - + @raises(TypeError) def test_content_from_string_invalid_type_should_raise(self): Tree.content_from_string(None, "040000 bogus 650fa3f0c17f1edb4ae53d8dcca4ac59d86e6c44 test") @@ -59,35 +59,35 @@ class TestTree(object): def test_slash(self, git, blob): git.return_value = fixture('ls_tree_a') blob.return_value = 1 - + tree = self.repo.tree('master') - + assert_equal('aa06ba24b4e3f463b3c4a85469d0fb9e5b421cf8', (tree/'lib').id) assert_equal('8b1e02c0fb554eed2ce2ef737a68bb369d7527df', (tree/'README.txt').id) - + assert_true(git.called) assert_equal(git.call_args, (('ls_tree', 'master'), {})) - + @patch_object(Blob, 'size') @patch_object(Git, '_call_process') def test_slash_with_zero_length_file(self, git, blob): git.return_value = fixture('ls_tree_a') blob.return_value = 0 - + tree = self.repo.tree('master') - + assert_not_none(tree/'README.txt') assert_equal('8b1e02c0fb554eed2ce2ef737a68bb369d7527df', (tree/'README.txt').id) - + assert_true(git.called) assert_equal(git.call_args, (('ls_tree', 'master'), {})) - + @patch_object(Git, '_call_process') def test_slash_with_commits(self, git): git.return_value = fixture('ls_tree_commit') tree = self.repo.tree('master') - + assert_none(tree/'bar') assert_equal('2afb47bcedf21663580d5e6d2f406f08f3f65f19', (tree/'foo').id) assert_equal('f623ee576a09ca491c4a27e48c0dfe04be5f4a2e', (tree/'baz').id) diff --git a/test/git/test_utils.py b/test/git/test_utils.py index 327a07ed..36e9c4bb 100644 --- a/test/git/test_utils.py +++ b/test/git/test_utils.py @@ -1,5 +1,5 @@ # test_utils.py -# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors +# Copyright (C) 2008-2010 Michael Trier (mtrier@gmail.com) and contributors # # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php diff --git a/test/testlib/__init__.py b/test/testlib/__init__.py index 77512794..e4136fcd 100644 --- a/test/testlib/__init__.py +++ b/test/testlib/__init__.py @@ -1,5 +1,5 @@ # __init__.py -# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors +# Copyright (C) 2008-2010 Michael Trier (mtrier@gmail.com) and contributors # # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php diff --git a/test/testlib/asserts.py b/test/testlib/asserts.py index f66af122..9a7b4050 100644 --- a/test/testlib/asserts.py +++ b/test/testlib/asserts.py @@ -1,5 +1,5 @@ # asserts.py -# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors +# Copyright (C) 2008-2010 Michael Trier (mtrier@gmail.com) and contributors # # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php @@ -9,7 +9,7 @@ import unittest from nose import tools from nose.tools import * -__all__ = ['assert_instance_of', 'assert_not_instance_of', +__all__ = ['assert_instance_of', 'assert_not_instance_of', 'assert_none', 'assert_not_none', 'assert_match', 'assert_not_match'] + tools.__all__ @@ -20,7 +20,7 @@ def assert_instance_of(expected, actual, msg=None): def assert_not_instance_of(expected, actual, msg=None): """Verify that object is not an instance of expected """ assert not isinstance(actual, expected, msg) - + def assert_none(actual, msg=None): """verify that item is None""" assert_equal(None, actual, msg) @@ -35,4 +35,4 @@ def assert_match(pattern, string, msg=None): def assert_not_match(pattern, string, msg=None): """verify that the pattern does not match the string""" - assert_none(re.search(pattern, string), msg)
\ No newline at end of file + assert_none(re.search(pattern, string), msg) diff --git a/test/testlib/helper.py b/test/testlib/helper.py index ca262ee4..94675249 100644 --- a/test/testlib/helper.py +++ b/test/testlib/helper.py @@ -1,5 +1,5 @@ # helper.py -# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors +# Copyright (C) 2008-2010 Michael Trier (mtrier@gmail.com) and contributors # # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php |