Dump owner of repositories
authorMagnus Hagander <magnus@hagander.net>
Wed, 31 Dec 2008 15:25:23 +0000 (16:25 +0100)
committerMagnus Hagander <magnus@hagander.net>
Wed, 31 Dec 2008 15:25:23 +0000 (16:25 +0100)
gitdump.py

index 99378c6eb8ddeafb9cd9ee850273702146cd0897..164794d1904701a375539fe9d90e9b969b171c61 100644 (file)
@@ -40,9 +40,9 @@ class AuthorizedKeysDumper:
        def dumprepos(self):
                # FIXME: use a trigger to indicate if *anything at all* has changed
                curs = self.db.cursor()
-               curs.execute("SELECT name,anonymous,web FROM repositories WHERE approved ORDER BY name")
+               curs.execute("SELECT name,anonymous,web,(SELECT min(first_name) FROM repository_permissions AS rp LEFT JOIN auth_user AS au ON au.username=rp.userid WHERE rp.level=2 AND rp.repository=r.repoid) FROM repositories AS r WHERE approved ORDER BY name")
                f = open("%s.tmp" % self.conf.get("paths", "gitweblist"), "w")
-               for name, anon, web in curs:
+               for name, anon, web, owner in curs:
                        # Check if this repository exists at all
                        if not os.path.isdir("%s/repos/%s" % (self.conf.get("paths", "githome"), name)):
                                # Does not exist, let's initialize a new one
@@ -53,7 +53,7 @@ class AuthorizedKeysDumper:
 
                        # Check for publishing options here
                        if web:
-                               f.write("%s\n" % (urllib.quote_plus(name)))
+                               f.write("%s %s\n" % (urllib.quote_plus(name), urllib.quote_plus(owner)))
                        anonfile = "%s/repos/%s/git-daemon-export-ok" % (self.conf.get("paths", "githome"), name)
                        if anon:
                                if not os.path.isfile(anonfile):