def create_local_module(self): """Creates the folder structure and files in a cloned git repository. This will use the file creation specified in :meth:`~dls_ade.module_template.ModuleTemplate.create_files`. Raises: :class:`~dls_ade.exceptions.ArgumentError`: From \ :meth:`~dls_ade.module_template.ModuleTemplate.create_files` OSError: From \ :meth:`~dls_ade.module_template.ModuleTemplate.create_files` :class:`~dls_ade.exceptions.VCSGitError`: From \ :func:`~dls_ade.vcs_git.stage_all_files_and_commit` """ self.verify_can_create_local_module() self._can_create_local_module = False print("Cloning module to " + self._module_path) vcs_git.clone(self._server_repo_path, self.abs_module_path) os.chdir(self.abs_module_path) self._module_template.create_files() os.chdir(self._cwd) commit_message = ("Added app, {app_name:s}, to module.".format( app_name=self._app_name )) vcs_git.stage_all_files_and_commit(self.abs_module_path, commit_message)
def main(): parser = make_parser() args = parser.parse_args() if args.module_name == "": answer = raw_input("Would you like to checkout the whole " + args.area + " area? This may take some time. Enter Y or N: ") if answer.upper() != "Y": return check_technical_area(args.area, args.module_name) module = args.module_name if module == "": # Set source to area folder source = pathf.dev_area_path(args.area) else: # Set source to module in area folder source = pathf.dev_module_path(module, args.area) if module == "": print("Checking out entire " + args.area + " area...\n") vcs_git.clone_multi(source) elif module.endswith('/') and args.area == 'ioc': print("Checking out " + module + " technical area...") vcs_git.clone_multi(source) else: print("Checking out " + module + " from " + args.area + " area...") repo = vcs_git.clone(source, module) if args.branch: # Get branches list branches = vcs_git.list_remote_branches(repo) if args.branch in branches: vcs_git.checkout_remote_branch(args.branch, repo) else: # Invalid branch name, print branches list and exit print("Branch '" + args.branch + "' does not exist in " + source + "\nBranch List:\n") for entry in branches: print(entry)