summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2012-02-25 19:12:23 +0000
committerLars Wirzenius <liw@liw.fi>2012-02-25 19:12:23 +0000
commite7a033f59cace8e0cd17d0243b0628135f5fb2df (patch)
tree6a2b2126619292cd544905e223cb8dc243031b84
parentc68ce8aeb216c642b10433626572c912a59eaaac (diff)
downloadobnam-e7a033f59cace8e0cd17d0243b0628135f5fb2df.tar.gz
Implement --lock-timeout
-rwxr-xr-xdumpobjs4
-rw-r--r--obnamlib/app.py5
-rw-r--r--obnamlib/repo_tests.py18
3 files changed, 15 insertions, 12 deletions
diff --git a/dumpobjs b/dumpobjs
index 04254a27..8469d86b 100755
--- a/dumpobjs
+++ b/dumpobjs
@@ -17,6 +17,7 @@
import os
import sys
+import time
import obnamlib
@@ -31,7 +32,8 @@ repo = obnamlib.Repository(fs, obnamlib.DEFAULT_NODE_SIZE,
obnamlib.DEFAULT_UPLOAD_QUEUE_SIZE, None,
obnamlib.IDPATH_DEPTH,
obnamlib.IDPATH_BITS,
- obnamlib.IDPATH_SKIP)
+ obnamlib.IDPATH_SKIP,
+ time.time, 0)
for objid in find_objids(fs):
obj = repo.get_object(objid)
print 'id %s (%s):' % (obj.id, obj.__class__.__name__)
diff --git a/obnamlib/app.py b/obnamlib/app.py
index 1ccb9d27..4bfded83 100644
--- a/obnamlib/app.py
+++ b/obnamlib/app.py
@@ -126,7 +126,7 @@ class App(cliapp.Application):
# we create one instance here, which will immediately be destroyed.
# FIXME: This is fugly.
obnamlib.Repository(None, 1000, 1000, 100, self.hooks, 10, 10, 10,
- self.time)
+ self.time, 0)
def plugins_dir(self):
return os.path.join(os.path.dirname(obnamlib.__file__), 'plugins')
@@ -174,7 +174,8 @@ class App(cliapp.Application):
self.settings['idpath-depth'],
self.settings['idpath-bits'],
self.settings['idpath-skip'],
- self.time)
+ self.time,
+ self.settings['lock-timeout'])
def time(self):
'''Return current time in seconds since epoch.
diff --git a/obnamlib/repo_tests.py b/obnamlib/repo_tests.py
index 06213867..1d883a0e 100644
--- a/obnamlib/repo_tests.py
+++ b/obnamlib/repo_tests.py
@@ -37,7 +37,7 @@ class RepositoryRootNodeTests(unittest.TestCase):
obnamlib.IDPATH_DEPTH,
obnamlib.IDPATH_BITS,
obnamlib.IDPATH_SKIP,
- time.time)
+ time.time, 0)
self.otherfs = obnamlib.LocalFS(self.tempdir)
self.other = obnamlib.Repository(self.fs, obnamlib.DEFAULT_NODE_SIZE,
@@ -46,7 +46,7 @@ class RepositoryRootNodeTests(unittest.TestCase):
obnamlib.IDPATH_DEPTH,
obnamlib.IDPATH_BITS,
obnamlib.IDPATH_SKIP,
- time.time)
+ time.time, 0)
def tearDown(self):
shutil.rmtree(self.tempdir)
@@ -179,7 +179,7 @@ class RepositoryRootNodeTests(unittest.TestCase):
obnamlib.IDPATH_DEPTH,
obnamlib.IDPATH_BITS,
obnamlib.IDPATH_SKIP,
- time.time)
+ time.time, 0)
self.assertEqual(s2.list_clients(), ['foo'])
def test_adding_existing_client_fails(self):
@@ -254,7 +254,7 @@ class RepositoryClientTests(unittest.TestCase):
obnamlib.IDPATH_DEPTH,
obnamlib.IDPATH_BITS,
obnamlib.IDPATH_SKIP,
- time.time)
+ time.time, 0)
self.repo.lock_root()
self.repo.add_client('client_name')
self.repo.commit_root()
@@ -267,7 +267,7 @@ class RepositoryClientTests(unittest.TestCase):
obnamlib.IDPATH_DEPTH,
obnamlib.IDPATH_BITS,
obnamlib.IDPATH_SKIP,
- time.time)
+ time.time, 0)
self.dir_meta = obnamlib.Metadata()
self.dir_meta.st_mode = stat.S_IFDIR | 0777
@@ -576,7 +576,7 @@ class RepositoryChunkTests(unittest.TestCase):
obnamlib.IDPATH_DEPTH,
obnamlib.IDPATH_BITS,
obnamlib.IDPATH_SKIP,
- time.time)
+ time.time, 0)
self.repo.lock_root()
self.repo.add_client('client_name')
self.repo.commit_root()
@@ -657,7 +657,7 @@ class RepositoryGetSetChunksTests(unittest.TestCase):
obnamlib.IDPATH_DEPTH,
obnamlib.IDPATH_BITS,
obnamlib.IDPATH_SKIP,
- time.time)
+ time.time, 0)
self.repo.lock_root()
self.repo.add_client('client_name')
self.repo.commit_root()
@@ -702,7 +702,7 @@ class RepositoryGenspecTests(unittest.TestCase):
obnamlib.IDPATH_DEPTH,
obnamlib.IDPATH_BITS,
obnamlib.IDPATH_SKIP,
- time.time)
+ time.time, 0)
self.repo.lock_root()
self.repo.add_client('client_name')
self.repo.commit_root()
@@ -758,7 +758,7 @@ class RepositoryWalkTests(unittest.TestCase):
obnamlib.IDPATH_DEPTH,
obnamlib.IDPATH_BITS,
obnamlib.IDPATH_SKIP,
- time.time)
+ time.time, 0)
self.repo.lock_root()
self.repo.add_client('client_name')
self.repo.commit_root()