def add_version_commit(): repo = Repository(script_dir) create_commit(repo, 'Update to {}'.format(ver_str)) config = Config.get_global_config() author = Signature(config['user.name'], config['user.email']) repo.create_tag('v{}'.format(ver_str), repo.revparse_single('HEAD').id, GIT_OBJ_COMMIT, author, 'v{}'.format(ver_str))
def create_commit(repo, msg): index = repo.index index.add_all() index.write() config = Config.get_global_config() author = Signature(config['user.name'], config['user.email']) commiter = author tree = index.write_tree() repo.create_commit('refs/heads/master', author, commiter, msg, tree, [repo.head.get_object().hex])
def create_commit(repo_path): repo = Repository (repo_path) index = repo.index index.add_all () index.write () config = Config.get_global_config() author = Signature(config['user.name'], config['user.email']) commiter = author tree = index.write_tree() repo.create_commit ('refs/heads/master', author, commiter, 'Update DSpellCheck to {}'.format (ver), tree, [repo.head.get_object().hex])
validate_data['DSpellCheck'] = {} validate_data['DSpellCheck'][hashlib.md5( open(x64_binary_path, 'rb').read()).hexdigest()] = 'DSpellCheck.dll' str_after = json.dumps(validate_data['DSpellCheck']) validate_text = validate_text.replace(str_before[1:-1], str_after[1:-1]) with open(validate_path, "w", encoding='utf-8') as file: file.write(validate_text) print('Creating commit in npp-plugins-x64 repository...') repo = Repository(plugins_x64_path) index = repo.index index.add_all() index.write() config = Config.get_global_config() author = Signature(config['user.name'], config['user.email']) commiter = author tree = index.write_tree() repo.create_commit('refs/heads/master', author, commiter, 'Update DSpellCheck to {}'.format(ver), tree, [repo.head.get_object().hex]) else: print('%NPP_PLUGINS_X64_PATH% is not set up, nothing to update') successString = 'Success!' try: from colorama import init, Fore, Style init() successString = Fore.GREEN + Style.BRIGHT + successString except:
def test_global_config(self): try: self.assertNotEqual(None, Config.get_global_config()) except IOError: # There is no user config pass
def test_global_config(self): try: assert Config.get_global_config() is not None except IOError: # There is no user config pass
def add_version_commit(): repo = Repository(script_dir) create_commit(repo, 'Update to {}'.format(ver_str)) config = Config.get_global_config() author = Signature(config['user.name'], config['user.email'])