Exemplo n.º 1
0
        """
        return None

    def allows_relative_in_repo(self):
        return True         # Strangely enough

    def get_file_content(self, url, verbose=True):
        """
        Retrieve a file's content via Subversion.
        """
        source_path = _decode_file_url(url)
        with open(source_path) as fd:
            return fd.read()

def _decode_file_url(url):
    result = urlparse.urlparse(url)
    if result.scheme not in ('', 'file'):
        raise utils.GiveUp("'%s' is not a valid 'file:' URL"%url)
    if result.netloc:
        raise utils.GiveUp("'%s' is not a valid 'file:' URL - wrong number"
                " of '/' characters?"%url)
    if result.params or result.query or result.fragment:
        raise utils.GiveUp("'%s' is not a valid 'file:' URL - don't understand"
                " params, query or fragment"%url)
    return result.path

# Tell the version control handler about us..
register_vcs("file", File(), __doc__)

# End file.
Exemplo n.º 2
0
        except utils.GiveUp as e:
            raise utils.GiveUp('%s: %s' % (co_leaf, e))

    def _just_revno(self):
        """
        This returns the revision number for the working tree
        """
        retcode, revision = self._run2('bzr revno --tree')
        return revision.strip()

    def allows_relative_in_repo(self):
        return False

    def get_file_content(self, url, verbose=True):
        """
        Retrieve a file's content via BZR.
        """
        retcode, text = self._run2('bzr cat %s' % self._normalised_repo(url),
                                   fold_stderr=False,
                                   verbose=verbose)
        return text

    def get_vcs_special_files(self):
        return ['.bzr', '.bzrignore']


# Tell the version control handler about us..
register_vcs("bzr", Bazaar(), __doc__)

# End file.
Exemplo n.º 3
0
            # Should we try this first, and only "fall back" to the pure
            # SHA1 object name if it fails, or is the pure SHA1 object name
            # better?
            try:
                revision = self._git_describe_long(co_leaf, orig_revision,
                                                   force, verbose)
            except GiveUp:
                revision = self._calculate_revision(co_leaf, orig_revision,
                                                    force, verbose)
        else:
            revision = self._calculate_revision(co_leaf, orig_revision, force,
                                                before, verbose)
        return revision

    def allows_relative_in_repo(self):
        """TODO: Check that this is correct!
        """
        return False

    def get_vcs_special_files(self):
        return ['.git', '.gitignore', '.gitmodules']

    # I can't see any way to do 'get_file_content', but this needs
    # reinvestigating periodically


# Tell the version control handler about us..
register_vcs("git", Git(), __doc__)

# End file.
Exemplo n.º 4
0
                rr = 'HEAD'
            rev = self._calculate_revision(self, rr)
            # Now get the version we have .. 
            rev2 = self._calculate_revision(self, 'HEAD')
            if (rev != rev2):
                raise GiveUp("git repo required for %s is revision (%s) %s, but we have %s"%(co_leaf, repo.revision, rev,rev2))
        else:
            # Check out the relevant repo with the right bits in it.
            if repo.branch:
                br = repo.branch
            else:
                br = "master"
            # Because there are files here, we need to be a bit cunning.
            utils.run0("git init")
            utils.run0("git remote add origin %s"%repo.base_url)
            utils.run0("git fetch origin")
            if repo.revision:
                rev = repo.revision
                br = None
            else:
                rev = "HEAD"
            if (br is None):
                utils.run0("git checkout %s"%repo.revision)
            else:
                utils.run0("git checkout -b %s --track origin/%s"%(br,br))


register_vcs("weld", Weld(), __doc__)

# End file.
Exemplo n.º 5
0
        try:
            return self._revision_id(env, 'revno:-1')
        except utils.GiveUp as e:
            raise utils.GiveUp('%s: %s'%(co_leaf, e))

    def _just_revno(self):
        """
        This returns the revision number for the working tree
        """
        retcode, revision = self._run2('bzr revno --tree')
        return revision.strip()

    def allows_relative_in_repo(self):
        return False

    def get_file_content(self, url, verbose=True):
        """
        Retrieve a file's content via BZR.
        """
        retcode, text = self._run2('bzr cat %s'%self._normalised_repo(url),
                                   fold_stderr=False, verbose=verbose)
        return text

    def get_vcs_special_files(self):
        return ['.bzr', '.bzrignore']

# Tell the version control handler about us..
register_vcs("bzr", Bazaar(), __doc__)

# End file.
Exemplo n.º 6
0
    def allows_relative_in_repo(self):
        return True  # Strangely enough

    def get_file_content(self, url, verbose=True):
        """
        Retrieve a file's content via Subversion.
        """
        source_path = _decode_file_url(url)
        with open(source_path) as fd:
            return fd.read()


def _decode_file_url(url):
    result = urlparse.urlparse(url)
    if result.scheme not in ('', 'file'):
        raise utils.GiveUp("'%s' is not a valid 'file:' URL" % url)
    if result.netloc:
        raise utils.GiveUp("'%s' is not a valid 'file:' URL - wrong number"
                           " of '/' characters?" % url)
    if result.params or result.query or result.fragment:
        raise utils.GiveUp("'%s' is not a valid 'file:' URL - don't understand"
                           " params, query or fragment" % url)
    return result.path


# Tell the version control handler about us..
register_vcs("file", File(), __doc__)

# End file.
Exemplo n.º 7
0
            # Now get the version we have ..
            rev2 = self._calculate_revision(self, 'HEAD')
            if (rev != rev2):
                raise GiveUp(
                    "git repo required for %s is revision (%s) %s, but we have %s"
                    % (co_leaf, repo.revision, rev, rev2))
        else:
            # Check out the relevant repo with the right bits in it.
            if repo.branch:
                br = repo.branch
            else:
                br = "master"
            # Because there are files here, we need to be a bit cunning.
            utils.run0("git init")
            utils.run0("git remote add origin %s" % repo.base_url)
            utils.run0("git fetch origin")
            if repo.revision:
                rev = repo.revision
                br = None
            else:
                rev = "HEAD"
            if (br is None):
                utils.run0("git checkout %s" % repo.revision)
            else:
                utils.run0("git checkout -b %s --track origin/%s" % (br, br))


register_vcs("weld", Weld(), __doc__)

# End file.
Exemplo n.º 8
0
    def _just_revno(self):
        """
        This returns the revision number for the working tree
        """
        revision = utils.get_cmd_data('svnversion')
        return revision.strip()

    def allows_relative_in_repo(self):
        return True

    def get_vcs_special_files(self):
        return ['.svn']

    def get_file_content(self, url, verbose=True):
        """
        Retrieve a file's content via Subversion.
        """
        text = utils.get_cmd_data('svn cat %s'%url, show_command=verbose)
        return text

    def must_pull_before_commit(self, options):
        """
        Subversion recommends doing 'commit' before "pull" (i.e., pull/update)
        """
        return True

# Tell the version control handler about us..
register_vcs("svn", Subversion(), __doc__)

# End file.
Exemplo n.º 9
0
            orig_revision = 'HEAD'

        if False:
            # Should we try this first, and only "fall back" to the pure
            # SHA1 object name if it fails, or is the pure SHA1 object name
            # better?
            try:
                revision = self._git_describe_long(co_leaf, orig_revision, force, verbose)
            except GiveUp:
                revision = self._calculate_revision(co_leaf, orig_revision, force, verbose)
        else:
            revision = self._calculate_revision(co_leaf, orig_revision, force,
                                                before, verbose)
        return revision

    def allows_relative_in_repo(self):
        """TODO: Check that this is correct!
        """
        return False

    def get_vcs_special_files(self):
        return ['.git', '.gitignore', '.gitmodules']

    # I can't see any way to do 'get_file_content', but this needs
    # reinvestigating periodically

# Tell the version control handler about us..
register_vcs("git", Git(), __doc__)

# End file.