| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent e64957d commit aa5e366
6 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2,7 +2,6 @@ | |||
| 2 | 2 | TODO | |
| 3 | 3 | ==== | |
| 4 | 4 | ||
| 5 | - | ||
| 6 | 5 | General | |
| 7 | 6 | ------- | |
| 8 | 7 | * Classes requiring repo actually only need the git command - this should be | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -18,8 +18,6 @@ | |||
| 18 | 18 | from git.cmd import Git | |
| 19 | 19 | from git.repo import Repo | |
| 20 | 20 | from git.stats import Stats | |
| 21 | - from git.utils import dashify | ||
| 22 | - from git.utils import touch | ||
| 23 | 21 | from git.remote import Remote | |
| 24 | 22 | ||
| 25 | 23 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -20,6 +20,9 @@ | |||
| 20 | 20 | if sys.platform == 'win32': | |
| 21 | 21 | extra = {'shell': True} | |
| 22 | 22 | ||
| 23 | + def dashify(string): | ||
| 24 | + return string.replace('_', '-') | ||
| 25 | + | ||
| 23 | 26 | class Git(object): | |
| 24 | 27 | """ | |
| 25 | 28 | The Git class manages communication with the Git binary. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,14 +11,30 @@ | |||
| 11 | 11 | import StringIO | |
| 12 | 12 | ||
| 13 | 13 | from errors import InvalidGitRepositoryError, NoSuchPathError | |
| 14 | - from utils import touch, is_git_dir | ||
| 15 | 14 | from cmd import Git | |
| 16 | 15 | from actor import Actor | |
| 17 | 16 | from refs import * | |
| 18 | 17 | from objects import * | |
| 19 | 18 | from config import GitConfigParser | |
| 20 | 19 | from remote import Remote | |
| 21 | 20 | ||
| 21 | + def touch(filename): | ||
| 22 | + fp = open(filename, "w") | ||
| 23 | + fp.close() | ||
| 24 | + | ||
| 25 | + def is_git_dir(d): | ||
| 26 | + """ This is taken from the git setup.c:is_git_directory | ||
| 27 | + function.""" | ||
| 28 | + | ||
| 29 | + if os.path.isdir(d) and \ | ||
| 30 | + os.path.isdir(os.path.join(d, 'objects')) and \ | ||
| 31 | + os.path.isdir(os.path.join(d, 'refs')): | ||
| 32 | + headref = os.path.join(d, 'HEAD') | ||
| 33 | + return os.path.isfile(headref) or \ | ||
| 34 | + (os.path.islink(headref) and | ||
| 35 | + os.readlink(headref).startswith('refs')) | ||
| 36 | + return False | ||
| 37 | + | ||
| 22 | 38 | class Repo(object): | |
| 23 | 39 | """ | |
| 24 | 40 | Represents a git repository and allows you to query references, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6,26 +6,6 @@ | |||
| 6 | 6 | ||
| 7 | 7 | import os | |
| 8 | 8 | ||
| 9 | - def dashify(string): | ||
| 10 | - return string.replace('_', '-') | ||
| 11 | - | ||
| 12 | - def touch(filename): | ||
| 13 | - os.utime(filename) | ||
| 14 | - | ||
| 15 | - def is_git_dir(d): | ||
| 16 | - """ This is taken from the git setup.c:is_git_directory | ||
| 17 | - function.""" | ||
| 18 | - | ||
| 19 | - if os.path.isdir(d) and \ | ||
| 20 | - os.path.isdir(os.path.join(d, 'objects')) and \ | ||
| 21 | - os.path.isdir(os.path.join(d, 'refs')): | ||
| 22 | - headref = os.path.join(d, 'HEAD') | ||
| 23 | - return os.path.isfile(headref) or \ | ||
| 24 | - (os.path.islink(headref) and | ||
| 25 | - os.readlink(headref).startswith('refs')) | ||
| 26 | - return False | ||
| 27 | - | ||
| 28 | - | ||
| 29 | 9 | class LazyMixin(object): | |
| 30 | 10 | """ | |
| 31 | 11 | Base class providing an interface to lazily retrieve attribute values upon | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -131,14 +131,13 @@ def test_clone_with_options(self, git, repo): | |||
| 131 | 131 | { 'template': '/awesome'})) | |
| 132 | 132 | assert_true(repo.called) | |
| 133 | 133 | ||
| 134 | - @patch('git.utils.touch') | ||
| 135 | - def test_enable_daemon_serve(self, touch): | ||
| 136 | - self.repo.daemon_serve = False | ||
| 137 | - assert_false(self.repo.daemon_serve) | ||
| 138 | - | ||
| 139 | - def test_disable_daemon_serve(self): | ||
| 140 | - self.repo.daemon_serve = True | ||
| 141 | - assert_true(self.repo.daemon_serve) | ||
| 134 | + | ||
| 135 | + def test_daemon_export(self): | ||
| 136 | + orig_val = self.repo.daemon_export | ||
| 137 | + self.repo.daemon_export = not orig_val | ||
| 138 | + assert self.repo.daemon_export == ( not orig_val ) | ||
| 139 | + self.repo.daemon_export = orig_val | ||
| 140 | + assert self.repo.daemon_export == orig_val | ||
| 142 | 141 | ||
| 143 | 142 | @patch_object(os.path, 'exists') | |
| 144 | 143 | def test_alternates_no_file(self, os): | |
| Back | FazBrowse Home | New Git URL |
0 commit comments