[projects/git-slug: 33/170] Pass gitrepo object to queue of ThreadFetch

glen glen at pld-linux.org
Mon Sep 21 21:41:35 CEST 2015


commit 55c9240abea83c0cabfdbedffd4d717ca58f583d
Author: Kacper Kornet <draenog at pld-linux.org>
Date:   Tue Sep 20 22:28:33 2011 +0100

    Pass gitrepo object to queue of ThreadFetch
    
    The double initialization of gitrepo object is avoided.

 slug.py | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
---
diff --git a/slug.py b/slug.py
index 8289120..0ac1d55 100755
--- a/slug.py
+++ b/slug.py
@@ -38,10 +38,9 @@ class ThreadFetch(threading.Thread):
 
     def run(self):
         while True:
-            (package, ref2fetch) = self.queue.get()
-            gitrepo = GitRepo(os.path.join(self.packagesdir, package))
+            (gitrepo, ref2fetch) = self.queue.get()
             (stdout, stderr) = gitrepo.fetch(ref2fetch, self.depth)
-            print('------', package, '------\n' + stderr.decode('utf-8'))
+            print('------', gitrepo.gdir[:-len('.git')], '------\n' + stderr.decode('utf-8'))
             self.queue.task_done()
 
 def readconfig(path):
@@ -118,7 +117,7 @@ def fetch_packages(options):
             if gitrepo.check_remote(ref) != refs.heads[dir][ref]:
                 ref2fetch.append('+{}:{}/{}'.format(ref, REMOTEREFS, ref[len('refs/heads/'):]))
         if ref2fetch:
-            fetch_queue.put((dir, ref2fetch))
+            fetch_queue.put((gitrepo, ref2fetch))
 
     fetch_queue.join()
 
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/projects/git-slug.git/commitdiff/4ed64f73960519a2f4fd04c42950b2c96ae795c5



More information about the pld-cvs-commit mailing list