self.get_remote_call_options(), rev_options.to_args(), url, dest, ) self.run_command(cmd_args) def switch(self, dest, url, rev_options): # type: (str, HiddenText, RevOptions) -> None cmd_args = make_command( 'switch', self.get_remote_call_options(), rev_options.to_args(), url, dest, ) self.run_command(cmd_args) def update(self, dest, url, rev_options): # type: (str, HiddenText, RevOptions) -> None cmd_args = make_command( 'update', self.get_remote_call_options(), rev_options.to_args(), dest, ) self.run_command(cmd_args) vcs.register(Subversion)
).strip() if not os.path.isabs(repo_root): repo_root = os.path.abspath(os.path.join(location, repo_root)) return find_path_to_project_root_from_repo_root(location, repo_root) @classmethod def get_repository_root(cls, location): # type: (str) -> Optional[str] loc = super().get_repository_root(location) if loc: return loc try: r = cls.run_command( ['root'], cwd=location, show_stdout=False, stdout_only=True, on_returncode='raise', log_failed_cmd=False, ) except BadCommand: logger.debug("could not determine if %s is under hg control " "because hg is not available", location) return None except InstallationError: return None return os.path.normpath(r.rstrip('\r\n')) vcs.register(Mercurial)
cwd=location) for line in urls.splitlines(): line = line.strip() for x in ('checkout of branch: ', 'parent branch: '): if line.startswith(x): repo = line.split(x)[1] if cls._is_local_repository(repo): return path_to_url(repo) return repo raise RemoteNotFoundError @classmethod def get_revision(cls, location): # type: (str) -> str revision = cls.run_command( ['revno'], show_stdout=False, stdout_only=True, cwd=location, ) return revision.splitlines()[-1] @classmethod def is_commit_id_equal(cls, dest, name): # type: (str, Optional[str]) -> bool """Always assume the versions don't match""" return False vcs.register(Bazaar)
loc = super().get_repository_root(location) if loc: return loc try: r = cls.run_command( ["rev-parse", "--show-toplevel"], cwd=location, show_stdout=False, stdout_only=True, on_returncode="raise", log_failed_cmd=False, ) except BadCommand: logger.debug( "could not determine if %s is under git control " "because git is not available", location, ) return None except InstallationError: return None return os.path.normpath(r.rstrip("\r\n")) @staticmethod def should_add_vcs_url_prefix(repo_url: str) -> bool: """In either https or ssh form, requirements must be prefixed with git+.""" return True vcs.register(Git)