changeset 3574:000653f7cdf9 beta

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>
author Mads Kiilerich <madski@unity3d.com>
date Thu, 21 Mar 2013 11:17:01 +0100
parents 881ae12b3c7d
children ca7785fae354
files rhodecode/lib/vcs/backends/git/repository.py rhodecode/lib/vcs/backends/hg/repository.py rhodecode/tests/functional/test_files.py
diffstat 3 files changed, 6 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/lib/vcs/backends/git/repository.py	Wed Mar 20 16:58:38 2013 +0100
+++ b/rhodecode/lib/vcs/backends/git/repository.py	Thu Mar 21 11:17:01 2013 +0100
@@ -268,7 +268,7 @@
                 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
@@ -283,7 +283,7 @@
 
             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)):
--- a/rhodecode/lib/vcs/backends/hg/repository.py	Wed Mar 20 16:58:38 2013 +0100
+++ b/rhodecode/lib/vcs/backends/hg/repository.py	Thu Mar 21 11:17:01 2013 +0100
@@ -405,8 +405,8 @@
             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'):
--- a/rhodecode/tests/functional/test_files.py	Wed Mar 20 16:58:38 2013 +0100
+++ b/rhodecode/tests/functional/test_files.py	Thu Mar 21 11:17:01 2013 +0100
@@ -294,8 +294,7 @@
         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()
@@ -333,8 +332,7 @@
         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()