Shortened URLs for commit messages

Started by Bruce Momjianalmost 9 years ago5 messageshackers
Jump to latest
#1Bruce Momjian
bruce@momjian.us

I have written the following sed script to convert regular Postgres
email message URLs to their shorter form for commit messages:

sed 's;http\(s\?\)://www\.postgresql\.org/message-id/;http\1://postgr.es/m/;gi'

in case this is helpful to anyone.

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ As you are, so once was I.  As I am, so you will be. +
+                      Ancient Roman grave inscription +

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#2Bruce Momjian
bruce@momjian.us
In reply to: Bruce Momjian (#1)
Re: Shortened URLs for commit messages

On Tue, May 23, 2017 at 11:25:07PM -0400, Bruce Momjian wrote:

I have written the following sed script to convert regular Postgres
email message URLs to their shorter form for commit messages:

sed 's;http\(s\?\)://www\.postgresql\.org/message-id/;http\1://postgr.es/m/;gi'

in case this is helpful to anyone.

Oh, here's another one. I use an optional "Discussion:" tag in my
commit messages. This sed script converts a message-id into a proper
URL:

sed '/http/!s;^\(Discussion: *\)\(.*\)$;\1/messages/by-id/%5C2;&

For example:

	-Discussion: 87wp8o506b.fsf@seb.koffice.internal
	+Discussion: https://postgr.es/m/87wp8o506b.fsf@seb.koffice.internal

Yeah!

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ As you are, so once was I.  As I am, so you will be. +
+                      Ancient Roman grave inscription +

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#3Bruce Momjian
bruce@momjian.us
In reply to: Bruce Momjian (#2)
Re: Shortened URLs for commit messages

On Thu, Jun 15, 2017 at 01:05:19PM -0400, Bruce Momjian wrote:

On Tue, May 23, 2017 at 11:25:07PM -0400, Bruce Momjian wrote:

I have written the following sed script to convert regular Postgres
email message URLs to their shorter form for commit messages:

sed 's;http\(s\?\)://www\.postgresql\.org/message-id/;http\1://postgr.es/m/;gi'

in case this is helpful to anyone.

Oh, here's another one. I use an optional "Discussion:" tag in my
commit messages. This sed script converts a message-id into a proper
URL:

sed '/http/!s;^\(Discussion: *\)\(.*\)$;\1/messages/by-id/%5C2;&

Oh, here is a fixed version that requires an @ sign, which all message
id's have:

sed '/http/!s;^\(Discussion: *\)\(.*@.*\)$;\1/messages/by-id/%5C2;&

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ As you are, so once was I.  As I am, so you will be. +
+                      Ancient Roman grave inscription +

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#4Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: Bruce Momjian (#3)
Re: Shortened URLs for commit messages

Bruce Momjian wrote:

Oh, here is a fixed version that requires an @ sign, which all message
id's have:

sed '/http/!s;^\(Discussion: *\)\(.*@.*\)$;\1/messages/by-id/%5C2;&

So how do you actually use this?

--
�lvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#5Bruce Momjian
bruce@momjian.us
In reply to: Alvaro Herrera (#4)
Re: Shortened URLs for commit messages

On Wed, Jun 21, 2017 at 11:11:57AM -0400, Alvaro Herrera wrote:

Bruce Momjian wrote:

Oh, here is a fixed version that requires an @ sign, which all message
id's have:

sed '/http/!s;^\(Discussion: *\)\(.*@.*\)$;\1/messages/by-id/%5C2;&

So how do you actually use this?

My commit script is here:

https://momjian.us/main/writings/pgsql/src/pgcommit

It basically runs some checks and then creates a temp file with lines
labeled by their purpose. It edits the temp file, then runs the temp
file through a number of filters, and one of those does the URL
shortening via pgurl at:

https://momjian.us/main/writings/pgsql/src/pgurl

It also changes bare message-ids on the 'Discussion' line to shorted
URLs too. It also removes empty labeled lines, and exits if nothing has
been changed in the editor. It then does the commit (potentially to
multiple branches), and then the push.

The script calls many of other custom scripts but you can get an idea
how it works. I am happy to supply more tools as desired.

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ As you are, so once was I.  As I am, so you will be. +
+                      Ancient Roman grave inscription +

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers