8b8dee73f936

Change the default review datastore directory name.
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Sat, 10 Oct 2009 19:07:59 -0400
parents 8d14fdcfb92d
children f284aeed0fd5
branches/tags (none)
files review/api.py review/tests/test_init.py

Changes

--- a/review/api.py	Sat Oct 10 18:54:06 2009 -0400
+++ b/review/api.py	Sat Oct 10 19:07:59 2009 -0400
@@ -8,6 +8,8 @@
 from mercurial.node import hex
 
 
+DEFAULT_DATASTORE_DIRNAME = 'code-review'
+
 class PreexistingDatastore(Exception):
     """Raised when trying to initialize a datastore when one seems to exist."""
     def __init__(self, committed):
@@ -165,7 +167,7 @@
                 raise PreexistingDatastore(True)
             if os.path.exists(os.path.join(repo.root, '.hgreview')):
                 raise PreexistingDatastore(False)
-            self.lpath = lpath or '.review'
+            self.lpath = lpath or DEFAULT_DATASTORE_DIRNAME
             self.rpath = rpath or ('../%s-review' % os.path.basename(repo.root))
         
         root = os.path.join(repo.root, self.lpath)
--- a/review/tests/test_init.py	Sat Oct 10 18:54:06 2009 -0400
+++ b/review/tests/test_init.py	Sat Oct 10 19:07:59 2009 -0400
@@ -1,6 +1,7 @@
 from nose import *
 from util import *
 from .. import messages
+from .. import api
 
 import os
 from mercurial import util as hgutil
@@ -15,12 +16,12 @@
     
     assert '.hgreview' not in sandbox['tip']
     assert os.path.exists('.hgreview')
-    assert os.path.isdir('.review')
-    assert get_datastore_repo('.review')
+    assert os.path.isdir(api.DEFAULT_DATASTORE_DIRNAME)
+    assert get_datastore_repo(api.DEFAULT_DATASTORE_DIRNAME)
     
     with open('.hgreview', 'r') as hgrf:
         hgr = hgrf.read()
-        assert 'local = .review' in hgr
+        assert 'local = %s' % api.DEFAULT_DATASTORE_DIRNAME in hgr
         assert 'remote = ../sandbox-review' in hgr
 
 
@@ -28,17 +29,17 @@
 def test_init_with_local_path():
     sandbox = get_sandbox_repo()
     
-    output = review(init=True, local_path='codereview')
+    output = review(init=True, local_path='NEW_PATH')
     assert messages.INIT_SUCCESS in output
     
     assert '.hgreview' not in sandbox['tip']
     assert os.path.exists('.hgreview')
-    assert os.path.isdir('codereview')
-    assert get_datastore_repo('codereview')
+    assert os.path.isdir('NEW_PATH')
+    assert get_datastore_repo('NEW_PATH')
     
     with open('.hgreview', 'r') as hgrf:
         hgr = hgrf.read()
-        assert 'local = codereview' in hgr
+        assert 'local = NEW_PATH' in hgr
         assert 'remote = ../sandbox-review' in hgr
 
 
@@ -51,12 +52,12 @@
     
     assert '.hgreview' not in sandbox['tip']
     assert os.path.exists('.hgreview')
-    assert os.path.isdir('.review')
-    assert get_datastore_repo('.review')
+    assert os.path.isdir(api.DEFAULT_DATASTORE_DIRNAME)
+    assert get_datastore_repo(api.DEFAULT_DATASTORE_DIRNAME)
     
     with open('.hgreview', 'r') as hgrf:
         hgr = hgrf.read()
-        assert 'local = .review' in hgr
+        assert 'local = %s' % api.DEFAULT_DATASTORE_DIRNAME in hgr
         assert 'remote = ../code-review' in hgr