Discussion:
gerrit support question: how to show raw file content after the commit in the browser, not as zip download
Thomas Gries
2012-12-11 09:42:40 UTC
Permalink
While tracking an iusse I came to
https://gerrit.wikimedia.org/r/#/c/7986/ (example case)
In the list of files I clicked on
https://gerrit.wikimedia.org/r/#/c/7986/14/includes/UserMailer.php

Now I am "desperately seeking" a link to _show the raw file content
after the commit in the __browser__,__
_but only found a link "(Download)" which starts a zip download. This is
not what I wanted.

Is there a solution which I have overlooked?
Tom
Antoine Musso
2012-12-11 10:03:36 UTC
Permalink
Post by Thomas Gries
While tracking an iusse I came to
https://gerrit.wikimedia.org/r/#/c/7986/ (example case)
In the list of files I clicked on
https://gerrit.wikimedia.org/r/#/c/7986/14/includes/UserMailer.php
Now I am "desperately seeking" a link to _show the raw file content
after the commit in the __browser__,__
_but only found a link "(Download)" which starts a zip download. This is
not what I wanted.
Is there a solution which I have overlooked?
You can get the patch locally using:
- the checkout / patch links under each patchset.
- git-review if you want to look at last patchset

Another way is to use Gitweb. When looking at the Gerrit change on
https://gerrit.wikimedia.org/r/#/c/7986/ , you will find next to each
patchset entry a "gitweb" link. That points to a page showing the
commit metadata and the list of files changed with 4 links diff, blob,
blame and history. Blob is what you are looking for :)
--
Antoine "hashar" Musso
Niklas Laxström
2012-12-11 17:25:36 UTC
Permalink
Post by Thomas Gries
While tracking an iusse I came to
https://gerrit.wikimedia.org/r/#/c/7986/ (example case)
In the list of files I clicked on
https://gerrit.wikimedia.org/r/#/c/7986/14/includes/UserMailer.php
Now I am "desperately seeking" a link to _show the raw file content
after the commit in the __browser__,__
_but only found a link "(Download)" which starts a zip download. This is
not what I wanted.
Is there a solution which I have overlooked?
If you just want to view the content, in diff view click Preferences,
on the left bottom choose Whole File as context and click Update. It
is no good for copy-pasting though.

-Niklas


--
Niklas Laxström
Ryan Kaldari
2012-12-11 18:47:42 UTC
Permalink
This is actually my biggest annoyance with gerrit—that I can't view raw
code from the change view. I can't fathom why they have a zip download
link, but not a view link. Then I could copy code without copying all
the line numbers.

Ryan Kaldari
Post by Niklas Laxström
Post by Thomas Gries
While tracking an iusse I came to
https://gerrit.wikimedia.org/r/#/c/7986/ (example case)
In the list of files I clicked on
https://gerrit.wikimedia.org/r/#/c/7986/14/includes/UserMailer.php
Now I am "desperately seeking" a link to _show the raw file content
after the commit in the __browser__,__
_but only found a link "(Download)" which starts a zip download. This is
not what I wanted.
Is there a solution which I have overlooked?
If you just want to view the content, in diff view click Preferences,
on the left bottom choose Whole File as context and click Update. It
is no good for copy-pasting though.
-Niklas
--
Niklas Laxström
_______________________________________________
Wikitech-l mailing list
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Ryan Kaldari
2012-12-12 08:09:11 UTC
Permalink
I found a solution to the problem:
If a gerrit administrator declares the mimetypes of the files to be safe
they will be displayed in-browser rather than downloaded as zip files:
https://gerrit-review.googlesource.com/Documentation/config-gerrit.html#_a_id_mimetype_a_section_mimetype

Could someone edit the gerrit.config file to declare php, javascript,
and css files as 'safe'?

Ryan Kaldari
Post by Ryan Kaldari
This is actually my biggest annoyance with gerrit—that I can't view
raw code from the change view. I can't fathom why they have a zip
download link, but not a view link. Then I could copy code without
copying all the line numbers.
Ryan Kaldari
Post by Niklas Laxström
Post by Thomas Gries
While tracking an iusse I came to
https://gerrit.wikimedia.org/r/#/c/7986/ (example case)
In the list of files I clicked on
https://gerrit.wikimedia.org/r/#/c/7986/14/includes/UserMailer.php
Now I am "desperately seeking" a link to _show the raw file content
after the commit in the __browser__,__
_but only found a link "(Download)" which starts a zip download. This is
not what I wanted.
Is there a solution which I have overlooked?
If you just want to view the content, in diff view click Preferences,
on the left bottom choose Whole File as context and click Update. It
is no good for copy-pasting though.
-Niklas
--
Niklas Laxström
_______________________________________________
Wikitech-l mailing list
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Platonides
2012-12-12 11:19:23 UTC
Permalink
Post by Ryan Kaldari
If a gerrit administrator declares the mimetypes of the files to be safe
https://gerrit-review.googlesource.com/Documentation/config-gerrit.html#_a_id_mimetype_a_section_mimetype
Could someone edit the gerrit.config file to declare php, javascript,
and css files as 'safe'?
Ryan Kaldari
I don't think we should set javascript mimetype as safe. Not when using
its own one at least.
Chad
2012-12-12 12:44:58 UTC
Permalink
Post by Ryan Kaldari
If a gerrit administrator declares the mimetypes of the files to be safe
https://gerrit-review.googlesource.com/Documentation/config-gerrit.html#_a_id_mimetype_a_section_mimetype
Could someone edit the gerrit.config file to declare php, javascript, and
css files as 'safe'?
That doesn't quite work the way you're thinking--it's for us to define mimetypes
that Gerrit should show diffs of (rather than a zip download of the
file). All text-
based filetypes are already shown by the browser as diffs, but most binary
filetypes aren't shown on diff. Images originally suffered this problem, but
we fixed it[0].

