trac-hacks / trac-code-comments-plugin Goto Github PK
View Code? Open in Web Editor NEWTrac plugin for code comments and sending them to tickets
License: GNU General Public License v2.0
Trac plugin for code comments and sending them to tickets
License: GNU General Public License v2.0
The timestamps shown for each comment should be in the timezone the current user has selected in the preferences, as are all other timestamps in Trac. However, timestamps for comments at the moment are always shown as UTC (or the timezone the server running Trac is configured for?).
With both 1.1.1 and the current master, I get the following exception on a git repository, while for svn it works fine:
2014-04-02 10:05:46,511 Trac[main] ERROR: Internal Server Error:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/trac/web/main.py", line 497, in _dispatch_request
dispatcher.dispatch(req)
File "/usr/lib/python2.7/dist-packages/trac/web/main.py", line 214, in dispatch
resp = chosen_handler.process_request(req)
File "/var/lib/trac/plugins/TracCodeComments-1.1.1-py2.7.egg/code_comments/web.py", line 277, in process_request
self.return_json(req, Comments(req, self.env).search(req.args))
File "/var/lib/trac/plugins/TracCodeComments-1.1.1-py2.7.egg/code_comments/comments.py", line 75, in search
return self.select('SELECT * FROM code_comments ' + where + ' ORDER BY ' + order_by + ' ' + order + limit, values)
File "/var/lib/trac/plugins/TracCodeComments-1.1.1-py2.7.egg/code_comments/comments.py", line 32, in select
@self.env.with_transaction()
File "/usr/lib/python2.7/dist-packages/trac/db/api.py", line 97, in transaction_wrapper
fn(ldb)
File "/var/lib/trac/plugins/TracCodeComments-1.1.1-py2.7.egg/code_comments/comments.py", line 35, in get_comments
cursor.execute(*query)
File "/usr/lib/python2.7/dist-packages/trac/db/util.py", line 65, in execute
return self.cursor.execute(sql_escape_percent(sql), args)
DataError: invalid input syntax for integer: "HEAD"
LINE 1: ...ts WHERE path = '/' AND line = '0' AND revision = 'HEAD' ORD...
^
DataError: invalid input syntax for integer: "HEAD"
LINE 1: ...ts WHERE path = '/' AND line = '0' AND revision = 'HEAD' ORD...
Now that there's pagination on the code comments table, it would be nice to have a URL query argument to change the number of results listed (with "all" as an option)
Use case: I leave some comments, then somebody replies, but I have no idea that it happened.
It would be great if I can subscribe for comments on certain lines, files, directories, or projects.
Hi,
I'm an administrator for trac-hacks.org. We've created an organization on GitHub and are inviting authors of trac-hacks plugins to join the organization. Your repository could be transferred into the organization as described in the GitHub docs. You'd retain full control over the repository, but the hope is that it will be easier for users on GitHub to fine trac-hacks plugins, including yours, by viewing the trac-hacks organization.
In the future, if you choose to no longer maintain the plugin, the organization would be able to provide commit access to new developers. This would only be done with your permission, as has been the policy for plugins hosted on trac-hacks.org. If you've already decided to no longer maintain the plugin, we would particularly appreciate you transferring the plugin to the trac-hacks organization so that we can help find new maintainers for it.
Finally, creating the trac-hacks organization is a work in progress. I appreciate if you have any suggestions on how to best support the community of trac plugin developers on GitHub. I'll be writing a blog post soon with more information and will follow-up here with a link to that post.
Kind regards,
When master is installed on server witch multiple Trac environments, plugin tries to access URL:
https://trac.example.com/subscription/trac/project/browser
Trac project is on URL:
https://trac.example.com/trac/project/
so it will never hit Trac environment.
The same will happen with one Trac environment not installed on domain root. For example when Subversion and Trac work on the same server/domain this plugin will be unusable.
Your readme says to get the appropriate egg from the Downloads page. However, GitHub downloads are deprecated, and you haven't updated yours is two years. What's the best way to add this to my trac installation with a minimum of fuss?
It has a lot of jQuery callback spaghetti creeping in.
If I attach a file named: 抽獎系統工時預估.xlsx
I got this error:
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\trac\web\main.py", line 551, in _dispatch_request
dispatcher.dispatch(req)
File "C:\Python27\lib\site-packages\trac\web\main.py", line 244, in dispatch
resp = chosen_handler.process_request(req)
File "C:\Python27\lib\site-packages\trac\attachment.py", line 529, in process_request
data = self._do_save(req, attachment)
File "C:\Python27\lib\site-packages\trac\attachment.py", line 782, in _do_save
attachment.insert(filename, upload.file, size)
File "C:\Python27\lib\site-packages\trac\attachment.py", line 345, in insert
listener.attachment_added(self)
File "build\bdist.win-amd64\egg\code_comments\subscription.py", line 413, in attachment_added
Subscription.from_attachment(self.env, attachment)
File "build\bdist.win-amd64\egg\code_comments\subscription.py", line 198, in from_attachment
attachment.filename)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-7: ordinal not in range(128)
Hello,
First Congrats for you work with this plugin for trac :) very thanks.
The icon with class ''expander'' not work in my tree view of Browse Source. (this is an ajax button)
The requested URL /code-comments/comments was not found on this server.
The plugin tries to open http://server/code-comments/comments 2 times, but this is not valid (browse source). It is not possible to create and save a comment because of this problem.
The existing macro only handles links to comments.
It would be beneficial if the macro could actually render the comments, for e.g. bringing an attachment's comments into the ticket.
Inline code comments should ideally display some context of the code it is replying to, even if it just one line. Clicking it should either expand that context or open up the attachment to that context.
I'm doing some basic testing, and apparently you're not allowing for revision ids with more than 3 characters (actually, just saw that you're using int as a revision type in the database - that won't work at all).
There might be more issues, but I've hit upon that one right away.
Removing the "int" specifier from the revision field in db.py appears to fix that across the board, in the sense that I now get a listing of the comments I made.
They still don't display, though, but I think the reason for that is #14.
Hi, just installed the plugin into Trac 1.0.1., and the comments I add doesn't show. They are visible on Code comments tab, but not at all in the browser or changeset.
In the console is this error:
Uncaught ReferenceError: id is not defined VM2628:3
with trace pointing on the code-comments.js
(anonymous function) VM2628:3
(anonymous function) underscore-min.js:29
window.CommentView.Backbone.View.extend.render code-comments.js:48
window.CommentView.Backbone.View.extend.appendTo code-comments.js:56
window.CommentsForALineView.Backbone.View.extend.addOne code-comments.js:148
window.LineCommentsView.Backbone.View.extend.addOne code-comments.js:118
(anonymous function) code-comments.js:123
b.each.b.forEach underscore-min.js:11
e.Collection.(anonymous function) backbone-min.js:28
window.LineCommentsView.Backbone.View.extend.addAll code-comments.js:122
e.Events.trigger backbone-min.js:14
f.extend.reset backbone-min.js:24
a.success backbone-min.js:24
f.resolveWith jquery-1.5.min.js:16
w jquery-1.5.min.js:16
c jquery-1.5.min.js:16
If a new comment is written to line, the dialog doesn't close on submit, and the only thing that appears by the line is a reply button and the same error in console.
Is it just some incompatibility of versions (jquery, backbone, or trac in general)?
Is it possible to limit making comments to specific Trac users? Or at least block anonymous comments?
When changing the number of lines shown in a diff the code comments fail to work correctly unless they are viewed at the same line.
TRAC_ADMIN
privileges are required to perform this operation. You don't have the required permissions.
I think that TICKET_CREATE
and/or TICKET_VIEW
should be enought to see code comments list... Or even better - additional permission type: CODE_COMMENTS_LIST
I'm particularly interested in the in-line comments on changesets, which has now landed in master.
When do you think there will be an "official" release including #32?
The last official release is from 2012!
Got a UnicodeEncodeError at line 66 of comments.html. Had to change it a bit:
<th>${comment.formatted_date().decode('utf-8')}</th>
Now it works fine.
The file code_comments/templates/code_comment_notify_email.txt
is not present in the .egg
file created with bdist_egg
. This leads to a failure when notification emails are sent.
Trac 1.0 is coming out soon (beta1 is out) and we need to stay above the water.
Currently we have defaults for sorting field and sorting direction both in the ListComments
route and in the Comments
model.
We should choose one place for them, because now it's confusing which values take precedence. Since we want to have default values when querying comments, it makes more sense for these defaults to live in Comments
.
This plugin doesn't work in latest Trac 1.4.1
2020-03-09 10:16:56,094 Trac[web_ui] INFO: Installing plugin TracCodeComments-1.1.0-py2.7.egg
2020-03-09 10:16:56,095 Trac[web_ui] INFO: Plugin TracCodeComments-1.1.0-py2.7.egg installed to /home/TRAC/plugins/TracCodeComments-1.1.0-py2.7.egg
2020-03-09 10:16:56,337 Trac[env] INFO: Reloading environment due to configuration change
2020-03-09 10:16:56,364 Trac[env] INFO: -------------------------------- environment startup [Trac 1.4.1] --------------------------------
2020-03-09 10:16:56,467 Trac[loader] ERROR: Skipping "ckintegration = ckintegration": ImportError: cannot import name Context
2020-03-09 10:16:56,470 Trac[loader] ERROR: Skipping "code_comments = code_comments": ImportError: cannot import name Context
2020-03-09 10:16:56,758 Trac[chrome] WARNING: Component TotalHoursFilter relies on deprecated Genshi stream filtering
When I add comment to source code, I got wrong comment url in notify email.
The correct url is " https://code.nuwainfo.com/trac/project/changeset/10?codecomment=12 ",
but I got this " https://code.nuwainfo.com/trac/project/trac/project/changeset/10?codecomment=12 ".
So I have built the egg from source and included it in the trac plugins folder.
When I load a changeset I get the following errors in the Chrome console log (as well as an alert to tell me to look there):
GET https://trac12-dmz.lshift.net/test/trac/code-comments/comments?line=0&revision=79f06da7332fe7837dc10e7b894b416e3960d0b4&type=changeset 500 (Internal Server Error) jquery-1.11.1.min.js:4
File "/usr/local/share/trac-testing-virtualenv/lib/python2.6/site-packages/Trac-1.0.1-py2.6.egg/trac/web/main.py", line 497, in _dispatch_request
dispatcher.dispatch(req)
File "/usr/local/share/trac-testing-virtualenv/lib/python2.6/site-packages/Trac-1.0.1-py2.6.egg/trac/web/main.py", line 214, in dispatch
resp = chosen_handler.process_request(req)
File "build/bdist.win-amd64/egg/code_comments/web.py", line 276, in process_request
self.return_json(req, Comments(req, self.env).search(req.args))
File "build/bdist.win-amd64/egg/code_comments/comments.py", line 76, in search
return self.select('SELECT * FROM code_comments ' + where + ' ORDER BY ' + order_by + ' ' + order + limit, values)
File "build/bdist.win-amd64/egg/code_comments/comments.py", line 33, in select
@self.env.with_transaction()
File "/usr/local/share/trac-testing-virtualenv/lib/python2.6/site-packages/Trac-1.0.1-py2.6.egg/trac/db/api.py", line 97, in transaction_wrapper
fn(ldb)
File "build/bdist.win-amd64/egg/code_comments/comments.py", line 36, in get_comments
cursor.execute(*query)
File "/usr/local/share/trac-testing-virtualenv/lib/python2.6/site-packages/Trac-1.0.1-py2.6.egg/trac/db/util.py", line 65, in execute
return self.cursor.execute(sql_escape_percent(sql), args)
code-comments.js:14
GET https://trac12-dmz.lshift.net/test/trac/code-comments/comments?line__gt=0&revision=79f06da7332fe7837dc10e7b894b416e3960d0b4&type=changeset 500 (Internal Server Error) jquery-1.11.1.min.js:4
File "/usr/local/share/trac-testing-virtualenv/lib/python2.6/site-packages/Trac-1.0.1-py2.6.egg/trac/web/main.py", line 497, in _dispatch_request
dispatcher.dispatch(req)
File "/usr/local/share/trac-testing-virtualenv/lib/python2.6/site-packages/Trac-1.0.1-py2.6.egg/trac/web/main.py", line 214, in dispatch
resp = chosen_handler.process_request(req)
File "build/bdist.win-amd64/egg/code_comments/web.py", line 276, in process_request
self.return_json(req, Comments(req, self.env).search(req.args))
File "build/bdist.win-amd64/egg/code_comments/comments.py", line 76, in search
return self.select('SELECT * FROM code_comments ' + where + ' ORDER BY ' + order_by + ' ' + order + limit, values)
File "build/bdist.win-amd64/egg/code_comments/comments.py", line 33, in select
@self.env.with_transaction()
File "/usr/local/share/trac-testing-virtualenv/lib/python2.6/site-packages/Trac-1.0.1-py2.6.egg/trac/db/api.py", line 97, in transaction_wrapper
fn(ldb)
File "build/bdist.win-amd64/egg/code_comments/comments.py", line 36, in get_comments
cursor.execute(*query)
File "/usr/local/share/trac-testing-virtualenv/lib/python2.6/site-packages/Trac-1.0.1-py2.6.egg/trac/db/util.py", line 65, in execute
return self.cursor.execute(sql_escape_percent(sql), args)
It look to me like the database tables don't exist. What do I need to do to get them into the database?
I did:
I saw:
I expected:
Hi there,
Sometimes we get the following error when trying to browse the comments added to a Trac env:
No handler matched request to /code-comments
When this happens the "Code Comments" tab in the navigation is also not visible.
Version: 1.1.0 (Trac: 0.12.3)
In a revision diff page, with a customised 'from' and 'to' revisions (as we normally batch review a range of changesets), I could still make comments there. However, there are two problems:
the link in the comments page does not get me back to the diff page, instead, it bring me to the latest changeset regarding to the 'to' revision.
the comments in the page have wrong positions.
It seems to be related with the following code in web.py
def changeset_js_data(self, req, data):
return {
'page': 'changeset',
'revision': data['new_rev'],
'path': data['reponame'],
'selectorToInsertAfter': 'div.diff div.diff:last'
}
Apparently, only the reponame, and last revision is stored, instead of the actual diff. I wonder if it would be possible if the full browser URL is stored inside the 'path' column instead?
In the last line of htdocs/code-comments/code-comments.js
, there is jQuery.noConflict( true )
. And according to the documentation, this actually wipes out all globally existing jQuery
variables, which was loaded in the trac core. This causes immediate problems with other jQuery dependent plugins like trac-readme-plugin.
Simply change to }); }( jQuery.noConflict( ) ) );
seems to fix the problem.
I've been testing this a bit further and realized that there's also no support for multiple repos (even though I get the "Code Comments" top level menu, and a comment listing, source browser links are not generated with the repo name in them).
I'm still trying to pin this down, since it may well be the reason why I can't see any comments (all the Trac instances I'm running have multiple repos).
While there is a comment button at the top of a changeset when clicked it says the comment is for only one of the revisions. There is no inline commenting on the changesets.
Inline and normal comments getting submitted , but not getting displayed on code/change set.
Only way to view comment is by client 'comment' tab, which is useless for me.
Have to rollback because this reason.
Trac Installation type : multiple projects
Thanks
The value of'selectorToInsertBefore': 'table#info'
in browser_js_data
prevents comments being added to directories.
Using table#dirlist
works, but (obviously) breaks top-level comments for files.
If i click on Code Comments within the main menu, my browser tries to open https://myserver/my/trac/code-comments/preview which is always empty. I think it should open a list of comments or something like that?
Hi - I'm packaging this for Fedora and EPEL, (see the review request here).
I've been asked as a minor/non-blocker issue, to see if you would mind putting a LICENSE file in the repo. Would you consider it? ;-)
Thanks.
I can add the comment successfully but not able to view it, using mysql database. But no issue with sqlite.
I am getting the following errors while viewing a file.
Error: ReferenceError: id is not defined
Source File: *********/chrome/code-comments/underscore-min.js
Line: 29
Timestamp: 09/25/2012 01:05:42 PM
Error: TypeError: $("a", $th).attr("href") is undefined
Source File: *****/chrome/code-comments/code-comments.js
Line: 185
Trac 1.0
TracCodeComments 1.1.0 for Python 2.7
issue exists with "master" branch too.
Hello,
It always popup error dialog: "Not Found: Environment not found".
and comments's URL is not correct miss root path( such as, URL should be is "/project_1/file_c", but miss "/project_1/"
Thanks!
This would allow developers without TRAC_ADMIN permissions to see comment activity in a central location and perhaps delete permissions on their own comments.
I could not determine if the current code base has this capability, please correct me if I am wrong.
thanks.
When I go to the /code-comments view, I'm always looking for my own comments that I just posted. I think it would be better if the comments in the main list were filtered for the current user and sorted reverse chronologically to start.
It would be useful to append comments to an existing ticket. Most of the time we have a ticket like: fix something. Now we implement the code changes and they needs to be reviewed. But it is not useful to create a new ticket and add a reference to the new ticket. It would be nice to have the possibility to add only a ticket comment with the code comments.
My Trac instance is hosted at http://server/trac/project and I have specified this value as base_url in trac.ini.
When creating a comment (for a line of a file), the notification email contains the link http://server/trac/project/trac/project/browser/trunk/... (duplicate path prefix).
I did:
I saw:
I expected:
Comments can occur on changesets, attachments, and files. They can also be inline, or made against the page generally. There should be some trac.ini configuration options to turn each of these six possibilities off.
For example, on core.trac, we would only like inline comments against attachments. We don't want general comments as those belong on the ticket. But we would probably want both inline and regular comments on commits if we enabled them there (which we won't do at first), and we wouldn't want comments on files at all.
getting a db error:
2012-02-25 16:05:05,987 Trac[main] ERROR: Internal Server Error:
Traceback (most recent call last):
File "build/bdist.linux-i686/egg/trac/web/main.py", line 511, in _dispatch_request
dispatcher.dispatch(req)
File "build/bdist.linux-i686/egg/trac/web/main.py", line 237, in dispatch
resp = chosen_handler.process_request(req)
File "build/bdist.linux-i686/egg/code_comments/web.py", line 222, in process_request
id = comments.create(json.loads(req.read()))
File "build/bdist.linux-i686/egg/code_comments/comments.py", line 87, in create
@self.env.with_transaction()
File "build/bdist.linux-i686/egg/trac/db/api.py", line 77, in transaction_wrapper
fn(ldb)
File "build/bdist.linux-i686/egg/code_comments/comments.py", line 91, in insert_comment
cursor.execute(sql, values)
File "build/bdist.linux-i686/egg/trac/db/util.py", line 65, in execute
return self.cursor.execute(sql_escape_percent(sql), args)
IntegrityError: null value in column "id" violates not-null constraint
fresh install on 12.2 with postgres
Users need to be able to sort the code comments by any of the fields, except Tickets and Actions.
The headers of the columns should be links. By default they are sorted by ID, descending.
The action when we click on a column, depends on the state:
There should be an icon, denoting which is the current sort column, and what is the direction.
There are few newer versions already.
Problem: when I post comments to the latest version of a single file and then I send the link to somebody, the link doesn't include the file revision. That's why often when the person comes and click on the link they don't see any comments – there were commits in between and the latest version of the file isn't the one with the comments.
I am not sure what the solution should be here.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.