summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/git/cmd.py8
-rw-r--r--lib/git/repo.py16
2 files changed, 22 insertions, 2 deletions
diff --git a/lib/git/cmd.py b/lib/git/cmd.py
index 60912142..254b7dd3 100644
--- a/lib/git/cmd.py
+++ b/lib/git/cmd.py
@@ -63,8 +63,12 @@ class Git(object):
def __del__(self):
# did the process finish already so we have a return code ?
if self.proc.poll() is not None:
- return
-
+ return
+
+ # can be that nothing really exists anymore ...
+ if os is None:
+ return
+
# try to kill it
try:
os.kill(self.proc.pid, 2) # interrupt signal
diff --git a/lib/git/repo.py b/lib/git/repo.py
index 396dd129..f4caa3fb 100644
--- a/lib/git/repo.py
+++ b/lib/git/repo.py
@@ -131,6 +131,20 @@ class Repo(object):
self.working_dir = self._working_tree_dir or self.git_dir
self.git = Git(self.working_dir)
+ def __eq__(self, rhs):
+ if isinstance(rhs, Repo):
+ return self.git_dir == rhs.git_dir
+ return False
+
+ def __ne__(self, rhs):
+ return not self.__eq__(rhs)
+
+ def __hash__(self):
+ return hash(self.git_dir)
+
+ def __repr__(self):
+ return "%s(%r)" % (type(self).__name__, self.git_dir)
+
# Description property
def _get_description(self):
filename = os.path.join(self.git_dir, 'description')
@@ -145,6 +159,8 @@ class Repo(object):
del _get_description
del _set_description
+
+
@property
def working_tree_dir(self):
"""