unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Add a commit hash (first 6 chars) column to cgit webpage?
@ 2016-05-03 14:37 Kaushal Modi
  2016-05-03 14:57 ` Eli Zaretskii
  2016-05-04 15:12 ` Yuri Khan
  0 siblings, 2 replies; 11+ messages in thread
From: Kaushal Modi @ 2016-05-03 14:37 UTC (permalink / raw)
  To: Emacs developers

[-- Attachment #1: Type: text/plain, Size: 922 bytes --]

Hi all,

We typically reference to emacs commits with their hashes. The cgit webpage
does not show the commits:
http://git.savannah.gnu.org/cgit/emacs.git/log/?h=emacs-25

So I need to hover the mouse over each commit to see its hash in the
browser status bar at the bottom (or it shows as tooltip when hovered on
with mouse in eww). I wuold like to avoid this mouse-hover step.

As I don't know where to request this, I am mailing this here and hopefully
it gets forwarded to the right person.

Request:

Can we have one more column (probably on the left of commit description)
that shows the first 6 chars of the commit hash?

This is what I have in mind:

Age         Commit Hash   Commit message (Expand) Author Files Lines
16 hours 8544b9         posnp doc clarificationemacs-25 Lars Ingebrigtsen 1
-0/+1
16 hours 805204      Mention what a missing :group does Lars Ingebrigtsen 1
-3/+7

Thanks
-- 

-- 
Kaushal Modi

[-- Attachment #2: Type: text/html, Size: 2417 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Add a commit hash (first 6 chars) column to cgit webpage?
  2016-05-03 14:37 Add a commit hash (first 6 chars) column to cgit webpage? Kaushal Modi
@ 2016-05-03 14:57 ` Eli Zaretskii
  2016-05-04  3:05   ` Kaushal Modi
  2016-05-04 15:12 ` Yuri Khan
  1 sibling, 1 reply; 11+ messages in thread
From: Eli Zaretskii @ 2016-05-03 14:57 UTC (permalink / raw)
  To: Kaushal Modi; +Cc: emacs-devel

> From: Kaushal Modi <kaushal.modi@gmail.com>
> Date: Tue, 03 May 2016 14:37:42 +0000
> 
> We typically reference to emacs commits with their hashes. The cgit webpage does not show the commits:
> http://git.savannah.gnu.org/cgit/emacs.git/log/?h=emacs-25
> 
> So I need to hover the mouse over each commit to see its hash in the browser status bar at the bottom (or it
> shows as tooltip when hovered on with mouse in eww). I wuold like to avoid this mouse-hover step.
> 
> As I don't know where to request this, I am mailing this here and hopefully it gets forwarded to the right
> person.
> 
> Request:
> 
> Can we have one more column (probably on the left of commit description) that shows the first 6 chars of the
> commit hash?

Why do you use cgit?  Why not just use Git itself locally?



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Add a commit hash (first 6 chars) column to cgit webpage?
  2016-05-03 14:57 ` Eli Zaretskii
@ 2016-05-04  3:05   ` Kaushal Modi
  2016-05-04 14:52     ` Eli Zaretskii
  0 siblings, 1 reply; 11+ messages in thread
From: Kaushal Modi @ 2016-05-04  3:05 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1539 bytes --]

It's just a matter of convenience.. I have bookmarks set for
http://git.savannah.gnu.org/cgit/emacs.git/log/?h=emacs-25,
http://git.savannah.gnu.org/cgit/emacs.git/log/ and
http://orgmode.org/cgit.cgi/org-mode.git/log/. So it is just easier/quicker
to browse through those quickly in multiple tabs in a browser.

Also, I use the search interface on cgit.. it's very powerful for my
purpose where I can search by log/author/etc.

I am not saying that git CLI/Magit/gitk/etc cannot do that.. just that cgit
helps me do this stuff pretty quickly. Some day I might find the non-brower
git commit browsing quicker.

On Tue, May 3, 2016 at 10:57 AM Eli Zaretskii <eliz@gnu.org> wrote:

> > From: Kaushal Modi <kaushal.modi@gmail.com>
> > Date: Tue, 03 May 2016 14:37:42 +0000
> >
> > We typically reference to emacs commits with their hashes. The cgit
> webpage does not show the commits:
> > http://git.savannah.gnu.org/cgit/emacs.git/log/?h=emacs-25
> >
> > So I need to hover the mouse over each commit to see its hash in the
> browser status bar at the bottom (or it
> > shows as tooltip when hovered on with mouse in eww). I wuold like to
> avoid this mouse-hover step.
> >
> > As I don't know where to request this, I am mailing this here and
> hopefully it gets forwarded to the right
> > person.
> >
> > Request:
> >
> > Can we have one more column (probably on the left of commit description)
> that shows the first 6 chars of the
> > commit hash?
>
> Why do you use cgit?  Why not just use Git itself locally?
>
> --

-- 
Kaushal Modi

[-- Attachment #2: Type: text/html, Size: 2417 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Add a commit hash (first 6 chars) column to cgit webpage?
  2016-05-04  3:05   ` Kaushal Modi
@ 2016-05-04 14:52     ` Eli Zaretskii
  0 siblings, 0 replies; 11+ messages in thread
From: Eli Zaretskii @ 2016-05-04 14:52 UTC (permalink / raw)
  To: Kaushal Modi; +Cc: emacs-devel

> From: Kaushal Modi <kaushal.modi@gmail.com>
> Date: Wed, 04 May 2016 03:05:45 +0000
> Cc: emacs-devel@gnu.org
> 
> It's just a matter of convenience.. I have bookmarks set for
> http://git.savannah.gnu.org/cgit/emacs.git/log/?h=emacs-25, http://git.savannah.gnu.org/cgit/emacs.git/log/
> and http://orgmode.org/cgit.cgi/org-mode.git/log/. So it is just easier/quicker to browse through those quickly in
> multiple tabs in a browser.

Quicker than with Git itself?  I very much doubt that.

> Also, I use the search interface on cgit.. it's very powerful for my purpose where I can search by
> log/author/etc.

More powerful than "git log", with its many options (like -L, for
instance)?  I very much doubt that.



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Add a commit hash (first 6 chars) column to cgit webpage?
  2016-05-03 14:37 Add a commit hash (first 6 chars) column to cgit webpage? Kaushal Modi
  2016-05-03 14:57 ` Eli Zaretskii
@ 2016-05-04 15:12 ` Yuri Khan
  2016-05-04 15:16   ` Kaushal Modi
  1 sibling, 1 reply; 11+ messages in thread
From: Yuri Khan @ 2016-05-04 15:12 UTC (permalink / raw)
  To: Kaushal Modi; +Cc: Emacs developers

On Tue, May 3, 2016 at 8:37 PM, Kaushal Modi <kaushal.modi@gmail.com> wrote:

> We typically reference to emacs commits with their hashes. The cgit webpage
> does not show the commits:
> http://git.savannah.gnu.org/cgit/emacs.git/log/?h=emacs-25
>
> So I need to hover the mouse over each commit to see its hash in the browser
> status bar at the bottom (or it shows as tooltip when hovered on with mouse
> in eww). I wuold like to avoid this mouse-hover step.
>
> Can we have one more column (probably on the left of commit description)
> that shows the first 6 chars of the commit hash?

Which browser do you use? I could probably whip something up in
Greasemonkey (which is a Firefox extension). I am also told
Greasemonkey scripts can be installed in Chrom{e,ium}.



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Add a commit hash (first 6 chars) column to cgit webpage?
  2016-05-04 15:12 ` Yuri Khan
@ 2016-05-04 15:16   ` Kaushal Modi
  2016-05-05 12:15     ` Yuri Khan
  0 siblings, 1 reply; 11+ messages in thread
From: Kaushal Modi @ 2016-05-04 15:16 UTC (permalink / raw)
  To: Yuri Khan; +Cc: Emacs developers

[-- Attachment #1: Type: text/plain, Size: 274 bytes --]

>
> Which browser do you use? I could probably whip something up in
> Greasemonkey (which is a Firefox extension). I am also told
> Greasemonkey scripts can be installed in Chrom{e,ium}.
>

Thanks! I use both Firefox (on RHEL) and Chrome (on Windows).
-- 

-- 
Kaushal Modi

[-- Attachment #2: Type: text/html, Size: 510 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Add a commit hash (first 6 chars) column to cgit webpage?
  2016-05-04 15:16   ` Kaushal Modi
@ 2016-05-05 12:15     ` Yuri Khan
  2016-05-05 16:42       ` Kaushal Modi
  0 siblings, 1 reply; 11+ messages in thread
From: Yuri Khan @ 2016-05-05 12:15 UTC (permalink / raw)
  To: Kaushal Modi; +Cc: Emacs developers

On Wed, May 4, 2016 at 9:16 PM, Kaushal Modi <kaushal.modi@gmail.com> wrote:
>> Which browser do you use? I could probably whip something up in
>> Greasemonkey (which is a Firefox extension). I am also told
>> Greasemonkey scripts can be installed in Chrom{e,ium}.
>
> Thanks! I use both Firefox (on RHEL) and Chrome (on Windows).

I have hosted the script on my home server:

http://greasemonkey.centaur.ath.cx/cgit_Add_commit_hash_column.user.js

You can install this in Firefoxoids using the Greasemonkey or
Tampermonkey extension, and in Chromides using Tampermonkey.

If you need this on other aliases of Savannah cgit, or on other cgit
instances, just add the corresponding @include patterns. (If you feel
adventurous, replace the host with a *; this will enable the script on
all pages whose URL contains /cgit/ and /log/ in that order.)

The script makes some assumptions about the page DOM structure and is
therefore subject to software rot if that structure changes.

(Security notice: Userscripts run in the security context of your
browser. Carefully review any userscript you install.)

A courtesy inspection/archival copy follows.

// ==UserScript==
// @name        cgit: Add commit hash column
// @namespace   http://yurikhan.github.io/
// @include     http://git.savannah.gnu.org/cgit/*/log/*
// @version     1
// @grant       none
// ==/UserScript==

var header_row = document.querySelector('table.list tr:first-child');
var th = document.createElement('th');
th.className = 'left';
th.textContent = 'Hash';
var before = header_row.querySelector('th:nth-child(2)');
header_row.insertBefore(th, before);

var rows = document.querySelectorAll('table.list tr:not(.nohover)');
Array.prototype.forEach.call(rows, function(row) {
  var link = row.querySelector('a[href*="/commit/"]');
  var hash = null;
  ((link.search || '').replace(/^\?/, '').split('&')
   .map(function(param) { return param.split('='); })
   .filter(function(pair) { return pair[0] === 'id'; })
   .forEach(function(pair) { hash = pair[1]; }))
  var td = document.createElement('td');
  td.textContent = (hash || '').slice(0, 7);
  for (var before = link;
       !(before instanceof HTMLTableCellElement);
       before = before.parentNode);
  row.insertBefore(td, before);
});

rows = document.querySelectorAll(
  'table.list tr.nohover:not(:first-child)');
Array.prototype.forEach.call(rows, function(row) {
  var td = document.createElement('td');
  var before = row.querySelector('td:nth-child(2)');
  row.insertBefore(td, before);
});



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Add a commit hash (first 6 chars) column to cgit webpage?
  2016-05-05 12:15     ` Yuri Khan
@ 2016-05-05 16:42       ` Kaushal Modi
  2018-10-22 16:51         ` Kaushal Modi
  0 siblings, 1 reply; 11+ messages in thread
From: Kaushal Modi @ 2016-05-05 16:42 UTC (permalink / raw)
  To: Yuri Khan; +Cc: Emacs developers

[-- Attachment #1: Type: text/plain, Size: 704 bytes --]

On Thu, May 5, 2016 at 8:15 AM Yuri Khan <yuri.v.khan@gmail.com> wrote:

> I have hosted the script on my home server:
>
> http://greasemonkey.centaur.ath.cx/cgit_Add_commit_hash_column.user.js
>
> You can install this in Firefoxoids using the Greasemonkey or
> Tampermonkey extension, and in Chromides using Tampermonkey.
>
> If you need this on other aliases of Savannah cgit, or on other cgit
> instances, just add the corresponding @include patterns. (If you feel
> adventurous, replace the host with a *; this will enable the script on
> all pages whose URL contains /cgit/ and /log/ in that order.)
>

This is awesome! Thank you! Works! ( http://i.imgur.com/WoWMHB4.png ):)


-- 

-- 
Kaushal Modi

[-- Attachment #2: Type: text/html, Size: 1235 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Add a commit hash (first 6 chars) column to cgit webpage?
  2016-05-05 16:42       ` Kaushal Modi
@ 2018-10-22 16:51         ` Kaushal Modi
  2018-10-22 17:49           ` Yuri Khan
  0 siblings, 1 reply; 11+ messages in thread
From: Kaushal Modi @ 2018-10-22 16:51 UTC (permalink / raw)
  To: Yuri Khan; +Cc: Emacs developers

On Thu, May 5, 2016 at 12:42 PM Kaushal Modi <kaushal.modi@gmail.com> wrote:
>
> On Thu, May 5, 2016 at 8:15 AM Yuri Khan <yuri.v.khan@gmail.com> wrote:
>>
>> I have hosted the script on my home server:
>>
>> http://greasemonkey.centaur.ath.cx/cgit_Add_commit_hash_column.user.js
>>
>> You can install this in Firefoxoids using the Greasemonkey or
>> Tampermonkey extension, and in Chromides using Tampermonkey.
>>
>> If you need this on other aliases of Savannah cgit, or on other cgit
>> instances, just add the corresponding @include patterns. (If you feel
>> adventurous, replace the host with a *; this will enable the script on
>> all pages whose URL contains /cgit/ and /log/ in that order.)
>
>
> This is awesome! Thank you! Works! ( http://i.imgur.com/WoWMHB4.png ):)

Hello Yuri,

Sorry for this blast from the past.

I recently noticed that this Greasemonkey script has stopped working
(the Hash commit doesn't get auto-inserted). I made a failed attempt
at understanding the script and fixing it.

Probably something changed in the cgit web format and hopefully this
is an easy fix for you.



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Add a commit hash (first 6 chars) column to cgit webpage?
  2018-10-22 16:51         ` Kaushal Modi
@ 2018-10-22 17:49           ` Yuri Khan
  2018-10-22 18:00             ` Kaushal Modi
  0 siblings, 1 reply; 11+ messages in thread
From: Yuri Khan @ 2018-10-22 17:49 UTC (permalink / raw)
  To: Kaushal; +Cc: Emacs developers

On Mon, Oct 22, 2018 at 11:52 PM Kaushal Modi <kaushal.modi@gmail.com> wrote:

> I recently noticed that this Greasemonkey script has stopped working
> (the Hash commit doesn't get auto-inserted). I made a failed attempt
> at understanding the script and fixing it.
>
> Probably something changed in the cgit web format and hopefully this
> is an easy fix for you.

Still works for me with Firefox 62 and Violentmonkey 2.9.7. (I
migrated to Violentmonkey during the Firefox 57 Time of Troubles, when
Greasemonkey was not yet ported to the WebExtension API.)

I can offer a few debugging suggestions:

* See if your Greasemonkey is up-to-date.

* See if the script runs. To do that, add a “console.log('foo')” at
the top and save the script. Switch to the cgit tab, open the web
developer toolbox with C-S-i or F12, and switch to the Console tab.
Reload the page. You should see the “foo” line appear in the log.

* If the script does not run, see if the URL you are visiting matches
the @include directive in the script. You might have started accessing
Savannah cgit over HTTPS; if that’s the case, add another @include
line with an https URL pattern.

* If the script runs, use your debugging skills to find where it
fails, by adding console.log calls at key points. It’s no more
difficult than bisecting an Emacs init :) (Except that instead of
asking Emacs for docstrings you google for “site:developer.mozilla.org
Array.prototype.forEach”.)



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Add a commit hash (first 6 chars) column to cgit webpage?
  2018-10-22 17:49           ` Yuri Khan
@ 2018-10-22 18:00             ` Kaushal Modi
  0 siblings, 0 replies; 11+ messages in thread
From: Kaushal Modi @ 2018-10-22 18:00 UTC (permalink / raw)
  To: Yuri Khan; +Cc: Emacs developers

On Mon, Oct 22, 2018 at 1:49 PM Yuri Khan <yurivkhan@gmail.com> wrote:
>
> Still works for me with Firefox 62 and Violentmonkey 2.9.7. (I
> migrated to Violentmonkey during the Firefox 57 Time of Troubles, when
> Greasemonkey was not yet ported to the WebExtension API.)

Thanks for confirming!

You suggestions helped me fix this on my end; the @include URL was the issue.
I confirm this working once again on Firefox 62.0.3 with Greasemonkey.

> * See if the script runs. To do that, add a “console.log('foo')” at
> the top and save the script. Switch to the cgit tab, open the web
> developer toolbox with C-S-i or F12, and switch to the Console tab.
> Reload the page. You should see the “foo” line appear in the log.

This helped! Earlier the script wasn't running at all.

> * If the script does not run, see if the URL you are visiting matches
> the @include directive in the script. You might have started accessing
> Savannah cgit over HTTPS; if that’s the case, add another @include
> line with an https URL pattern.

This was the problem. At some point, I switched from using
http://git.savannah.gnu.org/cgit/emacs.git/log/ to
https://git.savannah.gnu.org/cgit/emacs.git/log/ (http -> https).

So changing the @include header to below now works!

// @include     http*://git.savannah.gnu.org/cgit/*/log/*



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2018-10-22 18:00 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-03 14:37 Add a commit hash (first 6 chars) column to cgit webpage? Kaushal Modi
2016-05-03 14:57 ` Eli Zaretskii
2016-05-04  3:05   ` Kaushal Modi
2016-05-04 14:52     ` Eli Zaretskii
2016-05-04 15:12 ` Yuri Khan
2016-05-04 15:16   ` Kaushal Modi
2016-05-05 12:15     ` Yuri Khan
2016-05-05 16:42       ` Kaushal Modi
2018-10-22 16:51         ` Kaushal Modi
2018-10-22 17:49           ` Yuri Khan
2018-10-22 18:00             ` Kaushal Modi

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).