rpms/trac-git-plugin/devel 0001-Add-a-dummy-get_last_modified-to-avoid-an-exceptio.patch, NONE, 1.1 0002-Add-caching-logic.patch, NONE, 1.1 0003-Add-a-quick-hack-to-prevent-code-500-errors-and-trac.patch, NONE, 1.1 0004-Fixed-directory-creation.patch, NONE, 1.1 trac-git-plugin.spec, 1.3, 1.4 trac-git-plugin-traceback.patch, 1.1, NONE
Jesse Keating (jkeating)
fedora-extras-commits at redhat.com
Sat May 17 00:33:00 UTC 2008
- Previous message (by thread): rpms/gnome-session/devel gnome-session-nautilus.patch, NONE, 1.1 gnome-session.spec, 1.164, 1.165
- Next message (by thread): rpms/trac-git-plugin/EL-5 0001-Add-a-dummy-get_last_modified-to-avoid-an-exceptio.patch, NONE, 1.1 0002-Add-caching-logic.patch, NONE, 1.1 0003-Add-a-quick-hack-to-prevent-code-500-errors-and-trac.patch, NONE, 1.1 0004-Fixed-directory-creation.patch, NONE, 1.1 .cvsignore, 1.1, 1.2 trac-git-plugin.spec, 1.3, 1.4 trac-git-plugin-traceback.patch, 1.1, NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: jkeating
Update of /cvs/pkgs/rpms/trac-git-plugin/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv30974
Modified Files:
trac-git-plugin.spec
Added Files:
0001-Add-a-dummy-get_last_modified-to-avoid-an-exceptio.patch
0002-Add-caching-logic.patch
0003-Add-a-quick-hack-to-prevent-code-500-errors-and-trac.patch
0004-Fixed-directory-creation.patch
Removed Files:
trac-git-plugin-traceback.patch
Log Message:
* Fri May 16 2008 Jesse Keating <jkeating at redhat.com> - 0.0.1-5.20070705svn1536
- Add patches from http://nanosleep.org/proj/trac-git-plugin
0001-Add-a-dummy-get_last_modified-to-avoid-an-exceptio.patch:
--- NEW FILE 0001-Add-a-dummy-get_last_modified-to-avoid-an-exceptio.patch ---
>From 1cb54953fbcf6974f3a587598db9fd7e59dcbbbe Mon Sep 17 00:00:00 2001
From: Hans Petter Jansson <hpj at cl.no>
Date: Fri, 21 Dec 2007 21:57:35 -0600
Subject: [PATCH] Add a dummy get_last_modified() to avoid an exception in Trac.
---
0.10/gitplugin/git_fs.py | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/0.10/gitplugin/git_fs.py b/0.10/gitplugin/git_fs.py
index 38563f3..fe05471 100644
--- a/0.10/gitplugin/git_fs.py
+++ b/0.10/gitplugin/git_fs.py
@@ -182,6 +182,8 @@ class GitNode(Node):
for rev in self.git.history(self.rev, p):
yield (self.path, rev, Changeset.EDIT)
+ def get_last_modified(self):
+ return None
class GitChangeset(Changeset):
def __init__(self, git, sha):
--
1.5.5.1
0002-Add-caching-logic.patch:
--- NEW FILE 0002-Add-caching-logic.patch ---
>From 3d49df03cb1d6bc68c3b6004ac63adcdeb7bda68 Mon Sep 17 00:00:00 2001
From: Hans Petter Jansson <hpj at cl.no>
Date: Fri, 21 Dec 2007 22:02:50 -0600
Subject: [PATCH] Add caching logic.
---
0.10/gitplugin/PyGIT.py | 129 ++++++++++++++++++++++++++++++++++++++--------
1 files changed, 106 insertions(+), 23 deletions(-)
diff --git a/0.10/gitplugin/PyGIT.py b/0.10/gitplugin/PyGIT.py
index eb70a2f..4896349 100644
--- a/0.10/gitplugin/PyGIT.py
+++ b/0.10/gitplugin/PyGIT.py
@@ -12,7 +12,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-import os, re
+import os, re, random, shutil
#from traceback import print_stack
class GitError(Exception):
@@ -22,41 +22,115 @@ class Storage:
def __init__(self,repo):
self.repo = repo
self.commit_encoding = None
-
- def _git_call_f(self,cmd):
- #print "GIT: "+cmd
- (input, output, error) = os.popen3('GIT_DIR="%s" %s' % (self.repo,cmd))
- return output
-
- def _git_call(self,cmd):
- return self._git_call_f(cmd).read()
+ self.cache_dir = '/var/cache/trac-git/' + self.repo.replace ('/', '__')
+
+ try:
+ os.mkdir (self.cache_dir, 0755)
+ except:
+ pass
+
+ try:
+ os.mkdir (self.cache_dir + '/short', 0755)
+ except:
+ pass
+
+ try:
+ os.mkdir (self.cache_dir + '/long', 0755)
+ except:
+ pass
+
+ current_head = self._head_uncached ()
+
+ try:
+ f = open (self.cache_dir + '/head', 'r')
+ except:
+ cached_head = "invalid"
+ else:
+ cached_head = f.read ()
+ f.close ()
+
+ if current_head != cached_head:
+ try:
+ shutil.rmtree (self.cache_dir + '/short', False)
+ except:
+ pass
+
+ try:
+ os.mkdir (self.cache_dir + '/short', 0755)
+ except:
+ pass
+
+ f = open (self.cache_dir + '/head', 'w')
+ f.write (current_head)
+ f.close ()
+
+ def _git_call_f(self,cmd,long_term_cache=False):
+ #f=open('/tmp/gitplugin.log', 'a')
+ #f.write(cmd + '\n')
+ #f.close()
+
+ # [HPJ] Add caching.
+
+ if long_term_cache is True:
+ cache_name = self.cache_dir + '/long/'
+ else:
+ cache_name = self.cache_dir + '/short/'
+
+ cache_name = cache_name + cmd.encode ('base64_codec')
+
+ if not os.path.isfile (cache_name):
+ (input, output, error) = os.popen3 ('GIT_DIR="%s" %s' % (self.repo,cmd))
+ temp_name = '/tmp/gitplugin-%s-%s' % (int (random.getrandbits (32)), os.getpid ())
+
+ try:
+ cache_file = open (temp_name, "w")
+ except:
+ return output
+
+ blob = output.read ()
+ output.close ()
+ cache_file.write (blob)
+ cache_file.close ()
+ shutil.move (temp_name, cache_name)
+
+ cache_file = open (cache_name, "r")
+ return cache_file
+
+ def _git_call(self,cmd,use_cache=False):
+ return self._git_call_f(cmd, use_cache).read()
def get_commit_encoding(self):
if self.commit_encoding is None:
- self.commit_encoding = self._git_call("git-repo-config --get i18n.commitEncoding").strip()
+ self.commit_encoding = self._git_call("git-repo-config --get i18n.commitEncoding", True).strip()
if ''==self.commit_encoding:
self.commit_encoding = 'utf-8'
return self.commit_encoding
+ def _head_uncached(self):
+ (input, output, error) = os.popen3 ('GIT_DIR="%s" git-rev-parse --verify HEAD' % (self.repo))
+ head = output.read().strip()
+ output.close()
+ return head
+
def head(self):
"get current HEAD commit id"
return self.verifyrev("HEAD")
def verifyrev(self,rev):
"verify/lookup given revision object and return a sha id or None if lookup failed"
- rc=self._git_call("git-rev-parse --verify '%s'" % rev).strip()
+ rc=self._git_call("git-rev-parse --verify '%s'" % rev, False).strip()
if len(rc)==0:
return None
return rc
def shortrev(self,rev):
"try to shorten sha id"
- return self._git_call("git-rev-parse --short '%s'" % rev).strip()
+ return self._git_call("git-rev-parse --short '%s'" % rev, False).strip()
def get_branches(self):
"returns list of branches, with active (i.e. HEAD) one being the first item"
result=[]
- for e in self._git_call_f("git-branch").readlines():
+ for e in self._git_call_f("git-branch", False).readlines():
bname=e[1:].strip()
if e[0]=='*':
result.insert(0,bname)
@@ -67,14 +141,18 @@ class Storage:
def tree_ls(self,sha,path=""):
if len(path)>0 and path[0]=='/':
path=path[1:]
- return [e[:-1].split(None, 3) for e in self._git_call_f("git-ls-tree %s '%s'" % (sha,path)).readlines()]
+ return [e[:-1].split(None, 3) for e in self._git_call_f("git-ls-tree %s '%s'" % (sha,path), False).readlines()]
def read_commit(self, sha):
- raw = self._git_call("git-cat-file commit "+sha)
+ raw = self._git_call("git-cat-file commit "+sha, True)
raw = unicode(raw, self.get_commit_encoding(), 'replace')
lines = raw.splitlines()
- line = lines.pop(0)
+ if len (lines) > 0:
+ line = lines.pop(0)
+ else:
+ line = ""
+
d = {}
while line != "":
(key,value)=line.split(None, 1)
@@ -83,36 +161,41 @@ class Storage:
d[key].append(value.strip())
line = lines.pop(0)
+ if not d.has_key("committer"):
+ d["committer"] = [ "Unknown <nobody at example.com> 1187972517 -0800" ]
+ if not d.has_key("author"):
+ d["author"] = [ "Unknown <nobody at example.com> 1187972517 -0800" ]
+
return ("\n".join(lines),d)
def get_file(self, sha):
- return self._git_call_f("git-cat-file blob "+sha)
+ return self._git_call_f("git-cat-file blob "+sha, True)
def get_obj_size(self, sha):
- return int(self._git_call("git-cat-file -s "+sha).strip())
+ return int(self._git_call("git-cat-file -s "+sha, True).strip())
def parents(self, sha):
- tmp=self._git_call("git-rev-list --max-count=1 --parents "+sha)
+ tmp=self._git_call("git-rev-list --max-count=1 --parents "+sha, False)
tmp=tmp.strip()
tmp=tmp.split()
return tmp[1:]
def children(self, sha):
- for revs in self._git_call_f("git-rev-list --parents HEAD").readlines():
+ for revs in self._git_call_f("git-rev-list --parents HEAD", False).readlines():
revs = revs.strip()
revs = revs.split()
if sha in revs[1:]:
yield revs[0]
def history(self, sha, path, skip=0):
- for rev in self._git_call_f("git-rev-list %s -- '%s'" % (sha,path)).readlines():
+ for rev in self._git_call_f("git-rev-list %s -- '%s'" % (sha,path), False).readlines():
if(skip > 0):
skip = skip - 1
continue
yield rev.strip()
def last_change(self, sha, path):
- for rev in self._git_call_f("git-rev-list --max-count=1 %s -- '%s'" % (sha,path)).readlines():
+ for rev in self._git_call_f("git-rev-list --max-count=1 %s -- '%s'" % (sha,path), False).readlines():
return rev.strip()
return None
@@ -120,7 +203,7 @@ class Storage:
if tree1 is None:
tree1 = "--root"
cmd = "git-diff-tree -r %s %s -- '%s'" % (tree1, tree2, path)
- for chg in self._git_call_f(cmd).readlines():
+ for chg in self._git_call_f(cmd, True).readlines():
if chg.startswith(tree2):
continue
(mode1,mode2,obj1,obj2,action,path) = chg[:-1].split(None, 5)
--
1.5.5.1
0003-Add-a-quick-hack-to-prevent-code-500-errors-and-trac.patch:
--- NEW FILE 0003-Add-a-quick-hack-to-prevent-code-500-errors-and-trac.patch ---
>From aed9b058ae505f50303ccade2d8a7a4dfaf0c897 Mon Sep 17 00:00:00 2001
From: Hans Petter Jansson <hpj at cl.no>
Date: Thu, 27 Dec 2007 00:05:31 -0600
Subject: [PATCH] Add a quick hack to prevent code 500 errors and tracebacks when viewing deleted files.
Instead shows an empty file, for now.
---
0.10/gitplugin/git_fs.py | 17 +++++++++++++----
1 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/0.10/gitplugin/git_fs.py b/0.10/gitplugin/git_fs.py
index fe05471..cb0166a 100644
--- a/0.10/gitplugin/git_fs.py
+++ b/0.10/gitplugin/git_fs.py
@@ -125,11 +125,20 @@ class GitNode(Node):
kind = Node.DIRECTORY
p = path.strip('/')
if p != "":
- if tree_ls_info:
- (self.perm,k,self.sha,fn)=tree_ls_info
- else:
- [(self.perm,k,self.sha,fn)]=git.tree_ls(rev, p)
+ if tree_ls_info == None or tree_ls_info == "":
+ tree_ls_info = git.tree_ls(rev, p)
+ if tree_ls_info != []:
+ [tree_ls_info] = tree_ls_info
+ else:
+ tree_ls_info = None
+
+ if tree_ls_info != None:
+ (self.perm,k,self.sha,fn) = tree_ls_info
+ else:
+ k = 'blob'
+
rev=self.git.last_change(rev, p)
+
if k=='tree':
pass
elif k=='blob':
--
1.5.5.1
0004-Fixed-directory-creation.patch:
--- NEW FILE 0004-Fixed-directory-creation.patch ---
>From 72c86153ff7cc0b2f140ae342ae3ba62d916f3fd Mon Sep 17 00:00:00 2001
From: Alex Gontmakher <gsasha at cervantes.(none)>
Date: Wed, 23 Jan 2008 02:27:36 +0200
Subject: [PATCH] Fixed directory creation
Signed-off-by: Hans Petter Jansson <hpj at kzerza.site>
---
0.10/gitplugin/PyGIT.py | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/0.10/gitplugin/PyGIT.py b/0.10/gitplugin/PyGIT.py
index 4896349..8f3ee94 100644
--- a/0.10/gitplugin/PyGIT.py
+++ b/0.10/gitplugin/PyGIT.py
@@ -25,17 +25,17 @@ class Storage:
self.cache_dir = '/var/cache/trac-git/' + self.repo.replace ('/', '__')
try:
- os.mkdir (self.cache_dir, 0755)
+ os.makedirs (self.cache_dir, 0755)
except:
pass
try:
- os.mkdir (self.cache_dir + '/short', 0755)
+ os.makedirs (self.cache_dir + '/short', 0755)
except:
pass
try:
- os.mkdir (self.cache_dir + '/long', 0755)
+ os.makedirs (self.cache_dir + '/long', 0755)
except:
pass
@@ -56,7 +56,7 @@ class Storage:
pass
try:
- os.mkdir (self.cache_dir + '/short', 0755)
+ os.makedirs (self.cache_dir + '/short', 0755)
except:
pass
--
1.5.5.1
Index: trac-git-plugin.spec
===================================================================
RCS file: /cvs/pkgs/rpms/trac-git-plugin/devel/trac-git-plugin.spec,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- trac-git-plugin.spec 26 Nov 2007 21:51:39 -0000 1.3
+++ trac-git-plugin.spec 17 May 2008 00:32:00 -0000 1.4
@@ -5,7 +5,7 @@
Name: trac-git-plugin
Version: 0.0.1
-Release: 4.20070705svn%{svnrev}%{?dist}
+Release: 5.20070705svn%{svnrev}%{?dist}
Summary: GIT version control plugin for Trac
Group: Applications/Internet
@@ -15,7 +15,15 @@
# cd gitplugin/0.10/; \
# python setup.py sdist --formats gztar
Source0: TracGit-%{version}.tar.gz
-Patch0: trac-git-plugin-traceback.patch
+# Patches from from the http://nanosleep.org/proj/trac-git-plugin git tree:
+# git clone http://nanosleep.org/git/trac-git-plugin
+# cd trac-git-plugin
+# git-format-patch 95450cae9ead85bf713e74b2ecace8c467d4107c
+Patch1: 0001-Add-a-dummy-get_last_modified-to-avoid-an-exceptio.patch
+Patch2: 0002-Add-caching-logic.patch
+Patch3: 0003-Add-a-quick-hack-to-prevent-code-500-errors-and-trac.patch
+Patch4: 0004-Fixed-directory-creation.patch
+
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
@@ -28,7 +36,10 @@
%prep
%setup -n TracGit-%{version} -q
-%patch0 -p2
+%patch1 -p2
+%patch2 -p2
+%patch3 -p2
+%patch4 -p2
%build
@@ -56,6 +67,9 @@
%changelog
+* Fri May 16 2008 Jesse Keating <jkeating at redhat.com> - 0.0.1-5.20070705svn1536
+- Add patches from http://nanosleep.org/proj/trac-git-plugin
+
* Mon Nov 26 2007 Jesse Keating <jkeating at redhat.com> - 0.0.1-4.20070705svn1536
- Add a patch to prevent tracebacks when using this plugin
--- trac-git-plugin-traceback.patch DELETED ---
- Previous message (by thread): rpms/gnome-session/devel gnome-session-nautilus.patch, NONE, 1.1 gnome-session.spec, 1.164, 1.165
- Next message (by thread): rpms/trac-git-plugin/EL-5 0001-Add-a-dummy-get_last_modified-to-avoid-an-exceptio.patch, NONE, 1.1 0002-Add-caching-logic.patch, NONE, 1.1 0003-Add-a-quick-hack-to-prevent-code-500-errors-and-trac.patch, NONE, 1.1 0004-Fixed-directory-creation.patch, NONE, 1.1 .cvsignore, 1.1, 1.2 trac-git-plugin.spec, 1.3, 1.4 trac-git-plugin-traceback.patch, 1.1, NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the fedora-extras-commits
mailing list