diff options
-rwxr-xr-x | pagehandler.py | 4 | ||||
-rw-r--r-- | patchtracker/Patch.py | 27 | ||||
-rwxr-xr-x | templates/package_vers.tmpl | 12 | ||||
-rw-r--r-- | templates/patch_view.tmpl | 2 |
4 files changed, 39 insertions, 6 deletions
diff --git a/pagehandler.py b/pagehandler.py index 0528291..7452880 100755 --- a/pagehandler.py +++ b/pagehandler.py @@ -35,6 +35,10 @@ class CmdHandler: elif patchtype == "nondebian": self.patchname = "direct (non packaging) changes" self.content = dh.nondebiandir() + elif patchtype == "misc": + patchfile = args[5] + self.patchname = "direct changes for "+patchfile + self.content = dh.filterdiff(include=patchfile) else: self.error("unhandled patch type '%s'"%(patchtype)) self.pkgname = pkgname diff --git a/patchtracker/Patch.py b/patchtracker/Patch.py index 2f604e1..4ec0594 100644 --- a/patchtracker/Patch.py +++ b/patchtracker/Patch.py @@ -3,6 +3,27 @@ import os import errno from glob import glob +class Diffstat: + def __init__(self, patch): + self.patch = patch + i,o = os.popen2("diffstat") + i.write(str(patch)) + i.close() + self.output = o.readlines() + + def stats(self): + i,o = os.popen2("diffstat -t") + i.write(str(self.patch)) + i.close() + o.readline() + return [l.split(",") for l in o.readlines()] + + def summary(self): + return self.output[-1] + + def __str__(self): + return "".join(self.output) + class Patch: def __init__(self, fh, level=1): self.p = fh.readlines() @@ -15,11 +36,7 @@ class Patch: return len(self.p) def diffstat(self): - i,o = os.popen2("diffstat") - i.write(str(self)) - i.close() - return o.read() - + return Diffstat(self) # XXX this entire __init__ stuff is way to ugly class PatchSeries (list): diff --git a/templates/package_vers.tmpl b/templates/package_vers.tmpl index e1f6350..bc393f1 100755 --- a/templates/package_vers.tmpl +++ b/templates/package_vers.tmpl @@ -76,8 +76,20 @@ debian specific patch information for $src.name / $suite <th>inserted</th> <th>deleted</th> <th>modified</th> + <th>view</th> <th>download</th> </tr> +#for $insd,$deld,$modd,$f in $diffhandler.nondebiandir.diffstat.stats + <tr> + <td>$f</td><td>$insd</td><td>$deld</td><td>$modd</td> + <td> + <a href="$u/patch/misc/view/$src.name/$src.version/$f">view</a> + </td> + <td> + <a href="$u/patch/misc/dl/$src.name/$src.version/$f">download</a> + </td> + </tr> +#end for </table> #end if diff --git a/templates/patch_view.tmpl b/templates/patch_view.tmpl index ae1e64c..380bde5 100644 --- a/templates/patch_view.tmpl +++ b/templates/patch_view.tmpl @@ -12,7 +12,7 @@ Patch information for $package / $version / $name <h2>Summary</h2> <div> <pre><code class="diffstat"> -$escape($patch.diffstat) +$escape($str($patch.diffstat)) </code></pre> </div> <div> |