44# Perforce Defect Tracking Integration Project
55# <http://www.ravenbrook.com/project/p4dti/>
66#
7- # MAKE_SCHEMA_DOC.PY -- GENERATE BUGZILLA SCHEMA DOCUMENTATION
7+ # SCHEMA-TOOL -- COMMAND LINE INTERFACE TO SCHEMA MODULES
88#
9- # Nick Barnes, Ravenbrook Limited, 2003-07-07
9+ # David Miller, Zarro Boogs Corporation, 2024-05-04
1010#
1111#
1212# 1. INTRODUCTION
@@ -28,10 +28,10 @@ import argparse
2828import subprocess
2929from pprint import pformat
3030from black import Mode , format_str
31- from collections import OrderedDict
3231
3332import schema_remarks
34- from make_schema_doc import BzSchemaProcessingException , make_tables , version_compare
33+ from make_schema_doc import BzSchemaProcessingException , make_tables
34+ from pickle_schema import pickle_schema
3535
3636
3737def write_file (first , last , file ):
@@ -259,7 +259,8 @@ def generate_schema_remarks(args):
259259 output = template .format (** var_dict )
260260 outfile .write (output )
261261 subprocess .run (
262- ["diff" , "-u" , "--color" , "schema_remarks.py" , "schema_remarks_new.py" ]
262+ ["diff" , "-u" , "--color" , "schema_remarks.py" , "schema_remarks_new.py" ],
263+ check = True ,
263264 )
264265 print ("Wrote changes to schema_remarks_new.py." )
265266 print ("If these changes are okay, move it overtop of schema_remarks.py" )
@@ -306,6 +307,9 @@ def validate_schema_remarks(_args):
306307 sys .exit ()
307308 print ("Versions validated." )
308309
310+ def pickle_parser (args ):
311+ pickle_schema (args .version , args .db_name )
312+ print ("Success!" )
309313
310314if __name__ == "__main__" :
311315 parser = argparse .ArgumentParser (
@@ -400,6 +404,22 @@ if __name__ == "__main__":
400404 help = "The destination version of the schema to compare" ,
401405 )
402406 parser_generate .set_defaults (func = generate_schema_remarks )
407+ parser_pickle = subparsers .add_parser (
408+ "pickle" ,
409+ help = "Generate a pickle file for a specific version" ,
410+ description = "Generate a pickle file for a specific version" ,
411+ )
412+ parser_pickle .add_argument (
413+ 'version' ,
414+ metavar = 'version' ,
415+ help = "The Bugzilla version number associated with the schema" ,
416+ )
417+ parser_pickle .add_argument (
418+ 'db_name' ,
419+ metavar = 'db_name' ,
420+ help = "The name of the database to analyze"
421+ )
422+ parser_pickle .set_defaults (func = pickle_parser )
403423 main_args = parser .parse_args ()
404424 main_args .func (main_args )
405425
@@ -408,12 +428,12 @@ if __name__ == "__main__":
408428#
409429# B. DOCUMENT HISTORY
410430#
411- # 2001-03-08 NB Created.
431+ # 2024-05-04 Created.
412432#
413433#
414434# C. COPYRIGHT AND LICENSE
415435#
416- # This file is copyright (c) 2001 Perforce Software, Inc. All rights
436+ # This file is copyright (c) 2024 Bugzilla Project Contributors. All rights
417437# reserved.
418438#
419439# Redistribution and use in source and binary forms, with or without
0 commit comments