- checkout - export - info - switch - update :return: A list of command line arguments to pass to ``svn``. """ if not self.use_interactive: # --non-interactive switch is available since Subversion 0.14.4. # Subversion < 1.8 runs in interactive mode by default. return ['--non-interactive'] svn_version = self.get_vcs_version() # By default, Subversion >= 1.8 runs in non-interactive mode if # stdin is not a TTY. Since that is how pip invokes SVN, in # call_subprocess(), pip must pass --force-interactive to ensure # the user can be prompted for a password, if required. # SVN added the --force-interactive option in SVN 1.8. Since # e.g. RHEL/CentOS 7, which is supported until 2024, ships with # SVN 1.7, pip should continue to support SVN 1.7. Therefore, pip # can't safely add the option if the SVN version is < 1.8 (or unknown). if svn_version >= (1, 8): return ['--force-interactive'] return [] vcs.register(Subversion)
url, rev, user_pass = super(Git, self).get_url_rev_and_auth(url) return url, rev, user_pass def update_submodules(self, location): if not os.path.exists(os.path.join(location, ".gitmodules")): return self.run_command( ["submodule", "update", "--init", "--recursive", "-q"], cwd=location, ) @classmethod def controls_location(cls, location): if super(Git, cls).controls_location(location): return True try: r = cls.run_command(["rev-parse"], cwd=location, show_stdout=False, on_returncode="ignore") return not r except BadCommand: logger.debug( "could not determine if %s is under git control " "because git is not available", location) return False vcs.register(Git)
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 return None @classmethod def get_revision(cls, location): revision = cls.run_command(["revno"], show_stdout=False, cwd=location) return revision.splitlines()[-1] @classmethod def get_src_requirement(cls, location, project_name): repo = cls.get_remote_url(location) if not repo: return None if not repo.lower().startswith("bzr:"): repo = "bzr+" + repo current_rev = cls.get_revision(location) return make_vcs_requirement_url(repo, current_rev, project_name) def is_commit_id_equal(self, dest, name): """Always assume the versions don't match""" return False vcs.register(Bazaar)
return url.strip() def get_revision(self, location): current_revision = self.run_command( ["parents", "--template={rev}"], show_stdout=False, cwd=location ).strip() return current_revision def get_revision_hash(self, location): current_rev_hash = self.run_command( ["parents", "--template={node}"], show_stdout=False, cwd=location ).strip() return current_rev_hash def get_src_requirement(self, dist, location): repo = self.get_url(location) if not repo.lower().startswith("hg:"): repo = "hg+" + repo egg_project_name = dist.egg_name().split("-", 1)[0] if not repo: return None current_rev_hash = self.get_revision_hash(location) return "%s@%s#egg=%s" % (repo, current_rev_hash, egg_project_name) def is_commit_id_equal(self, dest, name): """Always assume the versions don't match""" return False vcs.register(Mercurial)
else: url, rev = super(Git, self).get_url_rev() return url, rev def update_submodules(self, location): if not os.path.exists(os.path.join(location, '.gitmodules')): return self.run_command( ['submodule', 'update', '--init', '--recursive', '-q'], cwd=location, ) @classmethod def controls_location(cls, location): if super(Git, cls).controls_location(location): return True try: r = cls().run_command(['rev-parse'], cwd=location, show_stdout=False, on_returncode='ignore') return not r except BadCommand: logger.debug("could not determine if %s is under git control " "because git is not available", location) return False vcs.register(Git)
) url = _svn_info_xml_url_re.search(xml).group(1) revs = [ int(m.group(1)) for m in _svn_info_xml_rev_re.finditer(xml) ] except InstallationError: url, revs = None, [] if revs: rev = max(revs) else: rev = 0 return url, rev def get_src_requirement(self, dist, location): repo = self.get_url(location) if repo is None: return None # FIXME: why not project name? egg_project_name = dist.egg_name().split('-', 1)[0] rev = self.get_revision(location) return 'svn+%s@%s#egg=%s' % (repo, rev, egg_project_name) def is_commit_id_equal(self, dest, name): """Always assume the versions don't match""" return False vcs.register(Subversion)
return url, rev, user_pass @classmethod def get_remote_url(cls, location): urls = cls.run_command(['info'], show_stdout=False, 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 return None @classmethod def get_revision(cls, location): revision = cls.run_command( ['revno'], show_stdout=False, cwd=location, ) return revision.splitlines()[-1] @classmethod def is_commit_id_equal(cls, dest, name): """Always assume the versions don't match""" return False vcs.register(Bazaar)
return url.strip() def get_revision(self, location): current_revision = self.run_command( ['parents', '--template={rev}'], show_stdout=False, cwd=location).strip() return current_revision def get_revision_hash(self, location): current_rev_hash = self.run_command( ['parents', '--template={node}'], show_stdout=False, cwd=location).strip() return current_rev_hash def get_src_requirement(self, dist, location): repo = self.get_url(location) if not repo.lower().startswith('hg:'): repo = 'hg+' + repo egg_project_name = dist.egg_name().split('-', 1)[0] if not repo: return None current_rev_hash = self.get_revision_hash(location) return '%s@%s#egg=%s' % (repo, current_rev_hash, egg_project_name) def check_version(self, dest, rev_options): """Always assume the versions don't match""" return False vcs.register(Mercurial)