There's not a config switch for what the OP is asking for--but feel free to file
a bug upstream[1] :)

-Chad

[0] https://bugzilla.wikimedia.org/show_bug.cgi?id=36852
[1] https://code.google.com/p/gerrit/issues/list
Ryan Kaldari
2012-12-12 18:46:53 UTC
Permalink
Post by Chad
Post by Ryan Kaldari
If a gerrit administrator declares the mimetypes of the files to be safe
https://gerrit-review.googlesource.com/Documentation/config-gerrit.html#_a_id_mimetype_a_section_mimetype
Could someone edit the gerrit.config file to declare php, javascript, and
css files as 'safe'?
That doesn't quite work the way you're thinking--it's for us to define mimetypes
that Gerrit should show diffs of (rather than a zip download of the
file). All text-
based filetypes are already shown by the browser as diffs, but most binary
filetypes aren't shown on diff. Images originally suffered this problem, but
we fixed it[0].
There's not a config switch for what the OP is asking for--but feel free to file
a bug upstream[1] :)
Are you sure? This doesn't jibe with what the Gerrit developers say in
the support forums:
https://groups.google.com/forum/#!topic/repo-discuss/h7Bvgns5cyY/discussion

Ryan Kaldari
Chad
2012-12-12 19:04:43 UTC
Permalink
Post by Chad
Post by Ryan Kaldari
If a gerrit administrator declares the mimetypes of the files to be safe
https://gerrit-review.googlesource.com/Documentation/config-gerrit.html#_a_id_mimetype_a_section_mimetype
Could someone edit the gerrit.config file to declare php, javascript, and
css files as 'safe'?
That doesn't quite work the way you're thinking--it's for us to define mimetypes
that Gerrit should show diffs of (rather than a zip download of the
file). All text-
based filetypes are already shown by the browser as diffs, but most binary
filetypes aren't shown on diff. Images originally suffered this problem, but
we fixed it[0].
There's not a config switch for what the OP is asking for--but feel free to file
a bug upstream[1] :)
Are you sure? This doesn't jibe with what the Gerrit developers say in the
https://groups.google.com/forum/#!topic/repo-discuss/h7Bvgns5cyY/discussion
Yes, I'm pretty sure. That thread is confusing.

Before we enabled this for images, you used to have to download images as a zip
rather than in diffs. I'm pretty sure it has no affect on the
"download" buttons serving
zips on those pages...but we can test.

See bug 36852[0] for history. Also fun is which mimetypes to use[1] ;-)

-Chad

[0] https://bugzilla.wikimedia.org/show_bug.cgi?id=36852
[1] http://cweiske.de/tagebuch/php-mimetype.htm
Antoine Musso
2012-12-12 13:15:14 UTC
Permalink
Then I could copy code without copying all the line numbers.
We could apply 'user-select: none;' to the element containing the line
number. It is not supported on all browsers though.

I think I used that in our old Special:CodeReview. I could not find the
patch though.
--
Antoine "hashar" Musso
Jon Robson
2012-12-12 19:15:12 UTC
Permalink
This is actually my biggest annoyance with gerrit—that I can't view raw code
from the change view. I can't fathom why they have a zip download link, but
not a view link. Then I could copy code without copying all the line
numbers.
+1 this is a huge pain point for me too.
Subramanya Sastry
2012-12-12 19:23:55 UTC
Permalink
Post by Jon Robson
This is actually my biggest annoyance with gerrit—that I can't view raw code
from the change view. I can't fathom why they have a zip download link, but
not a view link. Then I could copy code without copying all the line
numbers.
+1 this is a huge pain point for me too.
+1 as well. The zip download is weird for a code review tool :)

Subbu.
Thomas Gries
2012-12-12 23:26:03 UTC
Permalink
I started this thread.

I filed this bug https://bugzilla.wikimedia.org/show_bug.cgi?id=42989
Gerrit: show link for raw file content in gerrit "diff" views (a
solution is proposed inside)
It has been closed as "RESOLVED INVALID" instead of deploying a solution
to Gerrit.

As a solution of the problem (show a raw file content) has not been found
(GitHub shows raw file contents, SVN browser ViewVC shows raw file contents)
example
https://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/AJAXPoll/AJAXPoll.php?revision=114166&view=co

I feel unhappy.
Very unhappy.
Matthew Flaschen
2012-12-13 00:23:25 UTC
Permalink
Post by Thomas Gries
I started this thread.
I filed this bug https://bugzilla.wikimedia.org/show_bug.cgi?id=42989
Gerrit: show link for raw file content in gerrit "diff" views (a
solution is proposed inside)
It has been closed as "RESOLVED INVALID" instead of deploying a solution
to Gerrit.
Ryan said Chad will test the suggested config change, and if that
doesn't work, Ryan will talk to the Gerrit devs.

Matt Flaschen

Loading...