Skip to content

Commit

Permalink
doctor --masterbranch: Use the main branch instead of the master branch
Browse files Browse the repository at this point in the history
- Add `--mainbranch` argument for consistency
- Designate the `--masterbanch` argument as an alias for the
  `--mainbranch` argument
  • Loading branch information
junpataleta committed Oct 7, 2024
1 parent 08f284d commit e1564f3
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions mdk/commands/doctor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
),
(
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit e1564f3

Please sign in to comment.