=== modified file 'bugHelper/commandLine.py' --- bugHelper/commandLine.py 2007-04-19 10:56:17 +0000 +++ bugHelper/commandLine.py 2007-04-20 09:21:21 +0000 @@ -43,6 +43,7 @@ [-H] use all clue files, if a bug has no source package assigned or no clue file for that package exists + [--nd (<|>)] filter on given number of duplicates [--tag ] filter on given tag""") parser.add_option("-p", "--package", type="string", dest="sourcepackage", @@ -95,6 +96,8 @@ default="", help="bug importance") parser.add_option("--tag", type="string", dest="tag", default="", help="bug tag") + parser.add_option("--nd", type="string", dest="no_duplicates", + default="", help="number of duplicates") if parser.get_prog_name() == "bugnumbers": parser.set_defaults(package=None, url=None, minbug=None) === modified file 'bughelper' --- bughelper 2007-04-20 09:16:01 +0000 +++ bughelper 2007-04-20 09:28:22 +0000 @@ -6,6 +6,7 @@ import os import sys import urllib +import re try: from commandLine import commandLine @@ -74,6 +75,18 @@ "https://bugs.launchpad.net/distros/ubuntu/+source/%s/+bugs?%s" % \ (cl.options.sourcepackage,urllib.urlencode(url_option,True)) + if cl.options.no_duplicates: + m = re.search('^(<|>){0,1}([0-9]+$)', cl.options.no_duplicates) + if not m: + cl.parser.print_usage() + sys.exit(1) + if m.group(1) == "<" : + no_duplicates = lambda x: x < int(m.group(2)) + elif m.group(1) == ">" : + no_duplicates = lambda x: x > int(m.group(2)) + else: + no_duplicates = lambda x: x == int(m.group(2)) + bl = BugList(cl.options).bugs if cl.options.sourcepackage: path = os.path.expanduser(os.path.join(conf.attachments_cache, @@ -83,6 +96,7 @@ if not bl: print "No bugs found." sys.exit(1) + count_bugs = 0 for bugNum in bl: if not cl.options.attachments: b = Bug(bugNum, cl.options.sourcepackage, None) @@ -114,6 +128,9 @@ displayclues[clue.info].add(a.url) if displayclues: print output.print_bug(cl.options.format, b, displayclues) + if not count_bugs: + print "No bugs found." + sys.exit(1) if __name__ == "__main__": main() === modified file 'launchpadBugs/HTMLOperations.py' --- launchpadBugs/HTMLOperations.py 2007-04-20 09:16:01 +0000 +++ launchpadBugs/HTMLOperations.py 2007-04-20 09:21:21 +0000 @@ -302,6 +302,13 @@ def Title(self): return self.title + def Duplicates(self): + m = re.search('"number_of_dupes">[^(0-9)]*([0-9]*)[^<]*<', self.text) + if m: + return int(m.group(1)) + else: + return 0 + def get_metadata(self): '''Load description, tags, and nickname.'''