From e1564f336837683efb311161a55be0e525c5d948 Mon Sep 17 00:00:00 2001 From: Jun Pataleta Date: Mon, 7 Oct 2024 12:57:07 +0800 Subject: [PATCH] doctor --masterbranch: Use the main branch instead of the master branch - Add `--mainbranch` argument for consistency - Designate the `--masterbanch` argument as an alias for the `--mainbranch` argument --- mdk/commands/doctor.py | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/mdk/commands/doctor.py b/mdk/commands/doctor.py index 9f4e4438..dc950adf 100644 --- a/mdk/commands/doctor.py +++ b/mdk/commands/doctor.py @@ -84,11 +84,18 @@ class DoctorCommand(Command): 'silent': True } ), + ( + ['--mainbranch'], + { + 'action': 'store_true', + 'help': 'Check the status of the main branch' + } + ), ( ['--masterbranch'], { 'action': 'store_true', - 'help': 'Check the status of the master branch' + 'help': 'With the removal of the master branch in Moodle, this is now just an alias for the `--mainbranch` argument' } ), ( @@ -153,8 +160,12 @@ def run(self, args): if args.branch or allChecks: self.branch(args) - # Check the master branch - if args.masterbranch or allChecks: + # Check the main branch + if args.mainbranch or args.masterbranch or allChecks: + if args.masterbranch: + print('With the removal of the master branch in the Moodle repository, the `--masterbranch` argument ' + 'is now an alias for the `--mainbranch` argument and may be removed soon from MDK as well. ' + 'In the future, please use `--mainbranch` argument instead.') self.masterbranch(args) # Check what you see is what you get @@ -287,9 +298,9 @@ def directories(self, args): mkdir(d, 0o777) def masterbranch(self, args): - """Checks the current master branch and the value set in config.""" + """Checks the current main branch and the value set in config.""" - print('Checking master branch') + print('Checking the main branch') if not self._checkWorkplace(): return @@ -305,7 +316,7 @@ def masterbranch(self, args): return repo = git.Git(repoPath, self.C.get('git')) - result = repo.execute(['show', 'master:version.php']) + result = repo.execute(['show', 'main:version.php']) if result[0] != 0: print(' Could not read the master version.php') return