Changeset - f533c054fb19
[Not reviewed]
beta
0 1 0
Marcin Kuzminski - 13 years ago 2013-04-22 15:49:59
marcin@python-works.com
It's better to use Exception here than assertion. It plays better with the exception handling software like sentry or errormator
1 file changed with 4 insertions and 2 deletions:
0 comments (0 inline, 0 general)
rhodecode/controllers/compare.py
Show inline comments
 
@@ -136,26 +136,28 @@ class CompareController(BaseRepoControll
 
                if ancestors:
 
                    # pick arbitrary ancestor - but there is usually only one
 
                    ancestor = hgrepo[ancestors[0]].hex()
 
            else:
 
                # TODO: have both + and - changesets
 
                revs = ["id('%s') :: id('%s') - id('%s')" %
 
                        (org_rev, other_rev, org_rev)]
 

	
 
            changesets = [other_repo.get_changeset(cs)
 
                          for cs in scmutil.revrange(hgrepo, revs)]
 

	
 
        elif alias == 'git':
 
            assert org_repo == other_repo, ('no support for compare for two '
 
                                            'different repositories in git')
 
            if org_repo != other_repo:
 
                raise Exception('Comparing of different GIT repositories is not'
 
                                'allowed. Got %s != %s' % (org_repo, other_repo))
 

	
 
            so, se = org_repo.run_git_command(
 
                'log --reverse --pretty="format: %%H" -s -p %s..%s'
 
                    % (org_ref[1], other_ref[1])
 
            )
 
            changesets = [org_repo.get_changeset(cs)
 
                          for cs in re.findall(r'[0-9a-fA-F]{40}', so)]
 

	
 
        return changesets, ancestor
 

	
 
    @LoginRequired()
 
    @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
 
                                   'repository.admin')
0 comments (0 inline, 0 general)