Changeset - 395be5fa6eef
[Not reviewed]
kallithea/bin/rebranddb.py
Show inline comments
 
@@ -157,13 +157,12 @@ def do_migrate(db, old, new):
 
def main(argv):
 
    if len(argv) < 2 or argv[1] in ['-h', '--help']:
 
        print 'usage: kallithea/bin/rebranddb.py DBSTRING [NEW] [OLD]'
 
        print '  where DBSTRING is the value of sqlalchemy.db1.url from the .ini,'
 
        print '  NEW defaults to "kallithea", OLD is by default detected from the db"'
 
        raise SystemExit(0)
 
    db = argv[1]
 
    new = 'kallithea'
 
    if len(argv) > 2:
 
        new = argv[2]
 
    old = None
 
    if len(argv) > 3:
 
        old = argv[3]
kallithea/controllers/admin/my_account.py
Show inline comments
 
@@ -245,14 +245,13 @@ class MyAccountController(BaseController
 
                                                     show_expired=show_expired)
 
        return render('admin/my_account/my_account.html')
 

	
 
    def my_account_api_keys_add(self):
 
        lifetime = safe_int(request.POST.get('lifetime'), -1)
 
        description = request.POST.get('description')
 
        new_api_key = ApiKeyModel().create(self.authuser.user_id,
 
                                           description, lifetime)
 
        ApiKeyModel().create(self.authuser.user_id, description, lifetime)
 
        Session().commit()
 
        h.flash(_("Api key successfully created"), category='success')
 
        return redirect(url('my_account_api_keys'))
 

	
 
    def my_account_api_keys_delete(self):
 
        api_key = request.POST.get('del_api_key')
kallithea/controllers/admin/repo_groups.py
Show inline comments
 
