use Repository.dirty_files() in cache
authorTimo Savola <tsavola@movial.fi>
Sun, 6 Apr 2008 11:31:23 +0000 (14:31 +0300)
committerTimo Savola <tsavola@movial.fi>
Sun, 6 Apr 2008 11:31:23 +0000 (14:31 +0300)
matrix/cache.py
matrix/repositories.py

index df1052d..49535a7 100644 (file)
@@ -17,11 +17,11 @@ def contains(c):
                return True
 
        for repo in (c.repo, c.meta):
-               if git.ls_files(repo.path, ['-m', '-d']):
+               if repo.dirty_files():
                        if config.force:
                                return False
                        else:
-                               raise Error('Dirty files in ' + repo.path)
+                               raise Error('Dirty files in ' + repo)
 
        path = get_path(c)
        if not os.path.exists(path):
index aa405c8..aecb605 100644 (file)
@@ -18,6 +18,9 @@ class Repository(object):
                self.url = None
                self.hash = None
 
+       def __str__(self):
+               return self.path
+
        def get_commit(self):
                return self.commits.get(config.board) or self.commits.get(None)
 
@@ -50,7 +53,7 @@ class Repository(object):
                return git.contains_database(self.path)
 
        def clone(self):
-               print 'Cloning', self.path
+               print 'Cloning', self
 
                if os.path.exists(self.path):
                        self.__clone_in_place()
@@ -78,13 +81,13 @@ class Repository(object):
                        os.rmdir(tmp)
 
        def rebase(self):
-               print 'Rebasing', self.path
+               print 'Rebasing', self
 
                git.remote_update(self.path)
                git.rebase(self.path)
 
        def pull(self):
-               print 'Pulling', self.path
+               print 'Pulling', self
 
                git.pull(self.path)
 
@@ -95,7 +98,7 @@ class Repository(object):
                return git.ls_files(self.path, ['-m', '-d'])
 
        def clean(self):
-               print 'Cleaning', self.path
+               print 'Cleaning', self
 
                paths = [os.path.join(self.path,i) for i in self.other_files()]
                paths.sort()
@@ -122,14 +125,14 @@ class Repository(object):
                return git.describe(self.path)
 
        def archive(self, name, path):
-               print 'Archiving', self.path
+               print 'Archiving', self
 
                git.archive(self.path, path,
                            prefix=name + os.path.sep,
                            treeish=self.get_commit())
 
        def dump_log(self, path):
-               print 'Generating change log for', self.path
+               print 'Generating change log for', self
 
                fd = os.open(path, os.O_WRONLY | os.O_CREAT, 0644)
                try: