#10466 closed defect (fixed)
Versioncontrol resource links
Reported by: | osimons | Owned by: | osimons |
---|---|---|---|
Priority: | normal | Milestone: | 0.12.3 |
Component: | version control | Version: | 0.12dev |
Severity: | normal | Keywords: | |
Cc: | Steffen Hoffmann, Jun Omae | Branch: | |
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
In versioncontrol resource support, the links generated by the resources are wrong for use by others. The 'source'
realm should really link to browser
and not source
. Either that, or versioncontrol web handler should know how to respond to the /source
links it generates. Either strategy is fine by me.
-
trac/versioncontrol/api.py
a b 384 384 if resource.realm == 'changeset': 385 385 return href.changeset(resource.id, resource.parent.id or None) 386 386 elif resource.realm == 'source': 387 return href. source(resource.parent.id or None, resource.id)387 return href.browser(resource.parent.id or None, resource.id) 388 388 elif resource.realm == 'repository': 389 return href. source(resource.id or None)389 return href.browser(resource.id or None) 390 390 391 391 def resource_exists(self, resource): 392 392 if resource.realm == 'repository':
Attachments (0)
Change History (14)
comment:1 by , 13 years ago
Cc: | added |
---|
comment:2 by , 13 years ago
Version: | 0.12dev → 0.13dev |
---|
comment:3 by , 13 years ago
Version: | 0.13dev → 0.12dev |
---|
Version should always point to the version where an issue/bug got introduced, so that it is correctly listed when querying for known/fixed bugs/issues for a given version.
comment:4 by , 13 years ago
And your implicit assertion, that this is broken since 0.12dev, is due to first appearance of the get_resource_url
method in trac.versioncontrol.api in r9125, right? Reasonable, I see. Learned one more thing today, thanks.
comment:6 by , 13 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Committed in [10875], and also including support for rev
that is quite essential for source URLs.
comment:7 by , 13 years ago
Well, sorry for the late participation, but I'd have preferred the other option, be consistent between the request handler and the realm (maybe we can still do that on trunk?).
comment:8 by , 13 years ago
Well, the consistency is largely an illusion even though the basic default modules like Wiki and Ticket work that way. Other resource providers outside Trac use similar constructs, and having a prominent inconsistency in Trac allows us and others not to take a 1:1 mapping for granted…
So having both 'repository'
and 'source'
link to /browser
makes sense to me. Or were you proposing that we should also handle /repository
as well as /source
URLs?
comment:9 by , 13 years ago
It's a gratuitous inconsistency, and had we been stricter about this from the start, the plugins would have followed… A 1:1 mapping is just an intuitive to have, I can't see a downside. We should indeed handle /repos as well. Not that I'm not proposing to enforce anything or to assume this equivalence in the code, just to be consistent for the sake of helping people typing either TracLinks or direct URLs.
follow-up: 12 comment:10 by , 13 years ago
Cc: | added |
---|
Just to add to this mix - this in from jomae as we had a quick interchange about merge backlog and a related issue turned up: "source
as realm in a report does not work because SOURCE_VIEW
permission which such a realm requires does not exist."
So actually, it is the expectation of 1:1:1 relationship between realm, URL and permission pattern. Which will never work unless we enforce it through API change in some future version - like GenericTrac perhaps…? ;-)
Make it match if we can, but if not then we should be fine with that too. As you say cboos, it is not like this inconsistency is a new thing.
comment:11 by , 13 years ago
I'd suggest to add full support, including versions/revisions as osimons did for the 'browser'/'source' realm, to get_resource_url
for tickets and wiki too, even if it is less common for tickets (/ticket/1?version=3) but works after all. For wiki pages it's essential, like for resources inside repositories. Will provide a patch, if you agree and osimons is not faster again.
follow-up: 13 comment:12 by , 13 years ago
Replying to osimons:
Just to add to this mix - this in from jomae as we had a quick interchange about merge backlog and a related issue turned up: "
source
as realm in a report does not work becauseSOURCE_VIEW
permission which such a realm requires does not exist."
As you well know, the <XYZ>_VIEW
permissions are a legacy from the pre-fine grained permissions days, and I always wanted to have simpler permissions actions (verbs like 'view'
) to be asked on resources. Much simpler, not redundant, so more robust. IIRC that was even in the code (at this very place in the report module) before I was "asked" to remove it…
So actually, it is the expectation of 1:1:1 relationship between realm, URL and permission pattern. Which will never work unless we enforce it through API change in some future version - like GenericTrac perhaps…? ;-)
Like many things … yes. I still hope (dream?) that at some point I'll be able to resume serious work on Trac before it gets really too late ;-)
Make it match if we can, but if not then we should be fine with that too.
Exactly.
follow-up: 14 comment:13 by , 13 years ago
Replying to cboos:
Make it match if we can, but if not then we should be fine with that too.
Exactly.
So no cause for further changes then? I'll merge it as soon as the merge backlog is cleared.
BTW, I see the report realm/permission inconsistency dates all the way back to [6245]… I suppose that change would not have been made if trac.versioncontrol
had supported resources at the time. At that time we even planned to deprecate the report module, so who knows ;-)
comment:14 by , 12 years ago
Replying to osimons:
I'll merge it as soon as the merge backlog is cleared.
FYI: It was merged at some point and is now part of trunk (according to svn merge tracking).
Minor nit-pick, but it applies to current
trunk
too, where I found it by testing.