Skip to content

Can there be an option to generate URLs with revision numbers by default? #1736

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jamesderlin opened this issue Aug 16, 2017 · 7 comments
Closed

Comments

@jamesderlin
Copy link

I've seen a lot of people post URLs to our internal OpenGrok server via email, bug comments, commit descriptions, etc. that refer to particular lines of code. It's very convenient, but the usage is problematic because those URLs don't have long-term persistence. That is, most of the time the URLs look like:

https://opengrok/source/xref/PATH/FILE#192

which refers to line 192 of whatever the latest version of FILE that OpenGrok has indexed. If that file changes, the URL might not longer be valid. It'd be better to use URLs like:

https://opengrok/source/xref/PATH/FILE?r=186#192

to refer to a specific revision. Can there be an option to make OpenGrok search result links always explicitly specify the revision number?

@tarzanek
Copy link
Contributor

the patch for this should be very easy to write, if you have some spare time try to have a look at web dir and how we print out results, fix should be very easy, just add proper code which looks up version to print out to screen ...

@jamesderlin
Copy link
Author

I have not dived into the OpenGrok source code yet, so I wasn't sure how much work it would be. It is good to know that you think it should be easy. (Incidentally, I am disappointed that OpenGrok does not seem to have a public demo server that indexes its own code... ;) )

@vladak
Copy link
Member

vladak commented Aug 17, 2017

This should probably be only enabled if history cache is enabled - need to fetch latest revision quickly.

@tarzanek
Copy link
Contributor

the public demo versions - Trond upgrades fairly quickly after release: http://src.couchbase.org/source/

@vladak
Copy link
Member

vladak commented Aug 21, 2017

The public demo sounds like a fun task - will try to engage it in the future. It would totally make sense to automatically deploy and reindex after each push to master. Filed #1740 to track this.

@vladak
Copy link
Member

vladak commented Aug 21, 2017

This enhancement should probably apply to URLs generated for raw listings (raw.jsp) as well.

@vladak
Copy link
Member

vladak commented Aug 21, 2017

One way how to approach this would be to get the latest revision if revision is empty and redirect (temporary) to page with revision. Then check if the revision to display is the latest and if yes, just Util.dump() the xref. Otherwise go the HistoryGurugetInstance().getRevision() path. The advantage of this solution is that during directory listing (or going from search results) avoids looking up latest revision for each file which would incur additional I/O. The disadvantage is that the redirect might cause a "blip" in page display.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants