Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 9 May 2013 22:02:16 +0000 (UTC)
From:      Sofian Brabez <sbz@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r317750 - head/Tools/scripts
Message-ID:  <201305092202.r49M2GGm060548@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: sbz
Date: Thu May  9 22:02:15 2013
New Revision: 317750
URL: http://svnweb.freebsd.org/changeset/ports/317750

Log:
  - 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>

Modified:
  head/Tools/scripts/README.getpatch   (contents, props changed)
  head/Tools/scripts/getpatch

Modified: head/Tools/scripts/README.getpatch
==============================================================================
--- head/Tools/scripts/README.getpatch	Thu May  9 21:38:13 2013	(r317749)
+++ head/Tools/scripts/README.getpatch	Thu May  9 22:02:15 2013	(r317750)
@@ -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
 

Modified: head/Tools/scripts/getpatch
==============================================================================
--- head/Tools/scripts/getpatch	Thu May  9 21:38:13 2013	(r317749)
+++ head/Tools/scripts/getpatch	Thu May  9 22:02:15 2013	(r317750)
@@ -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:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201305092202.r49M2GGm060548>