summaryrefslogtreecommitdiff
path: root/lib/git
diff options
context:
space:
mode:
Diffstat (limited to 'lib/git')
-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
4 files changed, 20 insertions, 23 deletions
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