Thread: [smug-devel] RSS Feeds and Diffs
Status: Alpha
Brought to you by:
amcnabb
From: Jeff A. <jef...@pr...> - 2008-10-19 01:53:40
Attachments:
signature.asc
|
So I was trying to figure out the best way to implement the diffs needed for the RSS feeds, and it looks like the anonymous commit code generates a patch with the unified diff python module. Should I implement the same thing in an RSS view, or should I move that code into gitlib? Making diffs seems like a reasonable enough thing to go into gitlib-- just thought I'd ask before duplicating or refactoring. Jeff Anderson |
From: Andrew M. <amc...@mc...> - 2008-10-20 14:19:18
|
On Sat, Oct 18, 2008 at 07:41:47PM -0600, Jeff Anderson wrote: > So I was trying to figure out the best way to implement the diffs needed > for the RSS feeds, and it looks like the anonymous commit code generates > a patch with the unified diff python module. > > Should I implement the same thing in an RSS view, or should I move that > code into gitlib? The diff module is built into Python, which means that we're reusing code that's available everywhere. With gitlib, I've generally preferred Python implementations to running a git binary since the overhead of a fork-and-exec is pretty heavy and since Python code is much more flexible. That being said, what you're talking about is slightly different than doing a diff on two pieces of content. It sounds like you're talking about finding all of the differences between two trees, which does seem like a good thing for gitlib. Maybe the best thing to do would be to add a difftrees method to Repository and a diff method to Blob. Blob's diff could compare with another Blob, and Repository's could do a treewalk and do a diff on each Blob. > Making diffs seems like a reasonable enough thing to go into gitlib-- > just thought I'd ask before duplicating or refactoring. To sum up, I think it would be a good thing to have in Gitlib but that it should use Python's diff module rather than a Git subcommand. -- Andrew McNabb http://www.mcnabbs.org/andrew/ PGP Fingerprint: 8A17 B57C 6879 1863 DE55 8012 AB4D 6098 8826 6868 |
From: Jeff A. <jef...@pr...> - 2008-10-20 20:24:47
Attachments:
signature.asc
|
Andrew McNabb wrote: > That being said, what you're talking about is slightly different than > doing a diff on two pieces of content. It sounds like you're talking > about finding all of the differences between two trees, which does seem > like a good thing for gitlib. Maybe the best thing to do would be to > add a difftrees method to Repository and a diff method to Blob. Blob's > diff could compare with another Blob, and Repository's could do a > treewalk and do a diff on each Blob. > I do see what you mean about there being a difference between diffing a single file, and diffing a tree. Would it be wrong to implement what the anonymous patch generation in gitlib? I'm not sure how the git diff command generates diffs against a working directory, but my guess is that it more or less creates blob objects, and uses the same diffing function as it does when diffing between two different git trees (commits). Maybe that's the "right" way to do things for anonymous commits? or would it be too complicated? >> Making diffs seems like a reasonable enough thing to go into gitlib-- >> just thought I'd ask before duplicating or refactoring. >> > > To sum up, I think it would be a good thing to have in Gitlib but that > it should use Python's diff module rather than a Git subcommand. > Yeah, the issue never was dropping to a git subcommand. I was more curious about the code in the anonymous commit view that calls the python unified diff library-- since that code is in the views, I didn't want to implement much of the same in a different view. I thought that a better solution might be to implement diffing in gitlib itself, rather than in a view. Jeff Anderson |
From: Andrew M. <amc...@mc...> - 2008-10-21 13:50:17
|
On Mon, Oct 20, 2008 at 02:24:00PM -0600, Jeff Anderson wrote: > > I do see what you mean about there being a difference between diffing a > single file, and diffing a tree. Would it be wrong to implement what the > anonymous patch generation in gitlib? I'm not sure how the git diff > command generates diffs against a working directory, but my guess is > that it more or less creates blob objects, and uses the same diffing > function as it does when diffing between two different git trees > (commits). Maybe that's the "right" way to do things for anonymous > commits? or would it be too complicated? When Git does a diff with the working tree, it's actually much more complicated. They use all sorts of heuristics to determine whether a file has changed without actually looking at the file. I think it would be perfectly reasonable to create a Blob object in the anonymous edit view and diff it with another Blob. > Yeah, the issue never was dropping to a git subcommand. I was more > curious about the code in the anonymous commit view that calls the > python unified diff library-- since that code is in the views, I didn't > want to implement much of the same in a different view. I thought that a > better solution might be to implement diffing in gitlib itself, rather > than in a view. Describe a bit more what the RSS feed will actually do. Will there be one RSS entry for each commit, or one entry for each file changed, or something completely different? What information will go in the feed? -- Andrew McNabb http://www.mcnabbs.org/andrew/ PGP Fingerprint: 8A17 B57C 6879 1863 DE55 8012 AB4D 6098 8826 6868 |
From: Jeff A. <jef...@pr...> - 2008-10-21 16:14:53
Attachments:
signature.asc
|
Andrew McNabb wrote: > > Describe a bit more what the RSS feed will actually do. Will there be > one RSS entry for each commit, or one entry for each file changed, or > something completely different? What information will go in the feed? > What I have in mind is one diff per commit-- much like git log -p I don't see much benefit in trying to split a particular commit into 2 or 3 entries if 2 or 3 files have been changed. If smug is being used as the frontend to a particular git repository, there will only be one commit per file anyway. Jeff Anderson |