Software integrating Trac into Twisted's Development Process

diffresource doesn't show added files

Reported by Glyph Lefkowitz on 2011-10-02
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Twisted/Trac Integration
Undecided
Unassigned

Bug Description

I realize this is probably a limitation of 'svn diff', but it would be really handy for review to get added files as '+' lines shown in the diff.

Jean-Paul Calderone (exarkun) wrote :

As far as I can tell, it does, and I didn't change anything so I think it always has. Please re-open with more details if you still think there's a problem.

Changed in twisted-trac-integration:
status: New → Invalid
Glyph Lefkowitz (glyph) wrote :

OK, after some tedious trawling of the diffresource page, I have discovered that this is a problem because it doesn't show new *empty* files, i.e. '.misc' NEWS files. Which makes sense, because there isn't much of a diff for an empty file.

Jean-Paul Calderone (exarkun) wrote :

We should fix this. It occasionally causes people to get confused about misc news fragments.

Changed in twisted-trac-integration:
status: Invalid → Confirmed
Tom Prince (tom.prince) wrote :

I wrote the following code to generate a pretty printed diff from bzr. It just currently has hard-coded branch name and dumps to stdout. I was wondering if it would make more sense to generate the diff on commit, rather than generating them on demand.

#!/usr/bin/python

from bzrlib.branch import Branch
from bzrlib.diff import show_diff_trees
from bzrlib.revisiontree import RevisionTree

import StringIO

diff = StringIO.StringIO()

b = Branch.open("http://svn.twistedmatrix.com/bzr/Twisted/branches/check-zi-version-5935")
t = Branch.open("http://svn.twistedmatrix.com/bzr/Twisted/trunk")
b.lock_read()
t.lock_read()

try:
    rev_b = b.last_revision()
    rev_t = t.last_revision()
    graph = b.repository.get_graph(t.repository)
    rev_id = graph.find_unique_lca(rev_b, rev_t)

    revtree_b = b.basis_tree()
    revtree_a = RevisionTree(b.repository, rev_id)
    revtree_a = b.repository.revision_tree(rev_id)
    show_diff_trees(revtree_a, revtree_b, diff)

finally:
    b.unlock()
    t.unlock()

from pygments import highlight
from pygments.lexers import DiffLexer as PythonLexer
from pygments.formatters import HtmlFormatter

print highlight(diff.getvalue(), PythonLexer(), HtmlFormatter(full=True))

Jean-Paul Calderone (exarkun) wrote :

Generating the diffs on demand is less resource intensive, since people mostly don't look at these and there are potentially a very large number of commits on a branch. Also, the post-commit hook already does way too much work and the bzr mirror is missing the release branches.

Tom Prince (tom.prince) wrote :

The bzr mirroring can presumably be fixed.
Any given commit is likely to never be accessed via diffresoure, but those that do are likely to be accessed multiple times (for review, for example). Also, if the diff generation is handled asynchronosly on commit, then that wont cause a delay then, but generating thme on demand will cause at perceptible delay.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers