(self, dest, url)
Install or update in editable mode the package represented by this
        VersionControl object.

        :param dest: the repository directory in which to install or update.
        :param url: the repository URL starting with a vcs prefix.
Install or update in editable mode the package represented by this
        VersionControl object.
Install or update in editable mode the package represented by this VersionControl object .
def obtain(self, dest, url):
        # type: (str, str) -> None
        """
        Install or update in editable mode the package represented by this
        VersionControl object.

        :param dest: the repository directory in which to install or update.
        :param url: the repository URL starting with a vcs prefix.
        """
        url, rev_options = self.get_url_rev_options(url)

        if not os.path.exists(dest):
            self.fetch_new(dest, url, rev_options)
            return

        rev_display = rev_options.to_display()
        if self.is_repository_directory(dest):
            existing_url = self.get_remote_url(dest)
            if self.compare_urls(existing_url, url):
                logger.debug(
                    '%s in %s exists, and has correct URL (%s)',
                    self.repo_name.title(),
                    display_path(dest),
                    url,
                )
                if not self.is_commit_id_equal(dest, rev_options.rev):
                    logger.info(
                        'Updating %s %s%s',
                        display_path(dest),
                        self.repo_name,
                        rev_display,
                    )
                    self.update(dest, url, rev_options)
                else:
                    logger.info('Skipping because already up-to-date.')
                return

            logger.warning(
                '%s %s in %s exists with URL %s',
                self.name,
                self.repo_name,
                display_path(dest),
                existing_url,
            )
            prompt = ('(s)witch, (i)gnore, (w)ipe, (b)ackup ',
                      ('s', 'i', 'w', 'b'))
        else:
            logger.warning(
                'Directory %s already exists, and is not a %s %s.',
                dest,
                self.name,
                self.repo_name,
            )
            # https://github.com/python/mypy/issues/1174
            prompt = ('(i)gnore, (w)ipe, (b)ackup ',  # type: ignore
                      ('i', 'w', 'b'))

        logger.warning(
            'The plan is to install the %s repository %s',
            self.name,
            url,
        )
        response = ask_path_exists('What to do?  %s' % prompt[0], prompt[1])

        if response == 'a':
            sys.exit(-1)

        if response == 'w':
            logger.warning('Deleting %s', display_path(dest))
            rmtree(dest)
            self.fetch_new(dest, url, rev_options)
            return

        if response == 'b':
            dest_dir = backup_dir(dest)
            logger.warning(
                'Backing up %s to %s', display_path(dest), dest_dir,
            )
            shutil.move(dest, dest_dir)
            self.fetch_new(dest, url, rev_options)
            return

        # Do nothing if the response is "i".
        if response == 's':
            logger.info(
                'Switching %s %s to %s%s',
                self.repo_name,
                display_path(dest),
                url,
                rev_display,
            )
            self.switch(dest, url, rev_options)
def obtain ( self , dest , url ) : # type: (str, str) -> None url , rev_options = self . get_url_rev_options ( url ) if not os . path . exists ( dest ) : self . fetch_new ( dest , url , rev_options ) return rev_display = rev_options . to_display ( ) if self . is_repository_directory ( dest ) : existing_url = self . get_remote_url ( dest ) if self . compare_urls ( existing_url , url ) : logger . debug ( '%s in %s exists, and has correct URL (%s)' , self . repo_name . title ( ) , display_path ( dest ) , url , ) if not self . is_commit_id_equal ( dest , rev_options . rev ) : logger . info ( 'Updating %s %s%s' , display_path ( dest ) , self . repo_name , rev_display , ) self . update ( dest , url , rev_options ) else : logger . info ( 'Skipping because already up-to-date.' ) return logger . warning ( '%s %s in %s exists with URL %s' , self . name , self . repo_name , display_path ( dest ) , existing_url , ) prompt = ( '(s)witch, (i)gnore, (w)ipe, (b)ackup ' , ( 's' , 'i' , 'w' , 'b' ) ) else : logger . warning ( 'Directory %s already exists, and is not a %s %s.' , dest , self . name , self . repo_name , ) # https://github.com/python/mypy/issues/1174 prompt = ( '(i)gnore, (w)ipe, (b)ackup ' , # type: ignore ( 'i' , 'w' , 'b' ) ) logger . warning ( 'The plan is to install the %s repository %s' , self . name , url , ) response = ask_path_exists ( 'What to do?  %s' % prompt [ 0 ] , prompt [ 1 ] ) if response == 'a' : sys . exit ( - 1 ) if response == 'w' : logger . warning ( 'Deleting %s' , display_path ( dest ) ) rmtree ( dest ) self . fetch_new ( dest , url , rev_options ) return if response == 'b' : dest_dir = backup_dir ( dest ) logger . warning ( 'Backing up %s to %s' , display_path ( dest ) , dest_dir , ) shutil . move ( dest , dest_dir ) self . fetch_new ( dest , url , rev_options ) return # Do nothing if the response is "i". if response == 's' : logger . info ( 'Switching %s %s to %s%s' , self . repo_name , display_path ( dest ) , url , rev_display , ) self . switch ( dest , url , rev_options )