Skip to content

Commit 6968f1a

Browse files
committed
Stratify command in levels: with object > area > action
First level `file`: the command handles files Second level: `maintainership`: the command operates on the maintainership area Third level `migrate`: the target action
1 parent 9e93762 commit 6968f1a

4 files changed

Lines changed: 36 additions & 4 deletions

File tree

osc/commands_git/file.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import osc.commandline_git
2+
3+
4+
class FileCommand(osc.commandline_git.GitObsCommand):
5+
"""
6+
Manage files in a package
7+
"""
8+
9+
name = "file"
10+
11+
def init_arguments(self):
12+
pass
13+
14+
def run(self, args):
15+
self.parser.print_help()
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import osc.commandline_git
2+
3+
4+
class FileMaintainershipCommand(osc.commandline_git.GitObsCommand):
5+
"""
6+
Manage the _maintainership.json file
7+
"""
8+
9+
name = "maintainership"
10+
parent = "FileCommand"
11+
12+
def init_arguments(self):
13+
pass
14+
15+
def run(self, args):
16+
self.parser.print_help()

osc/commands_git/maintainership_converter.py renamed to osc/commands_git/file_maintainership_migrate.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import osc.commandline_git
22

33

4-
class MaintainershipCommand(osc.commandline_git.GitObsCommand):
4+
class FileMaintainershipMigrateCommand(osc.commandline_git.GitObsCommand):
55
"""
66
Read _maintainership.json and convert it from legacy format to the current format
77
"""
88

9-
name = "maintainership-converter"
9+
name = "migrate"
10+
parent = "FileMaintainershipCommand"
1011

1112
def init_arguments(self):
1213
self.add_argument(

tests/test_maintainership_converter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ def _write_file(self, text):
2121
return path
2222

2323
def _run_converter(self, path):
24-
from osc.commands_git.maintainership_converter import MaintainershipCommand
24+
from osc.commands_git.file_maintainership_migrate import FileMaintainershipMigrateCommand
2525

26-
cmd = MaintainershipCommand.__new__(MaintainershipCommand)
26+
cmd = FileMaintainershipMigrateCommand.__new__(FileMaintainershipMigrateCommand)
2727

2828
args = type("Args", (), {"path": path})()
2929
stdout = io.StringIO()

0 commit comments

Comments
 (0)