| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -51,11 +51,11 @@ Initialize a Repo object | |||
| 51 | 51 | The first step is to create a ``Repo`` object to represent your repository. | |
| 52 | 52 | ||
| 53 | 53 | >>> from git_python import * | |
| 54 | - >>> repo = Repo.new("/Users/mtrier/Development/git-python") | ||
| 54 | + >>> repo = Repo("/Users/mtrier/Development/git-python") | ||
| 55 | 55 | ||
| 56 | - In the above example, the directory ``/Users/mtrier/Development/git-python`` is my working | ||
| 57 | - repo and contains the ``.git`` directory. You can also initialize GitPython with a | ||
| 58 | - bare repo. | ||
| 56 | + In the above example, the directory ``/Users/mtrier/Development/git-python`` | ||
| 57 | + is my working repository and contains the ``.git`` directory. You can also | ||
| 58 | + initialize GitPython with a bare repository. | ||
| 59 | 59 | ||
| 60 | 60 | >>> repo = Repo.init_bare("/var/git/git-python.git") | |
| 61 | 61 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2,6 +2,10 @@ | |||
| 2 | 2 | import commit | |
| 3 | 3 | ||
| 4 | 4 | class Diff(object): | |
| 5 | + """ | ||
| 6 | + A Diff contains diff information between two commits. | ||
| 7 | + """ | ||
| 8 | + | ||
| 5 | 9 | def __init__(self, repo, a_path, b_path, a_commit, b_commit, a_mode, b_mode, new_file, deleted_file, diff): | |
| 6 | 10 | self.repo = repo | |
| 7 | 11 | self.a_path = a_path | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,6 +5,9 @@ | |||
| 5 | 5 | from method_missing import MethodMissingMixin | |
| 6 | 6 | ||
| 7 | 7 | class Git(MethodMissingMixin): | |
| 8 | + """ | ||
| 9 | + The Git class manages communication with the Git binary | ||
| 10 | + """ | ||
| 8 | 11 | def __init__(self, git_dir): | |
| 9 | 12 | super(Git, self).__init__() | |
| 10 | 13 | self.git_dir = git_dir | |
@@ -16,7 +19,13 @@ def get_dir(self): | |||
| 16 | 19 | return self.git_dir | |
| 17 | 20 | ||
| 18 | 21 | def execute(self, command): | |
| 19 | - print command | ||
| 22 | + """ | ||
| 23 | + Handles executing the command on the shell and consumes and returns | ||
| 24 | + the returned information (stdout) | ||
| 25 | + | ||
| 26 | + ``command`` | ||
| 27 | + The command to execute | ||
| 28 | + """ | ||
| 20 | 29 | proc = subprocess.Popen(command, | |
| 21 | 30 | shell=True, | |
| 22 | 31 | stdout=subprocess.PIPE, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -233,7 +233,7 @@ def diff(self, a, b, *paths): | |||
| 233 | 233 | ``paths`` | |
| 234 | 234 | is an optional list of file paths on which to restrict the diff | |
| 235 | 235 | """ | |
| 236 | - self.git.diff(a, b, '--', *paths) | ||
| 236 | + return self.git.diff(a, b, '--', *paths) | ||
| 237 | 237 | ||
| 238 | 238 | def commit_diff(self, commit): | |
| 239 | 239 | """ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -262,7 +262,7 @@ def test_alternates_setter_empty(self, os): | |||
| 262 | 262 | self.repo.alternates = [] | |
| 263 | 263 | assert_true(os.called) | |
| 264 | 264 | ||
| 265 | - def test_inspect(self): | ||
| 265 | + def test_repr(self): | ||
| 266 | 266 | assert_equal('<GitPython.Repo "%s/.git">' % os.path.abspath(GIT_REPO), repr(self.repo)) | |
| 267 | 267 | ||
| 268 | 268 | @patch(Git, 'method_missing') | |
| Back | FazBrowse Home | New Git URL |
0 commit comments