From e75707c178a530bc0ab3aee0f5f1ac566afd642e Mon Sep 17 00:00:00 2001 From: Oleg Sobolev Date: Wed, 16 Oct 2024 23:40:49 -0700 Subject: [PATCH] Removing obsolete parameter and functionality. Nothing is on SVN anymore. --- libtbx/command_line/clean_clutter.py | 36 +++++++--------------------- libtbx/subversion.py | 22 ----------------- 2 files changed, 9 insertions(+), 49 deletions(-) delete mode 100644 libtbx/subversion.py diff --git a/libtbx/command_line/clean_clutter.py b/libtbx/command_line/clean_clutter.py index 79a192f302..c3bfa1119e 100644 --- a/libtbx/command_line/clean_clutter.py +++ b/libtbx/command_line/clean_clutter.py @@ -2,7 +2,6 @@ import sys import os import shutil -from libtbx import subversion from libtbx.option_parser import option_parser import libtbx.file_clutter @@ -50,45 +49,28 @@ def run(): opt_parser = (option_parser( usage=""" clean_clutter [-t n | --tabsize=n] file1 file2 ... -clean_clutter [-t n | --tabsize=n] [directory] -clean_clutter [-t n | --tabsize=n] [--committing|-c]""", +clean_clutter [-t n | --tabsize=n] [directory]""", description="""The first form cleans the specified files whereas the second form cleans all files in the hierarchy rooted in the given directory or -the current directory is none is given. -The -c options restricts cleaning to those files which would be committed -by running svn commit.""") +the current directory is none is given.""") .option("-t", "--tabsize", action="store", type="int", default=8, help="the number of spaces a tab is to be replaced by", metavar="INT") - .option("-c", "--committing", - action="store_true", - default=False, - help="whether to clean the files which are to be committed") ) command_line = opt_parser.process(args=sys.argv[1:]) co = command_line.options files = command_line.args - if co.committing and files: - opt_parser.show_help() - exit(1) run_isort_in_path = False - if co.committing: - try: - files = list(subversion.marked_for_commit()) - except RuntimeError as err: - print(err) - exit(1) - else: - if len(files) <= 1: - if not files: dir = '.' - else: dir = files[0] - files = [ c.path for c in libtbx.file_clutter.gather([dir]) - if c.is_cluttered(flag_x=False) ] - if os.path.exists(os.path.join(dir, '.isort.cfg')): - run_isort_in_path = dir + if len(files) <= 1: + if not files: dir = '.' + else: dir = files[0] + files = [ c.path for c in libtbx.file_clutter.gather([dir]) + if c.is_cluttered(flag_x=False) ] + if os.path.exists(os.path.join(dir, '.isort.cfg')): + run_isort_in_path = dir clean_clutter_in(files, tabsize=co.tabsize) if run_isort_in_path: try: diff --git a/libtbx/subversion.py b/libtbx/subversion.py deleted file mode 100644 index 080aa254b9..0000000000 --- a/libtbx/subversion.py +++ /dev/null @@ -1,22 +0,0 @@ -from __future__ import absolute_import, division, print_function -from libtbx import easy_run - -def marked_for_commit(): - lines = easy_run.fully_buffered( - command="svn status").raise_if_errors().stdout_lines - for li in lines: - status = li[0] # c.f. [1] - if status in ('A','M','R'): - path = li[5:].strip() - yield path - -### References: - -### [1] http://svnbook.red-bean.com/en/1.1/ch03s05.html#svn-ch-3-sect-5.3.1 -### "In this output format svn status prints five columns of characters, -### followed by several whitespace characters, followed by a file or directory -### name. The first column tells the status of a file or directory -### and/or its contents. ...." - -if (__name__ == "__main__"): - print("\n".join(marked_for_commit()))