Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Saller <bcsaller@objectrealms.net>2007-08-16 10:41:43 (GMT)
committer Benjamin Saller <bcsaller@objectrealms.net>2007-08-16 10:41:43 (GMT)
commit029629e7c79bdaf33191a07f2769e37e93bcc7fb (patch)
tree8acc524e31d6bda20382cd3cafd07e82a4a2de6e
parent91c3eebfbe6aa586150d9405792f6e02fb34fa81 (diff)
also drop the uid on the checkout copy
-rw-r--r--src/olpc/datastore/datastore.py6
-rw-r--r--src/olpc/datastore/hg_backingstore.py2
-rw-r--r--tests/simple_versions.txt8
3 files changed, 9 insertions, 7 deletions
diff --git a/src/olpc/datastore/datastore.py b/src/olpc/datastore/datastore.py
index 1fde4c7..4ca13b6 100644
--- a/src/olpc/datastore/datastore.py
+++ b/src/olpc/datastore/datastore.py
@@ -213,9 +213,9 @@ class DataStore(dbus.service.Object):
@dbus.service.method(DS_DBUS_INTERFACE,
- in_signature='sss',
+ in_signature='sssss',
out_signature='a{sv}s')
- def checkout(self, uid, vid=None, mountpoint=None):
+ def checkout(self, uid, vid=None, mountpoint=None, target=None, dir=None):
"""Check out a revision of a document. Returns the properties
of that version and a filename with the contents of that
version. Generally calls to this should have the mountpoint
@@ -231,7 +231,7 @@ class DataStore(dbus.service.Object):
filename = content.filename
return props, filename
else:
- return mp.checkout(uid, vid)
+ return mp.checkout(uid, vid, target=target, dir=dir)
@dbus.service.method(DS_DBUS_INTERFACE,
in_signature='ssss',
diff --git a/src/olpc/datastore/hg_backingstore.py b/src/olpc/datastore/hg_backingstore.py
index 8d13c5f..78bd175 100644
--- a/src/olpc/datastore/hg_backingstore.py
+++ b/src/olpc/datastore/hg_backingstore.py
@@ -105,6 +105,7 @@ class FileRepo(repo.repository):
x = Xattr(source, NAMESPACE)
# attempt to resolve the revision number from the property
parent = x.get('revision')
+ expected_uid = x.get('uid')
if parent:
parent = int(parent) # from unicode
else:
@@ -172,6 +173,7 @@ class FileRepo(repo.repository):
# this is used to aid in parent chaining on commits
x = Xattr(target, NAMESPACE)
x['revision'] = rev
+ x['uid'] = path # this is from the repo where the names are uids
def remove(self, path):
"""Hard remove the whole version history of an object"""
diff --git a/tests/simple_versions.txt b/tests/simple_versions.txt
index 9be62bd..df6ce9b 100644
--- a/tests/simple_versions.txt
+++ b/tests/simple_versions.txt
@@ -49,7 +49,8 @@ To get a copy of this file out that we can manipulate we can use the
checkout command. By default checkout will check out the HEAD revsion
(the most recent) of a document. It returns the properties dictionary
and the filename of the checkout which is ours to manipulate.
->>> props, fn = ds.checkout(uid)
+
+>>> props, fn = ds.checkout(uid, dir='/tmp')
>>> assert props['title'] == "A day in the life"
>>> assert props['vid'] == str(vid)
@@ -64,9 +65,8 @@ Lets make a revision to this content.
We are going to check in the new file using the props dict of the last
call after making our modifications and supplying our new file.
-(note that we changed the case of 'life' here)
->>> props['title'] = "A day in the Life"
+>>> props['title'] = "A Night in the Life"
>>> uid, vid = ds.checkin(props, fn2)
>>> ds.complete_indexing()
@@ -84,7 +84,7 @@ Verify that the HEAD revision of the content is searchable by default.
Lets check out the head version of this document now.
->>> props, rev2 = ds.checkout(uid)
+>>> props, rev2 = ds.checkout(uid, dir='/tmp')
Check that the id is the same and the version id isn't.