scripts: rfr: fix urls with digits

With just (\d+), the very first regex would find a number within a
longer string, which for the following example would be wrongly 3, not
2318270. Make it match just a number and nothing else. Interestingly,
plain number search would work for most gerrit urls, but let's be
specific to avoid accidents.

example: https://git-master.nvidia.com/r/c/3rdparty/qnx/src/+/2318270

Also make the list more concise by joining almost identical pairs that
differ by just one character: use "?" to make the character optional.

Change-Id: Ia1b2ee4270c599ec7bcc2c4375c8a8f498043b27
Signed-off-by: Konsta Hölttä <kholtta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2318496
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Thomas Fleury <tfleury@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
This commit is contained in:
Konsta Hölttä
2020-03-25 22:04:01 +02:00
committed by Alex Waterman
parent 002fb2431d
commit 0cd5502935

View File

@@ -44,17 +44,12 @@ to_addr = 'sw-mobile-nvgpu-core <sw-mobile-nvgpu-core@exchange.nvidia.com>'
# Gerrit commit URL formats. These are regular expressions to match the # Gerrit commit URL formats. These are regular expressions to match the
# incoming URLs against. # incoming URLs against.
gr_fmts = [ r'(\d+)', gr_fmts = [ r'^(\d+)$',
r'http://git-master/r/(\d+)', r'https?://git-master/r/(\d+)',
r'http://git-master/r/#/c/(\d+)/', r'https?://git-master/r/#/c/(\d+)/',
r'http://git-master.nvidia.com/r/(\d+)', r'https?://git-master.nvidia.com/r/(\d+)',
r'http://git-master.nvidia.com/r/#/c/(\d+)/', r'https?://git-master.nvidia.com/r/#/c/(\d+)/?',
r'https://git-master/r/(\d+)', r'https?://git-master.nvidia.com/r/c/(?:[\w\-_\/]+?)\+/(\d+)' ]
r'https://git-master/r/#/c/(\d+)/',
r'https://git-master.nvidia.com/r/(\d+)',
r'https://git-master.nvidia.com/r/#/c/(\d+)',
r'https://git-master.nvidia.com/r/#/c/(\d+)/',
r'https://git-master.nvidia.com/r/c/(?:[\w\-_\/]+?)\+/(\d+)' ]
# The user to use. May be overridden but the default comes from the environment. # The user to use. May be overridden but the default comes from the environment.
user = os.environ['USER'] user = os.environ['USER']