Hello Thcipriani, I'd like you to do a code review. Please visit
https://gerrit.wikimedia.org/r/404787 to review the following change. Change subject: branch.py: Add $wgVersion fixing in DefaultSettings ...................................................................... branch.py: Add $wgVersion fixing in DefaultSettings Change-Id: I4887a8ba30e98ae0912edd510bbf81fd6a6be246 --- M make-release/branch.py 1 file changed, 14 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/tools/release refs/changes/87/404787/1 diff --git a/make-release/branch.py b/make-release/branch.py index 8aff26f..1cad5da 100755 --- a/make-release/branch.py +++ b/make-release/branch.py @@ -6,6 +6,7 @@ from contextlib import contextmanager import logging import os +import re import shutil import subprocess import sys @@ -95,6 +96,11 @@ shutil.rmtree(temp) +WGVERSION_REGEX = re.compile( + r'^( \$wgVersion \s+ = \s+ ) [^;]* ( ; \s* ) $', + re.MULTILINE | re.VERBOSE) + + def do_core_work(branch, bundle, version): """Add submodules, bump $wgVersion, etc""" cwd = os.getcwd() @@ -104,7 +110,14 @@ subprocess.check_call(['/usr/bin/git', 'submodule', 'add', '--force', '--branch', branch, url, submodule]) - # something with defaultsettings + + with open('includes/DefaultSettings.php', 'r') as defaultsettings: + contents = defaultsettings.read() + + with open('includes/DefaultSettings.php', 'w') as defaultsettings: + defaultsettings.write(WGVERSION_REGEX.sub( + r"\1'" + version + r"'\2", contents)) + subprocess.check_call(['/usr/bin/git', 'commit', '-a', '-m', 'Creating new %s branch' % branch]) subprocess.check_call(['/usr/bin/git', 'push', 'origin', -- To view, visit https://gerrit.wikimedia.org/r/404787 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I4887a8ba30e98ae0912edd510bbf81fd6a6be246 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/tools/release Gerrit-Branch: master Gerrit-Owner: Chad <ch...@wikimedia.org> Gerrit-Reviewer: Thcipriani <tcipri...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits