Returns (url, revision), where both are strings
17510
def get_info(self, location):
        """"""
        assert not location.rstrip('/').endswith(self.dirname), 'Bad directory: %s' % location
        output = call_subprocess(
            [self.cmd, 'info', location], show_stdout=False, extra_environ={'LANG': 'C'})
        match = _svn_url_re.search(output)
        if not match:
            logger.warn('Cannot determine URL of svn checkout %s' % display_path(location))
            logger.info('Output that cannot be parsed: \n%s' % output)
            return None, None
        url = match.group(1).strip()
        match = _svn_revision_re.search(output)
        if not match:
            logger.warn('Cannot determine revision of svn checkout %s' % display_path(location))
            logger.info('Output that cannot be parsed: \n%s' % output)
            return url, None
        return url, match.group(1)
1354655
def urls(self, version=None):
        """"""
        urls = []
        for base_url, routes in self.api.http.routes.items():
            for url, methods in routes.items():
                for method, versions in methods.items():
                    for interface_version, interface in versions.items():
                        if interface_version == version and interface == self:
                            if not url in urls:
                                urls.append(('/v{0}'.format(version) if version else '') + url)
        return urls
781294
def _get_url(method,
             api_url,
             api_version):
    '''
    
    '''
    return '{url}/{version}/{method}.json'.format(url=api_url,
                                                  version=float(api_version),
                                                  method=method)
119693
def version_parts(version):
    
    m = re.match(r'(\d+(?:\.\d+)*)([.%]|$)(.*)', version)
    if m:
        numver = m.group(1)
        rest = m.group(2) + m.group(3)
        return numver, rest
    else:
        return version, ''
648428
def resource_url(self, entity_id, name, revision):
        '''
        
        '''
        return '{}/{}/resource/{}/{}'.format(self.url,
                                             _get_path(entity_id),
                                             name,
                                             revision)
230041
def get_last_changed_revision(client, url):
    
    try:
        svn_entries = client.info2(url,
                                   pysvn.Revision(pysvn.opt_revision_kind.head),
                                   recurse=False)
        if not svn_entries:
            raise ReleaseVCSError("svn.info2() returned no results on url %s" % url)
        return svn_entries[0][1].last_changed_rev
    except pysvn.ClientError, ce:
        raise ReleaseVCSError("svn.info2() raised ClientError: %s" % ce)
1326334
def _get_version_from_url(self, url):
        '''
        
        '''
        regex = re.compile(r"^https?:\/\/.*\/(v[0-9])(\.[0-9])?(\/)?$")
        try:
            ver = regex.match(url)
            if ver.group(1):
                retver = ver.group(1)
                if ver.group(2):
                    retver = retver + ver.group(2)
            return retver
        except AttributeError:
            return ''
161564
def on_revert(request, page_name):
    """"""
    rev_id = request.args.get("rev", type=int)

    old_revision = page = None
    error = "No such revision"

    if request.method == "POST" and request.form.get("cancel"):
        return redirect(href(page_name))

    if rev_id:
        old_revision = Revision.query.filter(
            (Revision.revision_id == rev_id)
            & (Revision.page_id == Page.page_id)
            & (Page.name == page_name)
        ).first()
        if old_revision:
            new_revision = (
                Revision.query.filter(
                    (Revision.page_id == Page.page_id) & (Page.name == page_name)
                )
                .order_by(Revision.revision_id.desc())
                .first()
            )
            if old_revision == new_revision:
                error = "You tried to revert the current active revision."
            elif old_revision.text == new_revision.text:
                error = (
                    "There are no changes between the current "
                    "revision and the revision you want to "
                    "restore."
                )
            else:
                error = ""
                page = old_revision.page
                if request.method == "POST":
                    change_note = request.form.get("change_note", "")
                    change_note = "revert" + (change_note and ": " + change_note or "")
                    session.add(Revision(page, old_revision.text, change_note))
                    session.commit()
                    return redirect(href(page_name))

    return Response(
        generate_template(
            "action_revert.html", error=error, old_revision=old_revision, page=page
        )
    )
283454
def revision(directory, message, autogenerate, sql, head, splice, branch_label,
             version_path, rev_id):
    """"""
    _revision(directory, message, autogenerate, sql, head, splice,
              branch_label, version_path, rev_id)
1045630
def uri_from_parts(parts):
    ""
    uri = "%s://%s%s" % (parts[0], parts[1], parts[2])
    if parts[3]:
        extra = '?'+urlencode(parts[3])
        uri += extra
    return uri
89921
def short_str(self):
        
        if self.version is None and self.url is None:
            return ''
        return '%s <%s>' % (self.version, self.url)
1005416
def split(self, url):
        
        parts = url.split('://', 1)
        if len(parts) == 2:
            return parts
        else:
            return (None, url)
671411
def get_text(revision, strip=True):
  
  # text start tag looks like "<text ..otherstuff>"
  start_pos = revision.find("<text")
  assert start_pos != -1
  end_tag_pos = revision.find(">", start_pos)
  assert end_tag_pos != -1
  end_tag_pos += len(">")
  end_pos = revision.find("</text>")
  if end_pos == -1:
    ret = ""
  else:
    ret = revision[end_tag_pos:end_pos]
  if strip:
    ret = strip_text(ret)
  ret = text_encoder.to_unicode_utf8(ret)
  return ret
534686
def versioned_url(self):
        ''''''
        if self.url is None:
            return None
        return self.url.format(version=self.version)
1042728
def get(self, request, uri):
        
        uri = self.decode_uri(uri)
        revisions = cio.revisions(uri)
        revisions = [list(revision) for revision in revisions]  # Convert tuples to lists
        return self.render_to_json(revisions)
721468
def urljoin(*fragments):
    """"""
    # Strip possible already existent final slashes of fragments except for the last one
    parts = [fragment.rstrip('/') for fragment in fragments[:len(fragments) - 1]]
    parts.append(fragments[-1])

    return '/'.join(parts)
834796
def getUrlList():
    
    """
    IF YOU WANT REBUILD YOUR STRUCTURE UNCOMMENT THE FOLLOWING LINE
    """
    #Node.rebuild()

    set_to_return = []
    set_url = []

    roots = Node.objects.filter(parent__isnull=True)
    for root in roots:
        nodes = root.get_descendants()
        for node in nodes:
            if node.page:
                page = node.page
                view = page.view
                regex = r'^{0}$'.format(node.get_pattern())
                regex_path = '{0}'.format(node.get_pattern())
                view = u'{0}.{1}.{2}'.format(view.app_name, view.module_name, view.func_name)
                """
                check_static_vars add UPY_CONTEXT to page
                """
                page.check_static_vars(node)
                app_url = url(regex, view, page.static_vars, page.scheme_name)
                set_to_return.append(app_url)
                set_url.append(regex_path)
                if node.is_index:
                    regex = r'^$'
                    regex_path = ''
                    app_url = url(regex, view, page.static_vars, page.scheme_name)
                    set_to_return.append(app_url)
                    set_url.append(regex_path)
    return set_to_return, set_url