diff options
| author | LV-426 <lv-426@taproot.org.il> | 2015-01-20 03:31:08 +0200 |
|---|---|---|
| committer | LV-426 <lv-426@taproot.org.il> | 2015-01-20 04:00:42 +0200 |
| commit | 8fc42e1a782c1bf9c451bfa64ea90123cc23e678 (patch) | |
| tree | 80a342279c84019a37ee9e6264f73754362fede9 /src | |
| parent | 7b30c5a857af80e2da2686c9dbf66e3ba2a586f2 (diff) | |
DBO_block_chainCommit: cleanup param_set, generate link_id
Diffstat (limited to 'src')
| -rw-r--r-- | src/server/db_op.py | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/src/server/db_op.py b/src/server/db_op.py index a778aa89..b4c6b0ac 100644 --- a/src/server/db_op.py +++ b/src/server/db_op.py @@ -195,13 +195,27 @@ class DBO_block_chain__commit(DB_op): super(DBO_block_chain__commit, self).__init__() self.blob_obj = blob_obj - hash_value = DBO_block_chain__commit.calc_blob_hash(blob_obj) - q_arr = ["match (old_head:__HEAD:__Commit)", - "create (new_head:__HEAD:__Commit {hash: {hash_value}, blob: {blob_value}})", - "create new_head-[r:__Parent]->old_head", - "remove old_head:__HEAD", - "return {`HEAD^`: old_head, HEAD: new_head}" - q_param_set = {'hash_value': hash_value, 'blob_value': blob_obj} + hash_value = DBO_block_chainCommit.calc_blob_hash(blob_obj) + + name_value = hash_value[:8] + '...' if commit_obj == None else commit_obj.to_str__commit_name() + + self.n_name_value = name_value + self.n_id = hash_value + self.l_id = generate_random_id__uuid() + + q_arr = ['match (old_head:__HEAD:Commit)', + 'create (new_head:__HEAD:Commit {commit_attr})', + 'create new_head-[r:__Parent {link_attr}]->old_head', + 'remove old_head:__HEAD', + 'return {`HEAD^`: old_head, HEAD: new_head}' + ] + q_param_set = {'commit_attr': { + 'blob': blob_obj, + 'hash': hash_value, + 'id': hash_value, + 'name': name_value}, + 'link_attr': {'id': self.l_id}, + } self.add_statement(q_arr, q_param_set) class DBO_block_chain__list(DB_op): |
