Changeset - 000653f7cdf9
[Not reviewed]
beta
0 3 0
Mads Kiilerich - 13 years ago 2013-03-21 11:17:01
madski@unity3d.com
Transplanted from: 078d1badf39b
avoid displaying repr of internal classes in user facing messages

The context of the message will tell where the problem was and there is no reason to show
... does not exist for this repository <MercurialRepository at /home/marcink/repos/rhodecode>
3 files changed with 6 insertions and 8 deletions:
0 comments (0 inline, 0 general)
rhodecode/lib/vcs/backends/git/repository.py
Show inline comments
 
@@ -265,13 +265,13 @@ class GitRepository(BaseRepository):
 
        if ((is_bstr(revision) and revision.isdigit() and len(revision) < 12)
 
            or isinstance(revision, int) or is_null(revision)):
 
            try:
 
                revision = self.revisions[int(revision)]
 
            except:
 
                raise ChangesetDoesNotExistError("Revision %r does not exist "
 
                    "for this repository %s" % (revision, self))
 
                    "for this repository" % (revision))
 

	
 
        elif is_bstr(revision):
 
            # get by branch/tag name
 
            _ref_revision = self._parsed_refs.get(revision)
 
            _tags_shas = self.tags.values()
 
            if _ref_revision:  # and _ref_revision[1] in ['H', 'RH', 'T']:
 
@@ -280,13 +280,13 @@ class GitRepository(BaseRepository):
 
            # maybe it's a tag ? we don't have them in self.revisions
 
            elif revision in _tags_shas:
 
                return _tags_shas[_tags_shas.index(revision)]
 

	
 
            elif not pattern.match(revision) or revision not in self.revisions:
 
                raise ChangesetDoesNotExistError("Revision %r does not exist "
 
                    "for this repository %s" % (revision, self))
 
                    "for this repository" % (revision))
 

	
 
        # Ensure we return full id
 
        if not pattern.match(str(revision)):
 
            raise ChangesetDoesNotExistError("Given revision %r not recognized"
 
                % revision)
 
        return revision
rhodecode/lib/vcs/backends/hg/repository.py
Show inline comments
 
@@ -402,14 +402,14 @@ class MercurialRepository(BaseRepository
 
            revision = 'tip'
 

	
 
        try:
 
            revision = hex(self._repo.lookup(revision))
 
        except (IndexError, ValueError, RepoLookupError, TypeError):
 
            raise ChangesetDoesNotExistError("Revision %r does not "
 
                                    "exist for this repository %s" \
 
                                    % (revision, self))
 
                                    "exist for this repository"
 
                                    % (revision))
 
        return revision
 

	
 
    def _get_archives(self, archive_name='tip'):
 
        allowed = self.baseui.configlist("web", "allow_archive",
 
                                         untrusted=True)
 
        for i in [('zip', '.zip'), ('gz', '.tar.gz'), ('bz2', '.tar.bz2')]:
rhodecode/tests/functional/test_files.py
Show inline comments
 
@@ -291,14 +291,13 @@ removed extra unicode conversion in diff
 
                                    revision=rev,
 
                                    f_path=f_path))
 

	
 
        msg = """Revision %r does not exist for this repository""" % (rev)
 
        self.checkSessionFlash(response, msg)
 

	
 
        msg = """%s""" % (HG_REPO)
 
        self.checkSessionFlash(response, msg)
 
        self.assertEqual('http://localhost/%s/files/tip/' % HG_REPO, response.headers['location'])
 

	
 
    def test_raw_file_wrong_f_path(self):
 
        self.log_user()
 
        rev = '27cd5cce30c96924232dffcd24178a07ffeb5dfc'
 
        f_path = 'vcs/ERRORnodes.py'
 
        response = self.app.get(url(controller='files', action='rawfile',
 
@@ -330,14 +329,13 @@ removed extra unicode conversion in diff
 
                                    repo_name=HG_REPO,
 
                                    revision=rev,
 
                                    f_path=f_path))
 
        msg = """Revision %r does not exist for this repository""" % (rev)
 
        self.checkSessionFlash(response, msg)
 

	
 
        msg = """%s""" % (HG_REPO)
 
        self.checkSessionFlash(response, msg)
 
        self.assertEqual('http://localhost/%s/files/tip/' % HG_REPO, response.headers['location'])
 

	
 
    def test_raw_wrong_f_path(self):
 
        self.log_user()
 
        rev = '27cd5cce30c96924232dffcd24178a07ffeb5dfc'
 
        f_path = 'vcs/ERRORnodes.py'
 
        response = self.app.get(url(controller='files', action='raw',
0 comments (0 inline, 0 general)