mirror of
https://github.com/netbirdio/FreeBSD-ports.git
synced 2026-05-22 18:42:42 -07:00
- Use literal instead of constructor to avoid CALL_FUNCTION bytecode instruction
- Add add_patch method [1] - Update README wording and fix typo PR: ports/175984 [1] Submitted by: Christoph Mallon <christoph.mallon at gmx.de>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
GETPATCH(1) FreeBSD General Commands Manual GETPATCH(1)
|
||||
|
||||
NAME
|
||||
getpatch - A utility to download patch attachments on Bug Tracking Systems
|
||||
getpatch - Utility to download patch attachments on Bug Tracking Systems
|
||||
|
||||
SYNOPSIS
|
||||
getpatch [-h] [--mode gnats|bz] [--last] [--stdout] <pr-id>
|
||||
@@ -11,7 +11,7 @@ DESCRIPTION
|
||||
Systems such Gnats and Bugzilla. It supports retrieving multiple
|
||||
attachments from the command line.
|
||||
|
||||
It's written in python witout any extra dependencies. In addition to the
|
||||
It's written in python without any extra dependencies. In addition to the
|
||||
functionalities offered by other similar tools suchs as getpr, it does web
|
||||
scrapping on the BTS web interface in order to retrieve the patches attached
|
||||
to PR.
|
||||
@@ -20,7 +20,7 @@ DESCRIPTION
|
||||
|
||||
-h Prints a multi-line help message and exits.
|
||||
|
||||
--mode Specifies the BTS. Currently "gnats" and "bz" are.
|
||||
--mode Specifies the BTS. Currently "gnats" and "bz" are
|
||||
supported.
|
||||
|
||||
--last Only retrieves the latest iteration of a patch.
|
||||
@@ -33,7 +33,7 @@ FILES
|
||||
${PORTSDIR}/Tools/scripts/getpatch
|
||||
|
||||
EXAMPLES
|
||||
Retrieve all patches attached to PR ports/166692 from a Gnats BTS:
|
||||
Retrieve all patches attached to PR ports/166692 from Gnats BTS:
|
||||
|
||||
getpatch --mode gnats ports/166692
|
||||
|
||||
@@ -43,7 +43,7 @@ EXAMPLES
|
||||
|
||||
Gnats is the default BTS and category isn't mandatory.
|
||||
|
||||
Retrieve all patches attached to PR ports/166692 from a Bugzilla BTS:
|
||||
Retrieve all patches attached to PR ports/166692 from Bugzilla BTS:
|
||||
|
||||
getpatch --mode bz ports/166692
|
||||
|
||||
@@ -51,7 +51,7 @@ EXAMPLES
|
||||
|
||||
getpatch --last ports/166692
|
||||
|
||||
Retrieve a patch on dump it to standard output
|
||||
Retrieve a patch and dump it to standard output
|
||||
|
||||
getpatch --stdout ports/166692
|
||||
|
||||
|
||||
+10
-8
@@ -30,7 +30,6 @@
|
||||
|
||||
import argparse
|
||||
import codecs
|
||||
import locale
|
||||
import re
|
||||
import sys
|
||||
if sys.version_info.major == 3:
|
||||
@@ -47,11 +46,11 @@ class GetPatch(object):
|
||||
def __init__(self, pr, category='ports'):
|
||||
self.pr = pr
|
||||
self.category = category
|
||||
self.patchs = list()
|
||||
self.url = str()
|
||||
self.patch = str()
|
||||
self.patchs = []
|
||||
self.url = ""
|
||||
self.patch = ""
|
||||
self.output_stdout = False
|
||||
self.default_locale = locale.getdefaultlocale()[1].lower()
|
||||
self.default_locale = sys.getdefaultencoding()
|
||||
|
||||
def fetch(self, *largs, **kwargs):
|
||||
raise NotImplementedError()
|
||||
@@ -86,6 +85,9 @@ class GetPatch(object):
|
||||
else:
|
||||
self.write(p, data)
|
||||
|
||||
def add_patch(self, url, name):
|
||||
self.patchs.append({'url': url, 'name': name})
|
||||
|
||||
def out(self, s):
|
||||
if not self.output_stdout:
|
||||
print(s)
|
||||
@@ -111,7 +113,7 @@ class GnatsGetPatch(GetPatch):
|
||||
sys.exit(1)
|
||||
|
||||
for patchs in re.findall(pattern, str(data)):
|
||||
self.patchs.append({'url': patchs[0], 'name': patchs[1]})
|
||||
self.add_patch(patchs[0], patchs[1])
|
||||
|
||||
class BzGetPatch(GetPatch):
|
||||
|
||||
@@ -159,7 +161,7 @@ class BzGetPatch(GetPatch):
|
||||
sys.exit(1)
|
||||
|
||||
for i in range(nb_urls):
|
||||
self.patchs.append({'url': urls[i], 'name': names[i]})
|
||||
self.add_patch(urls[i], names[i])
|
||||
|
||||
def main():
|
||||
|
||||
@@ -181,7 +183,7 @@ def main():
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
category = str()
|
||||
category = ""
|
||||
pr = str(args.pr[0])
|
||||
|
||||
if '/' in pr and pr is not None:
|
||||
|
||||
Reference in New Issue
Block a user