Opened 13 years ago
Closed 10 years ago
#10527 closed enhancement (fixed)
Mercurial bookmarks as properties in browser
Reported by: | Peter Suter | Owned by: | Peter Suter |
---|---|---|---|
Priority: | normal | Milestone: | plugin - mercurial |
Component: | plugin/mercurial | Version: | 0.13dev |
Severity: | normal | Keywords: | bookmarks |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
It would be nice if the TracMercurial plugin would show bookmarks as properties on TracChangeset pages.
This seems quite simple:
-
backend.py
174 174 175 175 def match_property(self, name, mode): 176 176 return (name.startswith('hg-') and 177 name[3:] in ('Parents', 'Children', 'Tags', 'Branch') and 177 name[3:] in ('Parents', 'Children', 'Tags', 'Branch', 178 'Bookmarks') and 178 179 mode == 'revprop') and 4 or 0 179 180 180 181 def render_property(self, name, mode, context, props): … … 1189 1190 tags = self.get_tags() 1190 1191 if len(tags): 1191 1192 properties['hg-Tags'] = (self.repos, tags) 1193 bookmarks = self.ctx.bookmarks() 1194 if len(bookmarks): 1195 properties['hg-Bookmarks'] = (self.repos, bookmarks) 1192 1196 for k, v in self.ctx.extra().iteritems(): 1193 1197 if k != 'branch': 1194 1198 properties['hg-' + k] = (self.repos, v)
Unfortunately there is a catch: Changeset pages are cached, but modifying a bookmark currently does not invalidate that cache.
Attachments (2)
Change History (12)
comment:1 by , 13 years ago
Keywords: | bookmarks added |
---|---|
Version: | → 0.13dev |
comment:2 by , 12 years ago
need to catch lack of bookmarks (if extension not configured in HG). Suggest something like
try: bookmarks = self.ctx.bookmarks() except AttributeError: bookmarks = []
… I don't have bookmarks enabled, so I can't say if this is good otherwise.
comment:3 by , 12 years ago
Oops, didn't see (or paid attention to) the above comment, and now we have #10908 :-(
follow-up: 5 comment:4 by , 12 years ago
Should bookmarks appear under the dropdown for branches and tags, it doesn't for me and following the code does not seem to point that it would.
Since bookmarks are lightweight branches it would be nice if this is possible.
comment:5 by , 10 years ago
Replying to pykler@…:
Should bookmarks appear under the dropdown for branches and tags, it doesn't for me and following the code does not seem to point that it would.
Looks like changeset:d1913701fd5b/mercurial-plugin implemented this.
I would love to also see the bookmarks in the TracRevisionLog, similar to branch heads and tags.
by , 10 years ago
Attachment: | T10527-trac-bookmarks-API.diff added |
---|
by , 10 years ago
Attachment: | T10527-mercurial-plugin-bookmarks-API.diff added |
---|
follow-up: 8 comment:6 by , 10 years ago
The first patch for Trac itself adds a new API method Changeset.get_bookmarks()
and uses it to show bookmarks as blue labels on the revision log, browser pages and timeline (just like Changeset.get_tags()
).
The second patch for the mercurial-plugin simply implements that API.
Should I open a new ticket for the first patch targeting Trac 1.1.5?
comment:7 by , 10 years ago
Owner: | set to |
---|---|
Status: | new → assigned |
comment:8 by , 10 years ago
comment:10 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Committed in changeset:779abf179cee/mercurial-plugin.
Replying to psuter:
As properties, and also in the TracBrowser view, same as we do for tags and branches (in blue?).
What about adding all the properties in the mix?
In the meantime, I already added the above in [f261cc084df2/mercurial-plugin].