Closed Bug 962108 Opened 12 years ago Closed 11 years ago

Permalinks to old revisions

Categories

(Webtools Graveyard :: DXR, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: kats, Assigned: new_one)

References

Details

(Whiteboard: mxr-parity)

The most annoying thing about MXR for me is that in order to get a permalink (which includes the hg rev so I can paste it into a bug and have it not become obsolete) I have to scroll to the bottom and select a revision from the drop-down box after doing my regular mxr search. This isn't too painful but if DXR had a faster way to get a permalink from a search result I would totally use DXR more. Right now I don't know if there's *any* way to get a permalink (although I think I've seen other people use them so it must be possible).
Do we keep multiple versions of the DXR database around? If not, we will have to revert back to simple syntax highlighting + no semantic search information for DXR permalinks.
OS: Mac OS X → All
Hardware: x86 → All
Whiteboard: mxr-parity
I could see ultimately extending the plugin API such that we actually keep DVCS working copies around and dynamically can pull out old revs. But first we'd need the ability to render source files at request time. (That latter pieces *is* the direction we're heading.)
For my reference: MXR appears to even do analysis on old revs of stuff. But it's rudimentary and full of errors: for example, includes (like https://mxr.mozilla.org/mozilla-central/source/ipc/chromium/src/chrome/common/ipc_channel_posix.cc?rev=9defe3666015#13 and those around it) are resolved through a set of heuristics rather than reflecting what the compiler actually did.
Making the mercurial navigation thingy (the box with links to log, blame, diff, etc.) link to the right line number of the right revision of the file would solve this problem just as well.
That's the thinking but getting the 'right revision' part is part of the challenge. There's a demo/sample version of this functionality that I wrote up but it needs a fair amount of polish before it is ready. It works with Git too though!
The hg links already have the right revision. They're just missing the line number.
Ah I understand what you're after now. Whereas I think you want a DXR link to point to the Moz HG repository viewer, the idea with permalinks is that they are contained within DXR. This way when live indexing/search happen, a permalink can point to an indexed historical revision of a code base or file. This issue is to track the latter functionality. Would you like me to make one to do the former?
When I filed this issue I only cared about getting a permalink to a specific version of code. Since MXR provides such permalinks within itself, I assumed that would be the way to go. However I don't actually care if the permalink is in DXR or on hg.m.o or somewhere else, as long as I can paste it into a bug and not have it go obsolete. If you want to morph this issue into DXR-internal permalinks then feel free, but yes I would like a separate bug to track just getting a permalink, regardless of where it is.
I'd prefer permalinks within DXR, since DXR lets me highlight a range of line numbers, which hg.m.o doesn't do. For example, this view of Webapps.js lets me highlight the convertAppsArray function: http://dxr.mozilla.org/mozilla-central/source/dom/apps/src/Webapps.js#20-25 But the closest I can get in hg.m.o is to point to a single line (in the file or annotate views): http://hg.mozilla.org/mozilla-central/file/ca042038cdee/dom/apps/src/Webapps.js#l20 http://hg.mozilla.org/mozilla-central/annotate/ca042038cdee/dom/apps/src/Webapps.js#l20 Whereas GitHub puts it all together, allowing me to link to a range of lines in a specific revision, with or without blame: https://github.com/mozilla/gecko-dev/blob/bb0a56926318a0d34e30c988fa888a6cff0cdffa/dom/apps/src/Webapps.js#L20-L25 https://github.com/mozilla/gecko-dev/blame/bb0a56926318a0d34e30c988fa888a6cff0cdffa/dom/apps/src/Webapps.js#L20-L25
We now have a PR on this, thanks to Jamon: https://github.com/mozilla/dxr/pull/275.
(In reply to Kartikaya Gupta (email:kats@mozilla.com) from comment #0) > The most annoying thing about MXR for me is that in order to get a permalink > (which includes the hg rev so I can paste it into a bug and have it not > become obsolete) I have to scroll to the bottom and select a revision from > the drop-down box after doing my regular mxr search. Also for the record I made this part of my workflow faster by adding a bookmarklet on my toolbar: javascript:window.location=window.location.protocol%20+%20"//"%20+%20window.location.host%20+%20window.location.pathname%20+%20'?rev='%20+%20document.getElementById('rev').options[0].value%20+%20window.location.hash I hope that when this bug is fixed in DXR it is even easier to get a permalink.
Summary: Killer feature for DXR: permalink → Permalinks to old revisions
Depends on: 1166397
Assignee: nobody → peter.elmers
Commit pushed to es at https://github.com/mozilla/dxr https://github.com/mozilla/dxr/commit/ea259a10d68250336a84be74ebb67081f50dd39f Permalink support. Fixes bug 962108. Closes #419. Move the logic of version control system handling from omniglot to dxr/vcs.py. The core plugin now handles permalink creation, while omniglot is responsible for links to upstream views. Switch from using the MercurialApi to using a Mercurial extension to avoid licensing issues. Also add support for running plugins' FileToSkim at request time, which changes the way refs and regions are stored in elasticsearch (hence the format bump).
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Product: Webtools → Webtools Graveyard
You need to log in before you can comment on or make changes to this bug.