Changeset - 06e49be38d78
kallithea/controllers/bookmarks.py
Show inline comments
 
@@ -41,18 +41,18 @@ class BookmarksController(BaseRepoContro
 
        super(BookmarksController, self).__before__()
 

	
 
    @LoginRequired()
 
    @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
 
                                   'repository.admin')
 
    def index(self):
 
        if c.rhodecode_repo.alias != 'hg':
 
        if c.db_repo_scm_instance.alias != 'hg':
 
            raise HTTPNotFound()
 

	
 
        c.repo_bookmarks = OrderedDict()
 

	
 
        bookmarks = [(name, c.rhodecode_repo.get_changeset(hash_)) for \
 
                 name, hash_ in c.rhodecode_repo._repo._bookmarks.items()]
 
        bookmarks = [(name, c.db_repo_scm_instance.get_changeset(hash_)) for \
 
                 name, hash_ in c.db_repo_scm_instance._repo._bookmarks.items()]
 
        ordered_tags = sorted(bookmarks, key=lambda x: x[1].date, reverse=True)
 
        for name, cs_book in ordered_tags:
 
            c.repo_bookmarks[name] = cs_book
 

	
 
        return render('bookmarks/bookmarks.html')
kallithea/controllers/branches.py
Show inline comments
 
@@ -51,25 +51,25 @@ class BranchesController(BaseRepoControl
 
            for bn, heads in localrepo.branchmap().iteritems():
 
                tip = heads[-1]
 
                if 'close' in localrepo.changelog.read(tip)[5]:
 
                    bt_closed[bn] = tip
 
            return bt_closed
 

	
 
        cs_g = c.rhodecode_repo.get_changeset
 
        cs_g = c.db_repo_scm_instance.get_changeset
 

	
 
        c.repo_closed_branches = {}
 
        if c.db_repo.repo_type == 'hg':
 
            bt_closed = _branchtags(c.rhodecode_repo._repo)
 
            bt_closed = _branchtags(c.db_repo_scm_instance._repo)
 
            _closed_branches = [(safe_unicode(n), cs_g(binascii.hexlify(h)),)
 
                                for n, h in bt_closed.items()]
 

	
 
            c.repo_closed_branches = OrderedDict(sorted(_closed_branches,
 
                                                    key=lambda ctx: ctx[0],
 
                                                    reverse=False))
 

	
 
        _branches = [(safe_unicode(n), cs_g(h))
 
                     for n, h in c.rhodecode_repo.branches.items()]
 
                     for n, h in c.db_repo_scm_instance.branches.items()]
 
        c.repo_branches = OrderedDict(sorted(_branches,
 
                                             key=lambda ctx: ctx[0],
 
                                             reverse=False))
 

	
 
        return render('branches/branches.html')
kallithea/controllers/changelog.py
Show inline comments
 
@@ -50,13 +50,13 @@ def _load_changelog_summary():
 
    size = safe_int(request.GET.get('size'), 10)
 

	
 
    def url_generator(**kw):
 
        return url('changelog_summary_home',
 
                   repo_name=c.db_repo.repo_name, size=size, **kw)
 

	
 
    collection = c.rhodecode_repo
 
    collection = c.db_repo_scm_instance
 

	
 
    c.repo_changesets = RepoPage(collection, page=p,
 
                                 items_per_page=size,
 
                                 url=url_generator)
 
    page_revisions = [x.raw_id for x in list(c.repo_changesets)]
 
    c.comments = c.db_repo.get_comments(page_revisions)
 
