packages: trac-plugin-git/trac-plugin-git.spec, trac-plugin-git/trac-git-pl...

glen glen at pld-linux.org
Thu Mar 4 14:44:03 CET 2010


Author: glen                         Date: Thu Mar  4 13:44:03 2010 GMT
Module: packages                      Tag: HEAD
---- Log message:
- add py24 patch to pld cvs; rel 1

---- Files affected:
packages/trac-plugin-git:
   trac-plugin-git.spec (1.1 -> 1.2) , trac-git-plugin-python2.4.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: packages/trac-plugin-git/trac-plugin-git.spec
diff -u packages/trac-plugin-git/trac-plugin-git.spec:1.1 packages/trac-plugin-git/trac-plugin-git.spec:1.2
--- packages/trac-plugin-git/trac-plugin-git.spec:1.1	Thu Mar  4 14:42:08 2010
+++ packages/trac-plugin-git/trac-plugin-git.spec	Thu Mar  4 14:43:58 2010
@@ -4,13 +4,13 @@
 Summary:	GIT version control plugin for Trac %{trac_ver}
 Name:		trac-plugin-git
 Version:	%{trac_ver}.0.2
-Release:	0.3
+Release:	1
 License:	GPL v2
 Group:		Applications/WWW
 # Source0Download:	http://trac-hacks.org/changeset/latest/gitplugin?old_path=/&filename=gitplugin&format=zip
 Source0:	%{plugin}.zip
 # Source0-md5:	b4d3ae110223606a46a1c7a413e8994d
-Patch0:		http://trac-hacks.org/attachment/ticket/6402/trac-git-plugin-python2.4.patch?format=raw
+Patch0:		trac-git-plugin-python2.4.patch
 URL:		http://trac-hacks.org/wiki/GitPlugin
 BuildRequires:	python-devel >= 1:2.4
 Requires:	trac >= %{trac_ver}
@@ -69,5 +69,8 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.2  2010/03/04 13:43:58  glen
+- add py24 patch to pld cvs; rel 1
+
 Revision 1.1  2010/03/04 13:42:08  glen
 - trac git plugin

