Пример #1
0
    def __init__(self, path, revision):
        """
        @type   path: string
        @param  path: The path to open

        @type   revision: string
        @param  revision: The revision of the file to open

        """

        InterfaceNonView.__init__(self)

        self.vcs = rabbitvcs.vcs.VCS()
        self.git = self.vcs.git(path)

        if revision:
            revision_obj = self.git.revision(revision)
        else:
            revision_obj = self.git.revision("HEAD")

        dest_dir = helper.get_tmp_path("rabbitvcs-" + helper.to_text(revision))

        self.git.export(path, dest_dir, revision=revision_obj)

        repo_path = self.git.find_repository_path(path)
        relative_path = path
        if path.startswith(repo_path):
            relative_path = path[len(repo_path) + 1:]

        dest_path = "%s/%s" % (dest_dir, relative_path)

        helper.open_item(dest_path)

        raise SystemExit()
Пример #2
0
    def __init__(self, path, revision):
        """
        @type   path: string
        @param  path: The path to open

        @type   revision: string
        @param  revision: The revision of the file to open

        """

        InterfaceNonView.__init__(self)

        self.vcs = rabbitvcs.vcs.VCS()
        self.svn = self.vcs.svn()

        if revision and type(revision) in (str, six.text_type):
            revision_obj = self.svn.revision("number", number=revision)
        else:
            revision_obj = self.svn.revision("HEAD")

        url = path
        if not self.svn.is_path_repository_url(path):
            url = self.svn.get_repo_root_url(path) + '/' + path
        dest = helper.get_tmp_path("rabbitvcs-" + revision + "-" +
                                   os.path.basename(path))

        self.svn.export(url, dest, revision=revision_obj, force=True)

        helper.open_item(dest)

        raise SystemExit()
Пример #3
0
    def __init__(self, path, revision):
        """
        @type   path: string
        @param  path: The path to open

        @type   revision: string
        @param  revision: The revision of the file to open

        """

        InterfaceNonView.__init__(self)

        self.vcs = rabbitvcs.vcs.VCS()
        self.svn = self.vcs.svn()

        if revision and type(revision) in (str, six.text_type):
            revision_obj = self.svn.revision("number", number=revision)
        else:
            revision_obj = self.svn.revision("HEAD")

        url = path
        if not self.svn.is_path_repository_url(path):
            url = self.svn.get_repo_root_url(path) + '/' + path
        dest = helper.get_tmp_path("rabbitvcs-" + revision + "-" + os.path.basename(path))

        self.svn.export(
            url,
            dest,
            revision=revision_obj,
            force=True
        )

        helper.open_item(dest)

        raise SystemExit()
Пример #4
0
    def _build_export_path(self, index, revision, path):
        dest = helper.get_tmp_path(
            "rabbitvcs-%s-%s-%s" %
            (str(index), str(revision)[:5], os.path.basename(path)))
        if os.path.exists(dest):
            if os.path.isdir(dest):
                rmtree(dest, ignore_errors=True)
            else:
                os.remove(dest)

        return dest
Пример #5
0
    def _open(self, paths):
        self.action = rabbitvcs.ui.action.SVNAction(
            self.svn,
            notification=False
        )

        exported_paths = []
        for path in paths:
            export_path = helper.get_tmp_path(os.path.basename(paths[0]))
            exported_paths.append(export_path)
            self.action.append(self.svn.export, paths[0],
                export_path, revision=self.revision_selector.get_revision_object())

        for path in exported_paths:
            self.action.append(helper.open_item, path)

        self.action.schedule()
Пример #6
0
    def __init__(self, path, revision):
        """
        @type   path: string
        @param  path: The path to open

        @type   revision: string
        @param  revision: The revision of the file to open

        """

        InterfaceNonView.__init__(self)

        self.vcs = rabbitvcs.vcs.VCS()
        self.git = self.vcs.git(path)

        if revision:
            revision_obj = self.git.revision(revision)
        else:
            revision_obj = self.git.revision("HEAD")

        dest_dir = helper.get_tmp_path("rabbitvcs-" + helper.to_text(revision))

        self.git.export(
            path,
            dest_dir,
            revision=revision_obj
        )

        repo_path = self.git.find_repository_path(path)
        relative_path = path
        if path.startswith(repo_path):
            relative_path = path[len(repo_path)+1:]

        dest_path = "%s/%s" % (dest_dir, relative_path)

        helper.open_item(dest_path)

        raise SystemExit()