def enableTracCommitHook(self, enable): if enable: enable_str = "enable" else: enable_str = "disable" remote.execute("trac-sync-hook %s %s" % (enable_str, self.name))
def enableTracCommitHook(self, enable): if enable: enable_str = "enable" else: enable_str = "disable" remote.execute("trac-sync-hook %s %s" % (enable_str, self.name))
def enableCommitEmails(self, enable): """Enables sending of commit messages if *enable* is True.""" if enable: enable_str = "enable" else: enable_str = "disable" remote.execute("commit-email-hook %s %s" % (enable_str, self.name))
def enableCommitEmails(self, enable): """Enables sending of commit messages if *enable* is True.""" if enable: enable_str = "enable" else: enable_str = "disable" remote.execute("commit-email-hook %s %s" % (enable_str, self.name))
def export_notifications(**kwargs): repositories = "" if 'reposname' in kwargs.iterkeys(): repositories = kwargs['reposname'] try: remote.execute("update-notifications %s" % (repositories, )) except remote.NonZeroExitStatus as e: raise Exception("Could not update notifications: %s" % e)
def export_notifications(**kwargs): repositories = "" if 'reposname' in kwargs.iterkeys(): repositories = kwargs['reposname'] try: remote.execute("update-notifications %s" % (repositories,)) except remote.NonZeroExitStatus as e: raise Exception("Could not update notifications: %s" % e)
def add(name): """Create a new repository with name *name*""" reposdir = directory(name) if os.path.exists(str(reposdir)): raise PermissionError("Could not create %s, already exists." % name) try: remote.execute("create %s" % name) except remote.NonZeroExitStatus as e: raise PermissionError( "External command 'GIT_DIR=\"%s\" git --bare init' failed: %s" % \ (name, e))
def add(name): """Create a new repository with name *name*""" reposdir = directory(name) if os.path.exists(str(reposdir)): raise PermissionError("Could not create %s, already exists." % name) try: remote.execute("create %s" % name) except remote.NonZeroExitStatus as e: raise PermissionError( "External command 'GIT_DIR=\"%s\" git --bare init' failed: %s" % \ (name, e))
def diagnostics(): results = {} results['enabled_git'] = 'git' in options.value('vcs_plugins', '') if not results['enabled_git']: results['enabled_git_label'] = 'disabled' results['git_all_label'] = 'disabled' return results try: git_dir = options.env_path('git_dir') except UnknownKeyError: results['git_dir_set'] = False results['git_hooks_all_new'] = True # because no repositories results['git_old_hook_repos'] = [] else: results['git_dir_set'] = True old_repos = list(old_hook_repos(git_dir)) results['git_hooks_all_new'] = len(old_repos) == 0 results['git_old_hook_repos'] = old_repos # check dirs for correct permissions bad_dirs = git_repos_wrong_perms(git_dir) results['git_repos_correct_perms'] = len(bad_dirs) == 0 results['git_repos_bad_dirs'] = bad_dirs try: git_ssh_host = options.value('git_ssh_host') except UnknownKeyError: results['git_hostname_ok'] = False else: results['git_hostname_ok'] = True if git_ssh_host in ('localhost', '127.0.0.1', '::1'): results['git_hostname_ok'] = False try: remote.execute("update-auth") except (remote.NonZeroExitStatus, UnknownKeyError) as e: results['git_admin_test'] = False results['git_admin_test_errmsg'] = str(e) results['git_ssh_host_internal'] = options.value( 'git_ssh_host_internal', 'git_ssh_host_internal') results['git_user'] = options.value('git_user', 'git_user') results['git_ssh_port'] = options.value('git_ssh_port', 'git_ssh_port') else: results['git_admin_test'] = True wrong_perms = git_dir_wrong_perms() results['git_dir_perms_wrong'] = wrong_perms results['git_dir_perms'] = len(wrong_perms) == 0 return add_labels(results, 'git_all', warnings, fails)
def diagnostics(): results = {} results["enabled_git"] = "git" in options.value("vcs_plugins", "") if not results["enabled_git"]: results["enabled_git_label"] = "disabled" results["git_all_label"] = "disabled" return results try: git_dir = options.env_path("git_dir") except UnknownKeyError: results["git_dir_set"] = False results["git_hooks_all_new"] = True # because no repositories results["git_old_hook_repos"] = [] else: results["git_dir_set"] = True old_repos = list(old_hook_repos(git_dir)) results["git_hooks_all_new"] = len(old_repos) == 0 results["git_old_hook_repos"] = old_repos # check dirs for correct permissions bad_dirs = git_repos_wrong_perms(git_dir) results["git_repos_correct_perms"] = len(bad_dirs) == 0 results["git_repos_bad_dirs"] = bad_dirs try: git_ssh_host = options.value("git_ssh_host") except UnknownKeyError: results["git_hostname_ok"] = False else: results["git_hostname_ok"] = True if git_ssh_host in ("localhost", "127.0.0.1", "::1"): results["git_hostname_ok"] = False try: remote.execute("update-auth") except (remote.NonZeroExitStatus, UnknownKeyError) as e: results["git_admin_test"] = False results["git_admin_test_errmsg"] = str(e) results["git_ssh_host_internal"] = options.value("git_ssh_host_internal", "git_ssh_host_internal") results["git_user"] = options.value("git_user", "git_user") results["git_ssh_port"] = options.value("git_ssh_port", "git_ssh_port") else: results["git_admin_test"] = True wrong_perms = git_dir_wrong_perms() results["git_dir_perms_wrong"] = wrong_perms results["git_dir_perms"] = len(wrong_perms) == 0 return add_labels(results, "git_all", warnings, fails)
def remove(self): """Removes repository *name*""" if not self.dir.absolute: raise Exception("Error, repository path is relative, this should be fixed") if not self.dir.exists(): raise Exception("Repository %s does not exist." % self.name) try: remote.execute("remove %s" % self.name) except remote.NonZeroExitStatus as e: raise PermissionError( "External command 'remove %s' failed: %s" % \ (self.name, e))
def remove(self): """Removes repository *name*""" if not self.dir.absolute: raise Exception( "Error, repository path is relative, this should be fixed") if not self.dir.exists(): raise Exception("Repository %s does not exist." % self.name) try: remote.execute("remove %s" % self.name) except remote.NonZeroExitStatus as e: raise PermissionError( "External command 'remove %s' failed: %s" % \ (self.name, e))
def export_ssh_keys(*args, **kwargs): try: remote.execute("update-auth") except remote.NonZeroExitStatus as e: raise Exception("Could not export ssh-keys: %s" % e)
def export_ssh_keys(*args, **kwargs): try: remote.execute("update-auth") except remote.NonZeroExitStatus as e: raise Exception("Could not export ssh-keys: %s" % e)