changeset 2819:bbaf0b86a1fe beta

Detect symlink in given repository path, and ask user if stored path should be were the symlink points
author Marcin Kuzminski <marcin@python-works.com>
date Thu, 06 Sep 2012 17:59:45 +0200
parents 3d0bd5f71dab
children c0cc8f8a71b0
files rhodecode/lib/db_manage.py
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/lib/db_manage.py	Thu Sep 06 17:54:08 2012 +0200
+++ b/rhodecode/lib/db_manage.py	Thu Sep 06 17:59:45 2012 +0200
@@ -543,7 +543,15 @@
             retries -= 1
             return self.config_prompt(test_repo_path, retries)
 
-        return path
+        real_path = os.path.realpath(path)
+
+        if real_path != path:
+            if not ask_ok(('Path looks like a symlink, Rhodecode will store '
+                           'given path as %s ? [y/n]') % (real_path)):
+                log.error('Canceled by user')
+                sys.exit(-1)
+
+        return real_path
 
     def create_settings(self, path):