reorganized component and repository code into separate modules
[matrix.git] / matrix / git.py
index a469ff3..73411eb 100644 (file)
@@ -243,12 +243,21 @@ def cat_file(name, hash, blob=False, size=False):
 def log(name, options, fd=None):
        return call_output(['log'] + options + ['--'], workdir=name, fd=fd)
 
-def exclude(name, line):
-       file = open(os.path.join(name, '.git', 'info', 'exclude'), 'a')
+def exclude(name, lines):
+       path = os.path.join(name, '.git', 'info', 'exclude')
+
+       if config.debug:
+               print 'Adding rules to', path
+
+       file = open(path, 'a')
        try:
-               print >>file, line
+               for line in lines:
+                       print >>file, line
        finally:
                file.close()
 
+def database_path(name):
+       return os.path.join(name, '.git')
+
 def contains_database(name):
-       return os.path.exists(os.path.join(name, '.git'))
+       return os.path.exists(database_path(name))