summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO1
-rw-r--r--lib/git/__init__.py2
-rw-r--r--lib/git/cmd.py3
-rw-r--r--lib/git/repo.py18
-rw-r--r--lib/git/utils.py20
-rw-r--r--test/git/test_repo.py15
6 files changed, 27 insertions, 32 deletions
diff --git a/TODO b/TODO
index 685c8646..8f5737f0 100644
--- a/TODO
+++ b/TODO
@@ -2,7 +2,6 @@
TODO
====
-
General
-------
* Classes requiring repo actually only need the git command - this should be
diff --git a/lib/git/__init__.py b/lib/git/__init__.py
index 45364b88..75ce887b 100644
--- a/lib/git/__init__.py
+++ b/lib/git/__init__.py
@@ -18,8 +18,6 @@ from git.errors import InvalidGitRepositoryError, NoSuchPathError, GitCommandErr
from git.cmd import Git
from git.repo import Repo
from git.stats import Stats
-from git.utils import dashify
-from git.utils import touch
from git.remote import Remote
diff --git a/lib/git/cmd.py b/lib/git/cmd.py
index 500fcd93..d04a2bd0 100644
--- a/lib/git/cmd.py
+++ b/lib/git/cmd.py
@@ -20,6 +20,9 @@ extra = {}
if sys.platform == 'win32':
extra = {'shell': True}
+def dashify(string):
+ return string.replace('_', '-')
+
class Git(object):
"""
The Git class manages communication with the Git binary.
diff --git a/lib/git/repo.py b/lib/git/repo.py
index 8126bff4..966edf9d 100644
--- a/lib/git/repo.py
+++ b/lib/git/repo.py
@@ -11,7 +11,6 @@ import gzip
import StringIO
from errors import InvalidGitRepositoryError, NoSuchPathError
-from utils import touch, is_git_dir
from cmd import Git
from actor import Actor
from refs import *
@@ -19,6 +18,23 @@ from objects import *
from config import GitConfigParser
from remote import Remote
+def touch(filename):
+ fp = open(filename, "w")
+ fp.close()
+
+def is_git_dir(d):
+ """ This is taken from the git setup.c:is_git_directory
+ function."""
+
+ if os.path.isdir(d) and \
+ os.path.isdir(os.path.join(d, 'objects')) and \
+ os.path.isdir(os.path.join(d, 'refs')):
+ headref = os.path.join(d, 'HEAD')
+ return os.path.isfile(headref) or \
+ (os.path.islink(headref) and
+ os.readlink(headref).startswith('refs'))
+ return False
+
class Repo(object):
"""
Represents a git repository and allows you to query references,
diff --git a/lib/git/utils.py b/lib/git/utils.py
index 3e7e8e75..2aa8d33e 100644
--- a/lib/git/utils.py
+++ b/lib/git/utils.py
@@ -6,26 +6,6 @@
import os
-def dashify(string):
- return string.replace('_', '-')
-
-def touch(filename):
- os.utime(filename)
-
-def is_git_dir(d):
- """ This is taken from the git setup.c:is_git_directory
- function."""
-
- if os.path.isdir(d) and \
- os.path.isdir(os.path.join(d, 'objects')) and \
- os.path.isdir(os.path.join(d, 'refs')):
- headref = os.path.join(d, 'HEAD')
- return os.path.isfile(headref) or \
- (os.path.islink(headref) and
- os.readlink(headref).startswith('refs'))
- return False
-
-
class LazyMixin(object):
"""
Base class providing an interface to lazily retrieve attribute values upon
diff --git a/test/git/test_repo.py b/test/git/test_repo.py
index 7ad68414..b91244c9 100644
--- a/test/git/test_repo.py
+++ b/test/git/test_repo.py
@@ -131,14 +131,13 @@ class TestRepo(TestCase):
{ 'template': '/awesome'}))
assert_true(repo.called)
- @patch('git.utils.touch')
- def test_enable_daemon_serve(self, touch):
- self.repo.daemon_serve = False
- assert_false(self.repo.daemon_serve)
-
- def test_disable_daemon_serve(self):
- self.repo.daemon_serve = True
- assert_true(self.repo.daemon_serve)
+
+ def test_daemon_export(self):
+ orig_val = self.repo.daemon_export
+ self.repo.daemon_export = not orig_val
+ assert self.repo.daemon_export == ( not orig_val )
+ self.repo.daemon_export = orig_val
+ assert self.repo.daemon_export == orig_val
@patch_object(os.path, 'exists')
def test_alternates_no_file(self, os):