You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2010/09/28 14:29:15 UTC
svn commit: r1002141 - in
/subversion/trunk/subversion/tests/cmdline/svntest: actions.py wc.py
Author: julianfoad
Date: Tue Sep 28 12:29:15 2010
New Revision: 1002141
URL: http://svn.apache.org/viewvc?rev=1002141&view=rev
Log:
Factor out a DB opening function in the test suite.
* subversion/tests/cmdline/svntest/wc.py
(open_wc_db): New function, factored out of text_base_path() and
actions.lock_admin_dir().
(text_base_path): Use open_wc_db().
* subversion/tests/cmdline/svntest/actions.py
(lock_admin_dir): Use wc.open_wc_db().
Modified:
subversion/trunk/subversion/tests/cmdline/svntest/actions.py
subversion/trunk/subversion/tests/cmdline/svntest/wc.py
Modified: subversion/trunk/subversion/tests/cmdline/svntest/actions.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svntest/actions.py?rev=1002141&r1=1002140&r2=1002141&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svntest/actions.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svntest/actions.py Tue Sep 28 12:29:15 2010
@@ -1663,21 +1663,7 @@ def get_virginal_state(wc_dir, rev):
# Cheap administrative directory locking
def lock_admin_dir(wc_dir):
"Lock a SVN administrative directory"
- dot_svn = svntest.main.get_admin_name()
- root_path = wc_dir
- relpath = ''
-
- while True:
- db_path = os.path.join(root_path, dot_svn, 'wc.db')
- try:
- db = svntest.sqlite3.connect(db_path)
- break
- except: pass
- head, tail = os.path.split(root_path)
- if head == root_path:
- raise svntest.Failure("No DB for " + wc_dir)
- root_path = head
- relpath = os.path.join(tail, relpath).replace(os.path.sep, '/').rstrip('/')
+ db, root_path, relpath = wc.open_wc_db(wc_dir)
db.execute('insert into wc_lock (wc_id, local_dir_relpath, locked_levels) '
+ 'values (?, ?, ?)',
Modified: subversion/trunk/subversion/tests/cmdline/svntest/wc.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svntest/wc.py?rev=1002141&r1=1002140&r2=1002141&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svntest/wc.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svntest/wc.py Tue Sep 28 12:29:15 2010
@@ -816,24 +816,33 @@ def svn_url_quote(url):
# ------------
-def text_base_path(file_path):
- """Return the path to the text-base file for the versioned file
- FILE_PATH."""
+def open_wc_db(local_path):
+ """Open the SQLite DB for the WC path LOCAL_PATH.
+ Return (DB object, WC root path, WC relpath of LOCAL_PATH)."""
dot_svn = svntest.main.get_admin_name()
- root_path, relpath = os.path.split(file_path)
+ root_path = local_path
+ relpath = ''
while True:
db_path = os.path.join(root_path, dot_svn, 'wc.db')
try:
- if os.path.exists(db_path):
- db = svntest.sqlite3.connect(db_path)
- break
+ db = svntest.sqlite3.connect(db_path)
+ break
except: pass
head, tail = os.path.split(root_path)
if head == root_path:
- raise svntest.Failure("No DB for " + file_path)
+ raise svntest.Failure("No DB for " + local_path)
root_path = head
- relpath = os.path.join(tail, relpath).replace(os.sep, '/')
+ relpath = os.path.join(tail, relpath).replace(os.path.sep, '/').rstrip('/')
+
+ return db, root_path, relpath
+
+# ------------
+
+def text_base_path(file_path):
+ """Return the path to the text-base file for the versioned file
+ FILE_PATH."""
+ db, root_path, relpath = open_wc_db(file_path)
c = db.cursor()
# NODES conversion is complete enough that we can use it if it exists
@@ -858,6 +867,7 @@ def text_base_path(file_path):
checksum = checksum[6:]
# Calculate single DB location
+ dot_svn = svntest.main.get_admin_name()
fn = os.path.join(root_path, dot_svn, 'pristine', checksum[0:2], checksum)
if os.path.isfile(fn):