Handle gerrit 3.x style internal urls

A new style of internal url appears in Gerrit 3.x:

  /c/PROJECT/+/NUMBER

This handles that in internal links and updates the terminal
integration docs with the new URL format as well.

Change-Id: I30bc6194b1b467b2e6500c5f11e5d06de1aea721
This commit is contained in:
James E. Blair 2020-12-18 09:22:58 -08:00
parent 119f96f293
commit bb9d860dde
2 changed files with 10 additions and 2 deletions

View File

@ -203,7 +203,7 @@ in Gertty::
URxvt.keysym.C-Delete: perl:matcher:last
URxvt.keysym.M-Delete: perl:matcher:list
URxvt.matcher.button: 1
URxvt.matcher.pattern.1: https:\/\/review.example.org/(\\#\/c\/)?(\\d+)[\w]*
URxvt.matcher.pattern.1: https:\/\/review.example.org/(\\#/c/)?(c/[^\\+]+\\+/)?(\\d+)[\\w]*
URxvt.matcher.launcher.1: gertty --open $0
You will want to adjust the pattern to match the review site you are

View File

@ -637,6 +637,14 @@ class App(object):
change = patchset = filename = None
path = [x for x in result.path.split('/') if x]
if path:
if path[0] == 'c':
while path:
path.pop(0)
if path[0] == '+':
path.pop(0)
change = path.pop(0)
break
else:
change = path[0]
else:
path = [x for x in result.fragment.split('/') if x]