================================================================
Index: packages/trac-plugin-git/trac-git-plugin-python2.4.patch
diff -u /dev/null packages/trac-plugin-git/trac-git-plugin-python2.4.patch:1.1
--- /dev/null	Thu Mar  4 14:44:04 2010
+++ packages/trac-plugin-git/trac-git-plugin-python2.4.patch	Thu Mar  4 14:43:58 2010
@@ -0,0 +1,221 @@
+from http://trac-hacks.org/ticket/6402
+http://trac-hacks.org/attachment/ticket/6402/trac-git-plugin-python2.4.patch?format=raw
+
+diff -Naur gitplugin/0.11/tracext/git/git_fs.py gitplugin-python2.4/0.11/tracext/git/git_fs.py
+--- gitplugin/0.11/tracext/git/git_fs.py	2009-08-27 22:02:06.000000000 +0200
++++ gitplugin-python2.4/0.11/tracext/git/git_fs.py	2010-01-07 16:03:52.000000000 +0100
+@@ -33,8 +33,8 @@
+ from datetime import datetime
+ import time, sys
+ 
+-if not sys.version_info[:2] >= (2,5):
+-        raise TracError("python >= 2.5 dependancy not met")
++if not sys.version_info[:2] >= (2,4):
++        raise TracError("python >= 2.4 dependancy not met")
+ 
+ import PyGIT
+ 
+@@ -359,7 +359,11 @@
+         def get_history(self, limit=None):
+                 # TODO: find a way to follow renames/copies
+                 for is_last,rev in _last_iterable(self.git.history(self.rev, self.__git_path(), limit)):
+-                        yield (self.path, rev, Changeset.EDIT if not is_last else Changeset.ADD)
++                        if is_last:
++                            chg = Changeset.ADD
++                        else:
++                            chg = Changeset.EDIT
++                        yield (self.path, rev, chg)
+ 
+         def get_last_modified(self):
+                 if not self.isfile:
+diff -Naur gitplugin/0.11/tracext/git/PyGIT.py gitplugin-python2.4/0.11/tracext/git/PyGIT.py
+--- gitplugin/0.11/tracext/git/PyGIT.py	2009-08-27 22:02:06.000000000 +0200
++++ gitplugin-python2.4/0.11/tracext/git/PyGIT.py	2010-01-07 16:26:00.000000000 +0100
+@@ -12,11 +12,9 @@
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ # GNU General Public License for more details.
+ 
+-from __future__ import with_statement
+ 
+ import os, re, sys, time, weakref
+ from collections import deque
+-from functools import partial
+ from threading import Lock
+ from subprocess import Popen, PIPE
+ import cStringIO
+@@ -24,6 +22,24 @@
+ 
+ __all__ = ["git_version", "GitError", "GitErrorSha", "Storage", "StorageFactory"]
+ 
++try:
++    all
++except NameError:
++    def all(iterable):
++        for i in iterable:
++            if not i:
++                return False
++        return True
++
++try:
++    any
++except NameError:
++    def any(iterable):
++        for i in iterable:
++            if i:
++                return True
++        return False
++
+ class GitError(Exception):
+     pass
+ 
+@@ -64,7 +80,7 @@
+         return stdout_data
+ 
+     def __getattr__(self, name):
+-        return partial(self.__execute, name.replace('_','-'))
++        return lambda *args: self.__execute(name.replace('_','-'), *args)
+ 
+     __is_sha_pat = re.compile(r'[0-9A-Fa-f]*$')
+ 
+@@ -86,7 +102,8 @@
+         self.__lock = Lock()
+ 
+     def __setitem__(self, name, value):
+-        with self.__lock:
++        self.__lock.acquire()
++        try:
+             assert len(self) == len(self.__key_fifo) # invariant
+ 
+             if not self.__contains__(name):
+@@ -101,6 +118,9 @@
+ 
+             return rc
+ 
++        finally:
++            self.__lock.release()
++
+     def setdefault(k,d=None):
+         # TODO
+         raise AttributeError("SizedDict has no setdefault() method")
+@@ -113,7 +133,8 @@
+     def __init__(self, repo, log, weak=True, git_bin='git'):
+         self.logger = log
+ 
+-        with StorageFactory.__dict_lock:
++        StorageFactory.__dict_lock.acquire()
++        try:
+             try:
+                 i = StorageFactory.__dict[repo]
+             except KeyError:
+@@ -128,6 +149,8 @@
+                         pass
+                 else:
+                     StorageFactory.__dict_nonweak[repo] = i
++        finally:
++            StorageFactory.__dict_lock.release()
+ 
+         self.__inst = i
+         self.__repo = repo
+@@ -183,7 +206,7 @@
+         self.logger = log
+ 
+         # simple sanity checking
+-        __git_file_path = partial(os.path.join, git_dir)
++        __git_file_path = lambda *args: os.path.join(git_dir, *args)
+         if not all(map(os.path.exists,
+                        map(__git_file_path,
+                            ['HEAD','objects','refs']))):
+@@ -219,7 +242,8 @@
+     # called by Storage.sync()
+     def __rev_cache_sync(self, youngest_rev=None):
+         "invalidates revision db cache if necessary"
+-        with self.__rev_cache_lock:
++        self.__rev_cache_lock.acquire()
++        try:
+             need_update = False
+             if self.__rev_cache:
+                 last_youngest_rev = self.__rev_cache[0]
+@@ -234,8 +258,12 @@
+ 
+             return need_update
+ 
++        finally:
++            self.__rev_cache_lock.release()
++
+     def get_rev_cache(self):
+-        with self.__rev_cache_lock:
++        self.__rev_cache_lock.acquire()
++        try:
+             if self.__rev_cache is None: # can be cleared by Storage.__rev_cache_sync()
+                 self.logger.debug("triggered rebuild of commit tree db for %d" % id(self))
+                 new_db = {}
+@@ -312,7 +340,10 @@
+                 new_db = tmp
+ 
+                 # convert sdb either to dict or array depending on size
+-                tmp = [()]*(max(new_sdb.keys())+1) if len(new_sdb) > 5000 else {}
++                if len(new_sdb) > 5000:
++                    tmp = [()]*(max(new_sdb.keys())+1)
++                else:
++                    tmp = {}
+ 
+                 try:
+                     while True:
+@@ -331,7 +362,10 @@
+             assert all(e is not None for e in self.__rev_cache) or not any(self.__rev_cache)
+ 
+             return self.__rev_cache
+-        # with self.__rev_cache_lock
++        # try:
++
++        finally:
++            self.__rev_cache_lock.release()
+ 
+     # tuple: youngest_rev, oldest_rev, rev_dict, tag_dict, short_rev_dict
+     rev_cache = property(get_rev_cache)
+@@ -512,7 +546,8 @@
+             self.logger.info("read_commit failed for '%s'" % commit_id)
+             raise GitErrorSha
+ 
+-        with self.__commit_msg_lock:
++        self.__commit_msg_lock.acquire()
++        try:
+             if self.__commit_msg_cache.has_key(commit_id):
+                 # cache hit
+                 result = self.__commit_msg_cache[commit_id]
+@@ -539,6 +574,9 @@
+ 
+             return result[0], dict(result[1])
+ 
++        finally:
++            self.__commit_msg_lock.release()
++
+     def get_file(self, sha):
+         return cStringIO.StringIO(self.repo.cat_file("blob", str(sha)))
+ 
+@@ -650,8 +688,11 @@
+         diff_tree_args = ["-z", "-r"]
+         if find_renames:
+             diff_tree_args.append("-M")
+-        diff_tree_args.extend([str(tree1) if tree1 else "--root",
+-                               str(tree2),
++        if tree1:
++            diff_tree_args.append(str(tree1))
++        else:
++            diff_tree_args.append("--root")
++        diff_tree_args.extend([str(tree2),
+                                "--", path])
+ 
+         lines = self.repo.diff_tree(*diff_tree_args).split('\0')
+@@ -807,7 +848,10 @@
+         rev = g.head()
+         for mode,type,sha,_size,name in g.ls_tree(rev):
+             [last_rev] = g.history(rev, name, limit=1)
+-            s = g.get_obj_size(sha) if type == "blob" else 0
++            if type == "blob":
++                s = g.get_obj_size(sha)
++            else:
++                s = 0
+             msg = g.read_commit(last_rev)
+ 
+             print "%s %s %10d [%s]" % (type, last_rev, s, name)
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/trac-plugin-git/trac-plugin-git.spec?r1=1.1&r2=1.2&f=u



More information about the pld-cvs-commit mailing list