Example #1
0
def escape_svn_path(x):
    """Escape a Subversion path for use in a revision identifier.

    :param x: Path
    :return: Escaped path
    """
    x = osutils.safe_utf8(x)
    return urllib.quote(x, "")
Example #2
0
    def get_values(self, path, kwargs, headers):
        history = self._history

        revid = urlutils.unquote_to_bytes(osutils.safe_utf8(self.args[0]))

        change = history.get_changes([revid])[0]
        file_changes = history.get_file_changes(change)
        history.add_branch_nicks(change)

        return {
            'entry': change,
            'file_changes': file_changes,
            'revid': revid,
        }
Example #3
0
_Adduser = dict(
    base_pot=osutils.safe_utf8(r"""# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: 2007-01-17 21:50+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <*****@*****.**>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"

#. everyone can issue "--help" and "--version", but only root can go on
#: ../adduser:135
msgid "Only root may add a user or group to the system.\n"
msgstr ""

#: ../adduser:188
msgid "Warning: The home dir you specified already exists.\n"
msgstr ""

"""),
    this_pot=osutils.safe_utf8(r"""# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
Example #4
0
    def get_values(self, path, kwargs, headers):
        history = self._history
        branch = history._branch
        revid = self.get_revid()
        file_id = kwargs.get('file_id', None)
        if file_id is not None:
            file_id = urlutils.unquote_to_bytes(osutils.safe_utf8(file_id))
        if (file_id is None) and (path is None):
            raise HTTPBadRequest('No file_id or filename '
                                 'provided to view')

        try:
            if file_id is None:
                file_id = history.get_file_id(revid, path)
            if path is None:
                path = history.get_path(revid, file_id)
        except (NoSuchId, NoSuchRevision):
            raise HTTPNotFound()

        filename = os.path.basename(path)

        change = history.get_changes([revid])[0]
        # If we're looking at the tip, use head: in the URL instead
        if revid == branch.last_revision():
            revno_url = 'head:'
        else:
            revno_url = history.get_revno(revid)

        # Directory Breadcrumbs
        directory_breadcrumbs = (
            util.directory_breadcrumbs(
                self._branch.friendly_name,
                self._branch.is_root,
                'files'))

        tree = history.revision_tree(revid)

        # Create breadcrumb trail for the path within the branch
        branch_breadcrumbs = util.branch_breadcrumbs(path, tree, 'files')

        try:
            if tree.kind(path) == "directory":
                raise HTTPMovedPermanently(
                    self._branch.context_url(['/files', revno_url, path]))
        except NoSuchFile:
            raise HTTPNotFound()

        # no navbar for revisions
        navigation = util.Container()

        return {
            # In AnnotateUI, "annotated" is a dictionary mapping lines to
            # changes.  We exploit the fact that bool({}) is False when
            # checking whether we're in "annotated" mode.
            'annotated': {},
            'revno_url': revno_url,
            'file_id': file_id,
            'file_path': path,
            'filename': filename,
            'navigation': navigation,
            'change': change,
            'contents':  self.file_contents(path, revid),
            'fileview_active': True,
            'directory_breadcrumbs': directory_breadcrumbs,
            'branch_breadcrumbs': branch_breadcrumbs,
        }