Main entry point.
()
| 1130 | |
| 1131 | |
| 1132 | def main(): |
| 1133 | """Main entry point.""" |
| 1134 | import argparse |
| 1135 | |
| 1136 | parser = argparse.ArgumentParser( |
| 1137 | description="Migrate Apache Solr CHANGES.txt to logchange YAML format" |
| 1138 | ) |
| 1139 | parser.add_argument( |
| 1140 | "changes_file", |
| 1141 | help="Path to the CHANGES.txt file to migrate. Use '-' to read individual changelog entries from stdin and output YAML to stdout" |
| 1142 | ) |
| 1143 | parser.add_argument( |
| 1144 | "-o", "--output-dir", |
| 1145 | default="changelog", |
| 1146 | help="Directory to write changelog/ structure (default: ./changelog)" |
| 1147 | ) |
| 1148 | parser.add_argument( |
| 1149 | "--last-released", |
| 1150 | help="Last released version (e.g., 9.9.0). Versions newer than this go to unreleased/. " |
| 1151 | "If not specified, fetches from Apache projects JSON." |
| 1152 | ) |
| 1153 | parser.add_argument( |
| 1154 | "--write-versions", |
| 1155 | action="store_true", |
| 1156 | help="Parse CHANGES.txt to enumerate versions, compare with solr.json, and write release-date.txt files to existing changelog folders" |
| 1157 | ) |
| 1158 | |
| 1159 | args = parser.parse_args() |
| 1160 | |
| 1161 | # Handle stdin/stdout mode |
| 1162 | if args.changes_file == '-': |
| 1163 | StdinProcessor.process() |
| 1164 | return |
| 1165 | |
| 1166 | if not os.path.exists(args.changes_file): |
| 1167 | print(f"Error: CHANGES.txt file not found: {args.changes_file}", file=sys.stderr) |
| 1168 | sys.exit(1) |
| 1169 | |
| 1170 | # Handle --write-versions mode |
| 1171 | if args.write_versions: |
| 1172 | writer = VersionWriter(args.changes_file, args.output_dir) |
| 1173 | writer.run() |
| 1174 | return |
| 1175 | |
| 1176 | # Standard migration mode |
| 1177 | runner = MigrationRunner(args.changes_file, args.output_dir, args.last_released) |
| 1178 | runner.run() |
| 1179 | |
| 1180 | |
| 1181 | if __name__ == "__main__": |
no test coverage detected
searching dependent graphs…