# HG changeset patch # User Steve Losh # Date 1255216079 14400 # Node ID 8b8dee73f936561e62356f2047ef752f90acfbd3 # Parent 8d14fdcfb92ddb82ef0c0455352f3ec6a8278844 Change the default review datastore directory name. diff -r 8d14fdcfb92d -r 8b8dee73f936 review/api.py --- 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) diff -r 8d14fdcfb92d -r 8b8dee73f936 review/tests/test_init.py --- 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