@@ -328,13 +328,12 @@ class RepoGroupsController(BaseControlle
 
        c.active = 'settings'
 

	
 
        c.group = c.repo_group = RepoGroupModel()._get_repo_group(group_name)
 
        c.group_repos = c.group.repositories.all()
 

	
 
        #overwrite our cached list with current filter
 
        gr_filter = c.group_repos
 
        c.repo_cnt = 0
 

	
 
        groups = RepoGroup.query().order_by(RepoGroup.group_name)\
 
            .filter(RepoGroup.group_parent_id == c.group.group_id).all()
 
        c.groups = self.scm_model.get_repo_groups(groups)
 

	
kallithea/controllers/admin/users.py
Show inline comments
 
@@ -307,13 +307,13 @@ class UsersController(BaseController):
 
        if c.user.username == User.DEFAULT_USER:
 
            h.flash(_("You can't edit this user"), category='warning')
 
            return redirect(url('users'))
 

	
 
        lifetime = safe_int(request.POST.get('lifetime'), -1)
 
        description = request.POST.get('description')
 
        new_api_key = ApiKeyModel().create(c.user.user_id, description, lifetime)
 
        ApiKeyModel().create(c.user.user_id, description, lifetime)
 
        Session().commit()
 
        h.flash(_("Api key successfully created"), category='success')
 
        return redirect(url('edit_user_api_keys', id=c.user.user_id))
 

	
 
    def delete_api_key(self, id):
 
        c.user = User.get_or_404(id)
kallithea/controllers/files.py
Show inline comments
 
@@ -129,13 +129,13 @@ class FilesController(BaseRepoController
 
    @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
 
                                   'repository.admin')
 
    def index(self, repo_name, revision, f_path, annotate=False):
 
        # redirect to given revision from form if given
 
        post_revision = request.POST.get('at_rev', None)
 
        if post_revision:
 
            cs = self.__get_cs(post_revision)
 
            cs = self.__get_cs(post_revision) # FIXME - unused!
 

	
 
        c.revision = revision
 
        c.changeset = self.__get_cs(revision)
 
        c.branch = request.GET.get('branch', None)
 
        c.f_path = f_path
 
        c.annotate = annotate
 
@@ -769,15 +769,14 @@ class FilesController(BaseRepoController
 
                changesets = cs.get_file_history(f_path)
 
        hist_l = []
 

	
 
        changesets_group = ([], _("Changesets"))
 
        branches_group = ([], _("Branches"))
 
        tags_group = ([], _("Tags"))
 
        _hg = cs.repository.alias == 'hg'
 
        for chs in changesets:
 
            #_branch = '(%s)' % chs.branch if _hg else ''
 
            #_branch = '(%s)' % chs.branch if (cs.repository.alias == 'hg') else ''
 
            _branch = chs.branch
 
            n_desc = '%s (%s)' % (h.show_id(chs), _branch)
 
            changesets_group[0].append((chs.raw_id, n_desc,))
 
        hist_l.append(changesets_group)
 

	
 
        for name, chs in c.db_repo_scm_instance.branches.items():
kallithea/controllers/pullrequests.py
Show inline comments
 
@@ -549,13 +549,13 @@ class PullrequestsController(BaseRepoCon
 
            h.flash(_('Error occurred while creating pull request'),
 
                    category='error')
 
            log.error(traceback.format_exc())
 
            return redirect(url('pullrequest_show', repo_name=repo_name,
 
                                pull_request_id=pull_request_id))
 

	
 
        comm = ChangesetCommentsModel().create(
 
        ChangesetCommentsModel().create(
 
            text=_('Closed, replaced by %s .') % url('pullrequest_show',
 
                                                   repo_name=old_pull_request.other_repo.repo_name,
 
                                                   pull_request_id=pull_request.pull_request_id,
 
                                                   qualified=True),
 
            repo=old_pull_request.other_repo.repo_id,
 
            user=c.authuser.user_id,
kallithea/lib/celerylib/tasks.py
Show inline comments
 
@@ -71,13 +71,12 @@ def get_logger(cls):
 

	
 
@task(ignore_result=True)
 
@locked_task
 
@dbsession
 
def whoosh_index(repo_location, full_index):
 
    from kallithea.lib.indexers.daemon import WhooshIndexingDaemon
 
    log = get_logger(whoosh_index)
 
    DBS = get_session()
 

	
 
    index_location = config['index_dir']
 
    WhooshIndexingDaemon(index_location=index_location,
 
                         repo_location=repo_location, sa=DBS)\
 
                         .run(full_index=full_index)
 
@@ -260,13 +259,12 @@ def send_email(recipients, subject, body
 
        address from field 'email_to' and all admins is used instead
 
    :param subject: subject of the mail
 
    :param body: body of the mail
 
    :param html_body: html version of body
 
    """
 
    log = get_logger(send_email)
 
    DBS = get_session()
 
    assert isinstance(recipients, list), recipients
 

	
 
    email_config = config
 
    email_prefix = email_config.get('email_prefix', '')
 
    if email_prefix:
 
        subject = "%s %s" % (email_prefix, subject)
 
@@ -424,13 +422,13 @@ def create_repo_fork(form_data, cur_user
 
    landing_rev = form_data['landing_rev']
 
    copy_fork_permissions = form_data.get('copy_permissions')
 

	
 
    try:
 
        fork_of = RepoModel(DBS)._get_repo(form_data.get('fork_parent_id'))
 

	
 
        fork_repo = RepoModel(DBS)._create_repo(
 
        RepoModel(DBS)._create_repo(
 
            repo_name=repo_name_full,
 
            repo_type=repo_type,
 
            description=form_data['description'],
 
            owner=owner,
 
            private=private,
 
            clone_uri=clone_uri,
 
@@ -440,13 +438,13 @@ def create_repo_fork(form_data, cur_user
 
            copy_fork_permissions=copy_fork_permissions
 
        )
 
        action_logger(cur_user, 'user_forked_repo:%s' % repo_name_full,
 
                      fork_of.repo_name, '', DBS)
 
        DBS.commit()
 

	
 
        update_after_clone = form_data['update_after_clone']
 
        update_after_clone = form_data['update_after_clone'] # FIXME - unused!
 
        source_repo_path = os.path.join(base_path, fork_of.repo_name)
 

	
 
        # now create this repo on Filesystem
 
        RepoModel(DBS)._create_filesystem_repo(
 
            repo_name=repo_name,
 
            repo_type=repo_type,
kallithea/lib/vcs/backends/git/changeset.py
Show inline comments
 
@@ -184,13 +184,13 @@ class GitChangeset(BaseChangeset):
 

	
 
    @LazyProperty
 
    def children(self):
 
        """
 
        Returns list of children changesets.
 
        """
 
        rev_filter = _git_path = settings.GIT_REV_FILTER
 
        rev_filter = settings.GIT_REV_FILTER
 
        so, se = self.repository.run_git_command(
 
            "rev-list %s --children" % (rev_filter)
 
        )
 

	
 
        children = []
 
        pat = re.compile(r'^%s' % self.raw_id)
kallithea/lib/vcs/backends/git/repository.py
Show inline comments
 
@@ -257,13 +257,13 @@ class GitRepository(BaseRepository):
 
        # errors
 
        try:
 
            self._repo.head()
 
        except KeyError:
 
            return []
 

	
 
        rev_filter = _git_path = settings.GIT_REV_FILTER
 
        rev_filter = settings.GIT_REV_FILTER
 
        cmd = 'rev-list %s --reverse --date-order' % (rev_filter)
 
        try:
 
            so, se = self.run_git_command(cmd)
 
        except RepositoryError:
 
            # Can be raised for empty repositories
 
            return []
 
@@ -553,13 +553,13 @@ class GitRepository(BaseRepository):
 
            cmd_template += ' --until "$until"'
 
            cmd_params['until'] = end_date.strftime('%m/%d/%y %H:%M:%S')
 
        if branch_name:
 
            cmd_template += ' $branch_name'
 
            cmd_params['branch_name'] = branch_name
 
        else:
 
            rev_filter = _git_path = settings.GIT_REV_FILTER
 
            rev_filter = settings.GIT_REV_FILTER
 
            cmd_template += ' %s' % (rev_filter)
 

	
 
        cmd = string.Template(cmd_template).safe_substitute(**cmd_params)
 
        revs = self.run_git_command(cmd)[0].splitlines()
 
        start_pos = 0
 
        end_pos = len(revs)
kallithea/lib/vcs/backends/hg/repository.py
Show inline comments
 
@@ -334,13 +334,13 @@ class MercurialRepository(BaseRepository
 
        except Exception, e:
 
            # means it cannot be cloned
 
            raise urllib2.URLError("[%s] org_exc: %s" % (cleaned_uri, e))
 

	
 
        # now check if it's a proper hg repo
 
        try:
 
            repo_id = httppeer(repoui or ui.ui(), url).lookup('tip')
 
            httppeer(repoui or ui.ui(), url).lookup('tip')
 
        except Exception, e:
 
            raise urllib2.URLError(
 
                "url [%s] does not look like an hg repo org_exc: %s"
 
                % (cleaned_uri, e))
 

	
 
        return True
kallithea/model/repo.py
Show inline comments
 
@@ -550,13 +550,12 @@ class RepoModel(BaseModel):
 
                for r in repo.forks:
 
                    self.delete(r, forks='delete')
 
            elif [f for f in repo.forks]:
 
                raise AttachedForksError()
 

	
 
            old_repo_dict = repo.get_dict()
 
            owner = repo.user
 
            try:
 
                self.sa.delete(repo)
 
                if fs_remove:
 
                    self._delete_filesystem_repo(repo)
 
                else:
 
                    log.debug('skipping removal from filesystem')
0 comments (0 inline, 0 general)