summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLV-426 <lv-426@taproot.org.il>2015-01-23 01:12:36 +0200
committerLV-426 <lv-426@taproot.org.il>2015-01-23 03:45:49 +0200
commit9d3833618826dce54843c86a860ba9c8d822cb18 (patch)
tree536851cfa8440ff753aa9d9d3c11c24514b67997 /src
parente5f920c8c62c55c6028a4042f84446ddb0184c32 (diff)
DBO_block_chain__commit: create commit-[:__Authored-by]->__User link if possible
Diffstat (limited to 'src')
-rw-r--r--src/server/db_op.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/server/db_op.py b/src/server/db_op.py
index d5679b36..9dd17c24 100644
--- a/src/server/db_op.py
+++ b/src/server/db_op.py
@@ -224,6 +224,17 @@ class DBO_block_chain__commit(DB_op):
self.n_name_value = name_value
self.l_id = l_id
+ # create commit-[:__Authored-by]->__User link if possible
+ if None == ctx or None == ctx.get('user_name'):
+ return
+
+ q_arr = ['merge (n:__USER {user_name: \'%s\'})' % ctx.get('user_name'),
+ 'with n',
+ 'match (m:__HEAD)', # FIXME: specify commit-label index
+ 'create m-[r:`__Authored-by`]->(n)',
+ ]
+ self.add_statement(q_arr)
+
def process_result_set(self):
"""
@return: a Topo_Diff object consisting of the commit node and parent link