@@ -78,13 +78,13 @@ class ChangelogController(BaseRepoContro
 

	
 
        :param rev: revision to fetch
 
        :param repo: repo instance
 
        """
 

	
 
        try:
 
            return c.rhodecode_repo.get_changeset(rev)
 
            return c.db_repo_scm_instance.get_changeset(rev)
 
        except EmptyRepositoryError, e:
 
            if not redirect_after:
 
                return None
 
            h.flash(h.literal(_('There are no changesets yet')),
 
                    category='warning')
 
            redirect(url('changelog_home', repo_name=repo.repo_name))
 
@@ -134,38 +134,38 @@ class ChangelogController(BaseRepoContro
 
            c.size = int(session.get('changelog_size', default))
 
        # min size must be 1
 
        c.size = max(c.size, 1)
 
        p = safe_int(request.GET.get('page', 1), 1)
 
        branch_name = request.GET.get('branch', None)
 
        if (branch_name and
 
            branch_name not in c.rhodecode_repo.branches and
 
            branch_name not in c.rhodecode_repo.closed_branches and
 
            branch_name not in c.db_repo_scm_instance.branches and
 
            branch_name not in c.db_repo_scm_instance.closed_branches and
 
            not revision):
 
            return redirect(url('changelog_file_home', repo_name=c.repo_name,
 
                                    revision=branch_name, f_path=f_path or ''))
 

	
 
        c.changelog_for_path = f_path
 
        try:
 

	
 
            if f_path:
 
                log.debug('generating changelog for path %s' % f_path)
 
                # get the history for the file !
 
                tip_cs = c.rhodecode_repo.get_changeset()
 
                tip_cs = c.db_repo_scm_instance.get_changeset()
 
                try:
 
                    collection = tip_cs.get_file_history(f_path)
 
                except (NodeDoesNotExistError, ChangesetError):
 
                    #this node is not present at tip !
 
                    try:
 
                        cs = self.__get_cs_or_redirect(revision, repo_name)
 
                        collection = cs.get_file_history(f_path)
 
                    except RepositoryError, e:
 
                        h.flash(safe_str(e), category='warning')
 
                        redirect(h.url('changelog_home', repo_name=repo_name))
 
                collection = list(reversed(collection))
 
            else:
 
                collection = c.rhodecode_repo.get_changesets(start=0,
 
                collection = c.db_repo_scm_instance.get_changesets(start=0,
 
                                                        branch_name=branch_name)
 
            c.total_cs = len(collection)
 

	
 
            c.pagination = RepoPage(collection, page=p, item_count=c.total_cs,
 
                                    items_per_page=c.size, branch=branch_name,)
 
            collection = list(c.pagination)
 
@@ -179,30 +179,30 @@ class ChangelogController(BaseRepoContro
 
            log.error(traceback.format_exc())
 
            h.flash(safe_str(e), category='error')
 
            return redirect(url('changelog_home', repo_name=c.repo_name))
 

	
 
        c.branch_name = branch_name
 
        c.branch_filters = [('', _('All Branches'))] + \
 
            [(k, k) for k in c.rhodecode_repo.branches.keys()]
 
        if c.rhodecode_repo.closed_branches:
 
            [(k, k) for k in c.db_repo_scm_instance.branches.keys()]
 
        if c.db_repo_scm_instance.closed_branches:
 
            prefix = _('(closed)') + ' '
 
            c.branch_filters += [('-', '-')] + \
 
                [(k, prefix + k) for k in c.rhodecode_repo.closed_branches.keys()]
 
                [(k, prefix + k) for k in c.db_repo_scm_instance.closed_branches.keys()]
 
        _revs = []
 
        if not f_path:
 
            _revs = [x.revision for x in c.pagination]
 
        self._graph(c.rhodecode_repo, _revs, c.total_cs, c.size, p)
 
        self._graph(c.db_repo_scm_instance, _revs, c.total_cs, c.size, p)
 

	
 
        return render('changelog/changelog.html')
 

	
 
    @LoginRequired()
 
    @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
 
                                   'repository.admin')
 
    def changelog_details(self, cs):
 
        if request.environ.get('HTTP_X_PARTIAL_XHR'):
 
            c.cs = c.rhodecode_repo.get_changeset(cs)
 
            c.cs = c.db_repo_scm_instance.get_changeset(cs)
 
            return render('changelog/changelog_details.html')
 
        raise HTTPNotFound()
 

	
 
    @LoginRequired()
 
    @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
 
                                   'repository.admin')
kallithea/controllers/changeset.py
Show inline comments
 
@@ -190,16 +190,16 @@ class ChangesetController(BaseRepoContro
 
        enable_comments = True
 
        try:
 
            if len(rev_range) == 2:
 
                enable_comments = False
 
                rev_start = rev_range[0]
 
                rev_end = rev_range[1]
 
                rev_ranges = c.rhodecode_repo.get_changesets(start=rev_start,
 
                rev_ranges = c.db_repo_scm_instance.get_changesets(start=rev_start,
 
                                                             end=rev_end)
 
            else:
 
                rev_ranges = [c.rhodecode_repo.get_changeset(revision)]
 
                rev_ranges = [c.db_repo_scm_instance.get_changeset(revision)]
 

	
 
            c.cs_ranges = list(rev_ranges)
 
            if not c.cs_ranges:
 
                raise RepositoryError('Changeset range returned empty result')
 

	
 
        except(ChangesetDoesNotExistError,), e:
 
@@ -254,17 +254,17 @@ class ChangesetController(BaseRepoContro
 

	
 
            cs2 = changeset.raw_id
 
            cs1 = changeset.parents[0].raw_id if changeset.parents else EmptyChangeset().raw_id
 
            context_lcl = get_line_ctx('', request.GET)
 
            ign_whitespace_lcl = ign_whitespace_lcl = get_ignore_ws('', request.GET)
 

	
 
            _diff = c.rhodecode_repo.get_diff(cs1, cs2,
 
            _diff = c.db_repo_scm_instance.get_diff(cs1, cs2,
 
                ignore_whitespace=ign_whitespace_lcl, context=context_lcl)
 
            diff_limit = self.cut_off_limit if not fulldiff else None
 
            diff_processor = diffs.DiffProcessor(_diff,
 
                                                 vcs=c.rhodecode_repo.alias,
 
                                                 vcs=c.db_repo_scm_instance.alias,
 
                                                 format='gitdiff',
 
                                                 diff_limit=diff_limit)
 
            cs_changes = OrderedDict()
 
            if method == 'show':
 
                _parsed = diff_processor.prepare()
 
                c.limited_diff = False
 
@@ -438,25 +438,25 @@ class ChangesetController(BaseRepoContro
 
    @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
 
                                   'repository.admin')
 
    @jsonify
 
    def changeset_info(self, repo_name, revision):
 
        if request.is_xhr:
 
            try:
 
                return c.rhodecode_repo.get_changeset(revision)
 
                return c.db_repo_scm_instance.get_changeset(revision)
 
            except ChangesetDoesNotExistError, e:
 
                return EmptyChangeset(message=str(e))
 
        else:
 
            raise HTTPBadRequest()
 

	
 
    @LoginRequired()
 
    @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
 
                                   'repository.admin')
 
    @jsonify
 
    def changeset_children(self, repo_name, revision):
 
        if request.is_xhr:
 
            changeset = c.rhodecode_repo.get_changeset(revision)
 
            changeset = c.db_repo_scm_instance.get_changeset(revision)
 
            result = {"results": []}
 
            if changeset.children:
 
                result = {"results": changeset.children}
 
            return result
 
        else:
 
            raise HTTPBadRequest()
 
@@ -464,13 +464,13 @@ class ChangesetController(BaseRepoContro
 
    @LoginRequired()
 
    @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
 
                                   'repository.admin')
 
    @jsonify
 
    def changeset_parents(self, repo_name, revision):
 
        if request.is_xhr:
 
            changeset = c.rhodecode_repo.get_changeset(revision)
 
            changeset = c.db_repo_scm_instance.get_changeset(revision)
 
            result = {"results": []}
 
            if changeset.parents:
 
                result = {"results": changeset.parents}
 
            return result
 
        else:
 
            raise HTTPBadRequest()
kallithea/controllers/feed.py
Show inline comments
 
@@ -90,13 +90,13 @@ class FeedController(BaseRepoController)
 
    def __get_desc(self, cs):
 
        desc_msg = [(_('%s committed on %s')
 
                     % (h.person(cs.author), h.fmt_date(cs.date))) + '<br/>']
 
        #branches, tags, bookmarks
 
        if cs.branch:
 
            desc_msg.append('branch: %s<br/>' % cs.branch)
 
        if h.is_hg(c.rhodecode_repo):
 
        if h.is_hg(c.db_repo_scm_instance):
 
            for book in cs.bookmarks:
 
                desc_msg.append('bookmark: %s<br/>' % book)
 
        for tag in cs.tags:
 
            desc_msg.append('tag: %s<br/>' % tag)
 
        diff_processor, changes = self.__changes(cs)
 
        # rev link
 
@@ -125,13 +125,13 @@ class FeedController(BaseRepoController)
 
                          qualified=True),
 
                 description=self.description % repo_name,
 
                 language=self.language,
 
                 ttl=self.ttl
 
            )
 

	
 
            for cs in reversed(list(c.rhodecode_repo[-self.feed_nr:])):
 
            for cs in reversed(list(c.db_repo_scm_instance[-self.feed_nr:])):
 
                feed.add_item(title=self._get_title(cs),
 
                              link=url('changeset_home', repo_name=repo_name,
 
                                       revision=cs.raw_id, qualified=True),
 
                              author_name=cs.author,
 
                              description=''.join(self.__get_desc(cs)),
 
                              pubdate=cs.date,
 
@@ -157,13 +157,13 @@ class FeedController(BaseRepoController)
 
                         qualified=True),
 
                description=self.description % repo_name,
 
                language=self.language,
 
                ttl=self.ttl
 
            )
 

	
 
            for cs in reversed(list(c.rhodecode_repo[-self.feed_nr:])):
 
            for cs in reversed(list(c.db_repo_scm_instance[-self.feed_nr:])):
 
                feed.add_item(title=self._get_title(cs),
 
                              link=url('changeset_home', repo_name=repo_name,
 
                                       revision=cs.raw_id, qualified=True),
 
                              author_name=cs.author,
 
                              description=''.join(self.__get_desc(cs)),
 
                              pubdate=cs.date,
kallithea/controllers/files.py
Show inline comments
 
@@ -77,13 +77,13 @@ class FilesController(BaseRepoController
 

	
 
        :param rev: revision to fetch
 
        :param repo_name: repo name to redirect after
 
        """
 

	
 
        try:
 
            return c.rhodecode_repo.get_changeset(rev)
 
            return c.db_repo_scm_instance.get_changeset(rev)
 
        except EmptyRepositoryError, e:
 
            if not redirect_after:
 
                return None
 
            url_ = url('files_add_home',
 
                       repo_name=c.repo_name,
 
                       revision=0, f_path='', anchor='edit')
 
@@ -140,23 +140,23 @@ class FilesController(BaseRepoController
 
        c.annotate = annotate
 
        c.changeset = self.__get_cs_or_redirect(revision, repo_name)
 
        cur_rev = c.changeset.revision
 

	
 
        # prev link
 
        try:
 
            prev_rev = c.rhodecode_repo.get_changeset(cur_rev).prev(c.branch)
 
            prev_rev = c.db_repo_scm_instance.get_changeset(cur_rev).prev(c.branch)
 
            c.url_prev = url('files_home', repo_name=c.repo_name,
 
                         revision=prev_rev.raw_id, f_path=f_path)
 
            if c.branch:
 
                c.url_prev += '?branch=%s' % c.branch
 
        except (ChangesetDoesNotExistError, VCSError):
 
            c.url_prev = '#'
 

	
 
        # next link
 
        try:
 
            next_rev = c.rhodecode_repo.get_changeset(cur_rev).next(c.branch)
 
            next_rev = c.db_repo_scm_instance.get_changeset(cur_rev).next(c.branch)
 
            c.url_next = url('files_home', repo_name=c.repo_name,
 
                     revision=next_rev.raw_id, f_path=f_path)
 
            if c.branch:
 
                c.url_next += '?branch=%s' % c.branch
 
        except (ChangesetDoesNotExistError, VCSError):
 
            c.url_next = '#'
 
@@ -169,13 +169,13 @@ class FilesController(BaseRepoController
 
                c.load_full_history = False
 
                file_last_cs = c.file.last_changeset
 
                c.file_changeset = (c.changeset
 
                                    if c.changeset.revision < file_last_cs.revision
 
                                    else file_last_cs)
 
                #determine if we're on branch head
 
                _branches = c.rhodecode_repo.branches
 
                _branches = c.db_repo_scm_instance.branches
 
                c.on_branch_head = revision in _branches.keys() + _branches.values()
 
                _hist = []
 
                c.file_history = []
 
                if c.load_full_history:
 
                    c.file_history, _hist = self._get_node_history(c.changeset, f_path)
 

	
 
@@ -399,13 +399,13 @@ class FilesController(BaseRepoController
 

	
 
            if content == old_content:
 
                h.flash(_('No changes'), category='warning')
 
                return redirect(url('changeset_home', repo_name=c.repo_name,
 
                                    revision='tip'))
 
            try:
 
                self.scm_model.commit_change(repo=c.rhodecode_repo,
 
                self.scm_model.commit_change(repo=c.db_repo_scm_instance,
 
                                             repo_name=repo_name, cs=c.cs,
 
                                             user=self.rhodecode_user.user_id,
 
                                             author=author, message=message,
 
                                             content=content, f_path=f_path)
 
                h.flash(_('Successfully committed to %s') % f_path,
 
                        category='success')
 
@@ -431,13 +431,13 @@ class FilesController(BaseRepoController
 
                                  repo_name=repo_name, revision='tip'))
 

	
 
        r_post = request.POST
 
        c.cs = self.__get_cs_or_redirect(revision, repo_name,
 
                                         redirect_after=False)
 
        if c.cs is None:
 
            c.cs = EmptyChangeset(alias=c.rhodecode_repo.alias)
 
            c.cs = EmptyChangeset(alias=c.db_repo_scm_instance.alias)
 
        c.default_message = (_('Added file via RhodeCode'))
 
        c.f_path = f_path
 

	
 
        if r_post:
 
            unix_mode = 0
 
            content = convert_line_endings(r_post.get('content', ''), unix_mode)
 
@@ -518,19 +518,19 @@ class FilesController(BaseRepoController
 

	
 
        try:
 
            dbrepo = RepoModel().get_by_repo_name(repo_name)
 
            if not dbrepo.enable_downloads:
 
                return _('Downloads disabled')
 

	
 
            if c.rhodecode_repo.alias == 'hg':
 
            if c.db_repo_scm_instance.alias == 'hg':
 
                # patch and reset hooks section of UI config to not run any
 
                # hooks on fetching archives with subrepos
 
                for k, v in c.rhodecode_repo._repo.ui.configitems('hooks'):
 
                    c.rhodecode_repo._repo.ui.setconfig('hooks', k, None)
 
                for k, v in c.db_repo_scm_instance._repo.ui.configitems('hooks'):
 
                    c.db_repo_scm_instance._repo.ui.setconfig('hooks', k, None)
 

	
 
            cs = c.rhodecode_repo.get_changeset(revision)
 
            cs = c.db_repo_scm_instance.get_changeset(revision)
 
            content_type = settings.ARCHIVE_SPECS[fileformat][0]
 
        except ChangesetDoesNotExistError:
 
            return _('Unknown revision %s') % revision
 
        except EmptyRepositoryError:
 
            return _('Empty repository')
 
        except (ImproperArchiveTypeError, KeyError):
 
@@ -622,41 +622,41 @@ class FilesController(BaseRepoController
 
                _url = url('files_home', repo_name=c.repo_name,
 
                           revision=diff1, f_path=c.f_path)
 

	
 
            return redirect(_url)
 
        try:
 
            if diff1 not in ['', None, 'None', '0' * 12, '0' * 40]:
 
                c.changeset_1 = c.rhodecode_repo.get_changeset(diff1)
 
                c.changeset_1 = c.db_repo_scm_instance.get_changeset(diff1)
 
                try:
 
                    node1 = c.changeset_1.get_node(f_path)
 
                    if node1.is_dir():
 
                        raise NodeError('%s path is a %s not a file'
 
                                        % (node1, type(node1)))
 
                except NodeDoesNotExistError:
 
                    c.changeset_1 = EmptyChangeset(cs=diff1,
 
                                                   revision=c.changeset_1.revision,
 
                                                   repo=c.rhodecode_repo)
 
                                                   repo=c.db_repo_scm_instance)
 
                    node1 = FileNode(f_path, '', changeset=c.changeset_1)
 
            else:
 
                c.changeset_1 = EmptyChangeset(repo=c.rhodecode_repo)
 
                c.changeset_1 = EmptyChangeset(repo=c.db_repo_scm_instance)
 
                node1 = FileNode(f_path, '', changeset=c.changeset_1)
 

	
 
            if diff2 not in ['', None, 'None', '0' * 12, '0' * 40]:
 
                c.changeset_2 = c.rhodecode_repo.get_changeset(diff2)
 
                c.changeset_2 = c.db_repo_scm_instance.get_changeset(diff2)
 
                try:
 
                    node2 = c.changeset_2.get_node(f_path)
 
                    if node2.is_dir():
 
                        raise NodeError('%s path is a %s not a file'
 
                                        % (node2, type(node2)))
 
                except NodeDoesNotExistError:
 
                    c.changeset_2 = EmptyChangeset(cs=diff2,
 
                                                   revision=c.changeset_2.revision,
 
                                                   repo=c.rhodecode_repo)
 
                                                   repo=c.db_repo_scm_instance)
 
                    node2 = FileNode(f_path, '', changeset=c.changeset_2)
 
            else:
 
                c.changeset_2 = EmptyChangeset(repo=c.rhodecode_repo)
 
                c.changeset_2 = EmptyChangeset(repo=c.db_repo_scm_instance)
 
                node2 = FileNode(f_path, '', changeset=c.changeset_2)
 
        except (RepositoryError, NodeError):
 
            log.error(traceback.format_exc())
 
            return redirect(url('files_home', repo_name=c.repo_name,
 
                                f_path=f_path))
 

	
 
@@ -707,41 +707,41 @@ class FilesController(BaseRepoController
 
                                   'repository.admin')
 
    def diff_2way(self, repo_name, f_path):
 
        diff1 = request.GET.get('diff1', '')
 
        diff2 = request.GET.get('diff2', '')
 
        try:
 
            if diff1 not in ['', None, 'None', '0' * 12, '0' * 40]:
 
                c.changeset_1 = c.rhodecode_repo.get_changeset(diff1)
 
                c.changeset_1 = c.db_repo_scm_instance.get_changeset(diff1)
 
                try:
 
                    node1 = c.changeset_1.get_node(f_path)
 
                    if node1.is_dir():
 
                        raise NodeError('%s path is a %s not a file'
 
                                        % (node1, type(node1)))
 
                except NodeDoesNotExistError:
 
                    c.changeset_1 = EmptyChangeset(cs=diff1,
 
                                                   revision=c.changeset_1.revision,
 
                                                   repo=c.rhodecode_repo)
 
                                                   repo=c.db_repo_scm_instance)
 
                    node1 = FileNode(f_path, '', changeset=c.changeset_1)
 
            else:
 
                c.changeset_1 = EmptyChangeset(repo=c.rhodecode_repo)
 
                c.changeset_1 = EmptyChangeset(repo=c.db_repo_scm_instance)
 
                node1 = FileNode(f_path, '', changeset=c.changeset_1)
 

	
 
            if diff2 not in ['', None, 'None', '0' * 12, '0' * 40]:
 
                c.changeset_2 = c.rhodecode_repo.get_changeset(diff2)
 
                c.changeset_2 = c.db_repo_scm_instance.get_changeset(diff2)
 
                try:
 
                    node2 = c.changeset_2.get_node(f_path)
 
                    if node2.is_dir():
 
                        raise NodeError('%s path is a %s not a file'
 
                                        % (node2, type(node2)))
 
                except NodeDoesNotExistError:
 
                    c.changeset_2 = EmptyChangeset(cs=diff2,
 
                                                   revision=c.changeset_2.revision,
 
                                                   repo=c.rhodecode_repo)
 
                                                   repo=c.db_repo_scm_instance)
 
                    node2 = FileNode(f_path, '', changeset=c.changeset_2)
 
            else:
 
                c.changeset_2 = EmptyChangeset(repo=c.rhodecode_repo)
 
                c.changeset_2 = EmptyChangeset(repo=c.db_repo_scm_instance)
 
                node2 = FileNode(f_path, '', changeset=c.changeset_2)
 
        except (RepositoryError, NodeError):
 
            log.error(traceback.format_exc())
 
            return redirect(url('files_home', repo_name=c.repo_name,
 
                                f_path=f_path))
 
        c.node1 = node1
 
@@ -758,13 +758,13 @@ class FilesController(BaseRepoController
 
        :param cs: changeset to calculate history
 
        :param f_path: path for node to calculate history for
 
        :param changesets: if passed don't calculate history and take
 
            changesets defined in this list
 
        """
 
        # calculate history based on tip
 
        tip_cs = c.rhodecode_repo.get_changeset()
 
        tip_cs = c.db_repo_scm_instance.get_changeset()
 
        if changesets is None:
 
            try:
 
                changesets = tip_cs.get_file_history(f_path)
 
            except (NodeDoesNotExistError, ChangesetError):
 
                #this node is not present at tip !
 
                changesets = cs.get_file_history(f_path)
 
@@ -778,17 +778,17 @@ class FilesController(BaseRepoController
 
            #_branch = '(%s)' % chs.branch if _hg else ''
 
            _branch = chs.branch
 
            n_desc = 'r%s:%s (%s)' % (chs.revision, chs.short_id, _branch)
 
            changesets_group[0].append((chs.raw_id, n_desc,))
 
        hist_l.append(changesets_group)
 

	
 
        for name, chs in c.rhodecode_repo.branches.items():
 
        for name, chs in c.db_repo_scm_instance.branches.items():
 
            branches_group[0].append((chs, name),)
 
        hist_l.append(branches_group)
 

	
 
        for name, chs in c.rhodecode_repo.tags.items():
 
        for name, chs in c.db_repo_scm_instance.tags.items():
 
            tags_group[0].append((chs, name),)
 
        hist_l.append(tags_group)
 

	
 
        return hist_l, changesets
 

	
 
    @LoginRequired()
kallithea/controllers/home.py
Show inline comments
 
@@ -110,13 +110,13 @@ class HomeController(BaseController):
 
    @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
 
                                   'repository.admin')
 
    def branch_tag_switcher(self, repo_name):
 
        if request.is_xhr:
 
            c.db_repo = Repository.get_by_repo_name(repo_name)
 
            if c.db_repo:
 
                c.rhodecode_repo = c.db_repo.scm_instance
 
                c.db_repo_scm_instance = c.db_repo.scm_instance
 
                return render('/switch_to_list.html')
 
        raise HTTPBadRequest()
 

	
 
    @LoginRequired()
 
    @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
 
                                   'repository.admin')
kallithea/controllers/summary.py
Show inline comments
 
@@ -71,18 +71,18 @@ class SummaryController(BaseRepoControll
 

	
 
        download_l = []
 

	
 
        branches_group = ([], _("Branches"))
 
        tags_group = ([], _("Tags"))
 

	
 
        for name, chs in c.rhodecode_repo.branches.items():
 
        for name, chs in c.db_repo_scm_instance.branches.items():
 
            #chs = chs.split(':')[-1]
 
            branches_group[0].append((chs, name),)
 
        download_l.append(branches_group)
 

	
 
        for name, chs in c.rhodecode_repo.tags.items():
 
        for name, chs in c.db_repo_scm_instance.tags.items():
 
            #chs = chs.split(':')[-1]
 
            tags_group[0].append((chs, name),)
 
        download_l.append(tags_group)
 

	
 
        return download_l
 

	
 
@@ -227,14 +227,14 @@ class SummaryController(BaseRepoControll
 
                          for x, y in lang_stats_d.items())
 

	
 
            c.trending_languages = json.dumps(
 
                sorted(lang_stats, reverse=True, key=lambda k: k[1])[:10]
 
            )
 
            last_rev = stats.stat_on_revision + 1
 
            c.repo_last_rev = c.rhodecode_repo.count()\
 
                if c.rhodecode_repo.revisions else 0
 
            c.repo_last_rev = c.db_repo_scm_instance.count()\
 
                if c.db_repo_scm_instance.revisions else 0
 
            if last_rev == 0 or c.repo_last_rev == 0:
 
                pass
 
            else:
 
                c.stats_percentage = '%.2f' % ((float((last_rev)) /
 
                                                c.repo_last_rev) * 100)
 
        else:
kallithea/controllers/tags.py
Show inline comments
 
@@ -43,13 +43,13 @@ class TagsController(BaseRepoController)
 
    @LoginRequired()
 
    @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
 
                                   'repository.admin')
 
    def index(self):
 
        c.repo_tags = OrderedDict()
 

	
 
        tags = [(name, c.rhodecode_repo.get_changeset(hash_)) for \
 
                 name, hash_ in c.rhodecode_repo.tags.items()]
 
        tags = [(name, c.db_repo_scm_instance.get_changeset(hash_)) for \
 
                 name, hash_ in c.db_repo_scm_instance.tags.items()]
 
        ordered_tags = sorted(tags, key=lambda x: x[1].date, reverse=True)
 
        for name, cs_tag in ordered_tags:
 
            c.repo_tags[name] = cs_tag
 

	
 
        return render('tags/tags.html')
kallithea/lib/base.py
Show inline comments
 
@@ -366,13 +366,13 @@ class BaseController(WSGIController):
 

	
 
class BaseRepoController(BaseController):
 
    """
 
    Base class for controllers responsible for loading all needed data for
 
    repository loaded items are
 

	
 
    c.rhodecode_repo: instance of scm repository
 
    c.db_repo_scm_instance: instance of scm repository
 
    c.db_repo: instance of db
 
    c.repository_followers: number of followers
 
    c.repository_forks: number of forks
 
    c.repository_following: weather the current user is following the current repo
 
    """
 

	
 
@@ -395,14 +395,14 @@ class BaseRepoController(BaseController)
 
                if route in ['repo_creating_home']:
 
                    return
 
                check_url = url('repo_creating_home', repo_name=c.repo_name)
 
                return redirect(check_url)
 

	
 
            dbr = c.db_repo = _dbr
 
            c.rhodecode_repo = c.db_repo.scm_instance
 
            if c.rhodecode_repo is None:
 
            c.db_repo_scm_instance = c.db_repo.scm_instance
 
            if c.db_repo_scm_instance is None:
 
                log.error('%s this repository is present in database but it '
 
                          'cannot be created as an scm instance', c.repo_name)
 

	
 
                redirect(url('home'))
 

	
 
            # update last change according to VCS data
kallithea/templates/base/base.html
Show inline comments
 
@@ -183,13 +183,13 @@
 
                   <a class="${follow_class()}" onclick="javascript:toggleFollowingRepo(this,${c.db_repo.repo_id},'${str(h.get_token())}');">
 
                    <span class="show-follow"><i class="icon-heart-empty"></i> ${_('Follow')}</span>
 
                    <span class="show-following"><i class="icon-heart"></i> ${_('Unfollow')}</span>
 
                  </a>
 
                  </li>
 
                  <li><a href="${h.url('repo_fork_home',repo_name=c.repo_name)}"><i class="icon-code-fork"></i> ${_('Fork')}</a></li>
 
                  %if h.is_hg(c.rhodecode_repo):
 
                  %if h.is_hg(c.db_repo_scm_instance):
 
                  <li><a href="${h.url('pullrequest_home',repo_name=c.repo_name)}"><i class="icon-code-fork"></i> ${_('Create Pull Request')}</a></li>
 
                  %endif
 
              %endif
 
             </ul>
 
        </li>
 
        <li ${is_current('showpullrequest')}>
kallithea/templates/changelog/changelog.html
Show inline comments
 
@@ -116,13 +116,13 @@ ${self.repo_context_bar('changelog')}
 
                                                    ${len(c.comments[cs.raw_id])}
 
                                                    <i class="icon-comment-alt icon-comment-colored"></i>
 
                                                </a>
 
                                            </div>
 
                                        </div>
 
                                    %endif
 
                                    %if h.is_hg(c.rhodecode_repo):
 
                                    %if h.is_hg(c.db_repo_scm_instance):
 
                                        %for book in cs.bookmarks:
 
                                            <div class="booktag" title="${_('Bookmark %s') % book}">
 
                                                ${h.link_to(h.shorter(book),h.url('files_home',repo_name=c.repo_name,revision=cs.raw_id))}
 
                                            </div>
 
                                        %endfor
 
                                    %endif
kallithea/templates/changelog/changelog_summary_data.html
Show inline comments
 
@@ -42,13 +42,13 @@
 
        </td>
 
        <td><span class="tooltip" title="${h.tooltip(h.fmt_date(cs.date))}">
 
                      ${h.age(cs.date)}</span>
 
        </td>
 
        <td title="${cs.author}">${h.person(cs.author)}</td>
 
        <td>
 
            %if h.is_hg(c.rhodecode_repo):
 
            %if h.is_hg(c.db_repo_scm_instance):
 
                %for book in cs.bookmarks:
 
                    <div class="booktag" title="${_('Bookmark %s') % book}">
 
                        ${h.link_to(h.shorter(book),h.url('files_home',repo_name=c.repo_name,revision=cs.raw_id))}
 
                    </div>
 
                %endfor
 
            %endif
 
@@ -91,21 +91,21 @@ ${c.repo_changesets.pager('$link_previou
 
</div>
 
%endif
 

	
 

	
 
<h4>${_('Push new repo')}</h4>
 
<pre>
 
    ${c.rhodecode_repo.alias} clone ${c.clone_repo_url}
 
    ${c.rhodecode_repo.alias} add README # add first file
 
    ${c.rhodecode_repo.alias} commit -m "Initial" # commit with message
 
    ${c.rhodecode_repo.alias} push ${'origin master' if h.is_git(c.rhodecode_repo) else ''} # push changes back
 
    ${c.db_repo_scm_instance.alias} clone ${c.clone_repo_url}
 
    ${c.db_repo_scm_instance.alias} add README # add first file
 
    ${c.db_repo_scm_instance.alias} commit -m "Initial" # commit with message
 
    ${c.db_repo_scm_instance.alias} push ${'origin master' if h.is_git(c.db_repo_scm_instance) else ''} # push changes back
 
</pre>
 

	
 
<h4>${_('Existing repository?')}</h4>
 
<pre>
 
%if h.is_git(c.rhodecode_repo):
 
%if h.is_git(c.db_repo_scm_instance):
 
    git remote add origin ${c.clone_repo_url}
 
    git push -u origin master
 
%else:
 
    hg push ${c.clone_repo_url}
 
%endif
 
</pre>
kallithea/templates/changeset/changeset.html
Show inline comments
 
@@ -85,13 +85,13 @@ ${self.repo_context_bar('changelog')}
 

	
 
                    <span class="logtags">
 
                        %if len(c.changeset.parents)>1:
 
                        <span class="merge">${_('merge')}</span>
 
                        %endif
 

	
 
                        %if h.is_hg(c.rhodecode_repo):
 
                        %if h.is_hg(c.db_repo_scm_instance):
 
                          %for book in c.changeset.bookmarks:
 
                          <span class="booktag" title="${_('Bookmark %s') % book}">
 
                             ${h.link_to(h.shorter(book),h.url('files_home',repo_name=c.repo_name,revision=c.changeset.raw_id))}
 
                          </span>
 
                          %endfor
 
                        %endif
kallithea/templates/changeset/changeset_range.html
Show inline comments
 
@@ -85,13 +85,13 @@ ${self.repo_context_bar('changelog')}
 
             </div>
 
             <div class="right">
 
              <span class="logtags">
 
                %if len(cs.parents)>1:
 
                <span class="merge">${_('merge')}</span>
 
                %endif
 
                %if h.is_hg(c.rhodecode_repo):
 
                %if h.is_hg(c.db_repo_scm_instance):
 
                  %for book in cs.bookmarks:
 
                  <span class="booktag" title="${_('Bookmark %s') % book}">
 
                     ${h.link_to(h.shorter(book),h.url('files_home',repo_name=c.repo_name,revision=cs.raw_id))}
 
                  </span>
 
                  %endfor
 
                %endif
kallithea/templates/changeset/patch_changeset.html
Show inline comments
 
%if h.is_hg(c.rhodecode_repo):
 
# ${c.rhodecode_repo.alias.upper()} changeset patch
 
%if h.is_hg(c.db_repo_scm_instance):
 
# ${c.db_repo_scm_instance.alias.upper()} changeset patch
 
# User ${c.changeset.author |n}
 
# Date ${c.changeset.date}
 
# Node ID ${c.changeset.raw_id}
 
${c.parent_tmpl}
 
${c.changeset.message |n}
 

	
 
%elif h.is_git(c.rhodecode_repo):
 
%elif h.is_git(c.db_repo_scm_instance):
 
From ${c.changeset.raw_id} ${c.changeset.date}
 
From: ${c.changeset.author |n}
 
Date: ${c.changeset.date}
 
Subject: [PATCH] ${c.changeset.message |n}
 
---
 

	
kallithea/templates/summary/summary.html
Show inline comments
 
@@ -112,13 +112,13 @@ summary = lambda n:{False:'summary-short
 

	
 
            <div class="field">
 
              <div class="label-summary">
 
                  <label>${_('Download')}:</label>
 
              </div>
 
              <div class="input ${summary(c.show_stats)}">
 
                %if len(c.rhodecode_repo.revisions) == 0:
 
                %if len(c.db_repo_scm_instance.revisions) == 0:
 
                  ${_('There are no downloads yet')}
 
                %elif not c.enable_downloads:
 
                  ${_('Downloads are disabled for this repository')}
 
                    %if h.HasPermissionAll('hg.admin')('enable downloads on from summary'):
 
                        ${h.link_to(_('Enable'),h.url('edit_repo',repo_name=c.repo_name, anchor='repo_enable_downloads'),class_="btn btn-mini")}
 
                    %endif
 
@@ -308,13 +308,13 @@ $(document).ready(function(){
 
             s.html(url)
 
           }
 
       }
 
    });
 

	
 
    var tmpl_links = {};
 
    %for cnt,archive in enumerate(c.rhodecode_repo._get_archives()):
 
    %for cnt,archive in enumerate(c.db_repo_scm_instance._get_archives()):
 
      tmpl_links["${archive['type']}"] = '${h.link_to('__NAME__', h.url('files_archive_home',repo_name=c.db_repo.repo_name, fname='__CS__'+archive['extension'],subrepos='__SUB__'),class_='btn btn-small')}';
 
    %endfor
 
})
 
</script>
 

	
 
%if c.show_stats:
kallithea/templates/switch_to_list.html
Show inline comments
 
## -*- coding: utf-8 -*-
 
<li>
 
    <a href="${h.url('branches_home',repo_name=c.repo_name)}" class="childs"><i class="icon-code-fork"></i> ${'%s (%s)' % (_('Branches'),len(c.rhodecode_repo.branches.values()),)}</a>
 
    <a href="${h.url('branches_home',repo_name=c.repo_name)}" class="childs"><i class="icon-code-fork"></i> ${'%s (%s)' % (_('Branches'),len(c.db_repo_scm_instance.branches.values()),)}</a>
 
    <ul>
 
    %if c.rhodecode_repo.branches.values():
 
        %for cnt,branch in enumerate(c.rhodecode_repo.branches.items()):
 
    %if c.db_repo_scm_instance.branches.values():
 
        %for cnt,branch in enumerate(c.db_repo_scm_instance.branches.items()):
 
            <li><div><pre>${h.link_to('%s - %s' % (branch[0],h.short_id(branch[1])),h.url('files_home',repo_name=c.repo_name,revision=(branch[0] if '/' not in branch[0] else branch[1]), at=branch[0]))}</pre></div></li>
 
        %endfor
 
    %else:
 
        <li>${h.link_to(_('There are no branches yet'),'#')}</li>
 
    %endif
 
    </ul>
 
</li>
 
%if c.rhodecode_repo.closed_branches.values():
 
%if c.db_repo_scm_instance.closed_branches.values():
 
<li>
 
    <a href="${h.url('branches_home',repo_name=c.repo_name)}" class="childs"><i class="icon-code-fork"></i> ${'%s (%s)' % (_('Closed Branches'),len(c.rhodecode_repo.closed_branches.values()))}</a>
 
    <a href="${h.url('branches_home',repo_name=c.repo_name)}" class="childs"><i class="icon-code-fork"></i> ${'%s (%s)' % (_('Closed Branches'),len(c.db_repo_scm_instance.closed_branches.values()))}</a>
 
    <ul>
 
        %for cnt,branch in enumerate(c.rhodecode_repo.closed_branches.items()):
 
        %for cnt,branch in enumerate(c.db_repo_scm_instance.closed_branches.items()):
 
            <li><div><pre>${h.link_to('%s - %s' % (branch[0],h.short_id(branch[1])),h.url('files_home',repo_name=c.repo_name,revision=(branch[0] if '/' not in branch[0] else branch[1]), at=branch[0]))}</pre></div></li>
 
        %endfor
 
    </ul>
 
</li>
 
%endif
 
<li>
 
    <a href="${h.url('tags_home',repo_name=c.repo_name)}" class="childs"><i class="icon-tag"></i> ${'%s (%s)' % (_('Tags'),len(c.rhodecode_repo.tags.values()),)}</a>
 
    <a href="${h.url('tags_home',repo_name=c.repo_name)}" class="childs"><i class="icon-tag"></i> ${'%s (%s)' % (_('Tags'),len(c.db_repo_scm_instance.tags.values()),)}</a>
 
    <ul>
 
    %if c.rhodecode_repo.tags.values():
 
        %for cnt,tag in enumerate(c.rhodecode_repo.tags.items()):
 
    %if c.db_repo_scm_instance.tags.values():
 
        %for cnt,tag in enumerate(c.db_repo_scm_instance.tags.items()):
 
         <li><div><pre>${h.link_to('%s - %s' % (tag[0],h.short_id(tag[1])),h.url('files_home',repo_name=c.repo_name,revision=(tag[0] if '/' not in tag[0] else tag[1]), at=tag[0]))}</pre></div></li>
 
        %endfor
 
    %else:
 
        <li>${h.link_to(_('There are no tags yet'),'#')}</li>
 
    %endif
 
    </ul>
 
</li>
 
%if c.rhodecode_repo.alias == 'hg':
 
%if c.db_repo_scm_instance.alias == 'hg':
 
<li>
 
    <a href="${h.url('bookmarks_home',repo_name=c.repo_name)}" class="childs"><i class="icon-bookmark"></i> ${'%s (%s)' % (_('Bookmarks'),len(c.rhodecode_repo.bookmarks.values()),)}</a>
 
    <a href="${h.url('bookmarks_home',repo_name=c.repo_name)}" class="childs"><i class="icon-bookmark"></i> ${'%s (%s)' % (_('Bookmarks'),len(c.db_repo_scm_instance.bookmarks.values()),)}</a>
 
    <ul>
 
    %if c.rhodecode_repo.bookmarks.values():
 
        %for cnt,book in enumerate(c.rhodecode_repo.bookmarks.items()):
 
    %if c.db_repo_scm_instance.bookmarks.values():
 
        %for cnt,book in enumerate(c.db_repo_scm_instance.bookmarks.items()):
 
         <li><div><pre>${h.link_to('%s - %s' % (book[0],h.short_id(book[1])),h.url('files_home',repo_name=c.repo_name,revision=(book[0] if '/' not in book[0] else book[1]), at=book[0]))}</pre></div></li>
 
        %endfor
 
    %else:
 
        <li>${h.link_to(_('There are no bookmarks yet'),'#')}</li>
 
    %endif
 
    </ul>
0 comments (0 inline, 0 general)