#11777 closed defect (fixed)
Raw revision of cached git repository in search view
Reported by: | Jun Omae | Owned by: | Jun Omae |
---|---|---|---|
Priority: | normal | Milestone: | 1.0.3 |
Component: | version control | Version: | 0.12-stable |
Severity: | normal | Keywords: | search |
Cc: | Branch: | ||
Release Notes: |
The search results page displays shortened revision ids and only unique changesets. |
||
API Changes: | |||
Internal Changes: |
Description (last modified by )
If searching changesets in cached git repository, the revisions are displayed with no changes. The issue doesn't occur if mercurial because search system requires revision
table and mercurial connector doesn't support cache.
Both 0.12.x with th:GitPlugin and 1.0.x have this issue.
We should show shortened revisions in search view.
Patch for 1.0-stable:
-
trac/versioncontrol/web_ui/changeset.py
diff --git a/trac/versioncontrol/web_ui/changeset.py b/trac/versioncontrol/web_ui/changeset.py index 097fe81..3225e4f 100644
a b class ChangesetModule(Component): 1128 1128 SELECT repos, rev, time, author, message 1129 1129 FROM revision WHERE """ + sql, 1130 1130 args): 1131 try:1132 rev = int(rev)1133 except ValueError:1134 pass1135 1131 repos = repositories.get(id) 1136 1132 if not repos: 1137 1133 continue # revisions for a no longer active repository 1138 1134 cset = repos.resource.child('changeset', rev) 1139 1135 if 'CHANGESET_VIEW' in req.perm(cset): 1136 try: 1137 drev = repos.display_rev(rev) 1138 except NoSuchChangeset: 1139 continue 1140 1140 yield (req.href.changeset(rev, repos.reponame or None), 1141 '[%s]: %s' % ( rev, shorten_line(log)),1141 '[%s]: %s' % (drev, shorten_line(log)), 1142 1142 from_utimestamp(ts), author, 1143 1143 shorten_result(log, terms)) 1144 1144
Attachments (3)
Change History (12)
by , 10 years ago
Attachment: | search-changeset-raw-rev.png added |
---|
by , 10 years ago
Attachment: | search-changeset-display-rev.png added |
---|
comment:1 by , 10 years ago
Description: | modified (diff) |
---|---|
Owner: | set to |
Status: | new → assigned |
comment:2 by , 10 years ago
comment:3 by , 10 years ago
Looks good.
OT: I didn't know until hunting around in the code that Repository.display_rev
can raise an NoSuchChangeset
exception. Would it be useful to start adding to method documentation the exception types that can be raised?
by , 10 years ago
Attachment: | 20141211T033118.png added |
---|
comment:4 by , 10 years ago
Indeed. Repository.display_rev()
, normalize_rev()
and short_rev()
can raise a NoSuchChangeset
exception because the methods normally checks existence of the given rev
. In [fe9dc5d9b/jomae.git], added documentation to these methods.
I noticed that the same changeset are shown more than once if multiple repositories have the changeset. We could check whether the changesets are same using Repository.get_changeset_uid()
. The method is used in ChangesetModule.get_timeline_events()
as well.
After [54fad5d8/jomae.git], changesets would show only once in search view.
follow-up: 6 comment:5 by , 10 years ago
We could use the Sphinx markup since that's what used to generate ApiDocs:
""" :raises NoSuchChangeset: if the given `rev` isn't found """
Removing duplicate changesets from search is probably a good idea.
comment:6 by , 10 years ago
We could use the Sphinx markup since that's what used to generate ApiDocs:
""" :raises NoSuchChangeset: if the given `rev` isn't found """
Thanks. I couldn't find existing apidoc for exceptions. I just find at tags/trac-1.0.2/trac/db/util.py@:156-157#L151. I'll push the changes with your suggestions.
comment:7 by , 10 years ago
Milestone: | 0.12.7 → 1.0.3 |
---|
comment:8 by , 10 years ago
Release Notes: | modified (diff) |
---|---|
Resolution: | → fixed |
Status: | assigned → closed |
Committed in [13482,13484-13485] and merged to trunk in [13483,13486].
comment:9 by , 10 years ago
Release Notes: | modified (diff) |
---|
Proposed changes in [00f2202d1/jomae.git] (jomae.git@t11777).