@@ -355,7 +355,7 @@ def changeset(self, commit):
355
355
def getFilesForCommit (self , commit ):
356
356
"""Get all entry, oid tupples for a commit.
357
357
358
- On Cache miss this method also updates teh commits cache.
358
+ On Cache miss this method also updates the commits cache.
359
359
"""
360
360
uriFileMap = self .config .getgraphurifilemap ()
361
361
@@ -394,11 +394,11 @@ def getFileReferenceAndContext(self, blob, commit):
394
394
return quitWorkingData
395
395
return self ._blobs .get (blob )
396
396
397
- def commit (self , graph , delta , message , commit_id , ref , query = None , default_graph = [],
397
+ def commit (self , graph , delta , message , parent_commit_ref , ref , query = None , default_graph = [],
398
398
named_graph = [], ** kwargs ):
399
399
"""Commit changes after applying deltas to the blobs.
400
400
401
- This methods analyzes the delta an apllies the changes to the blobs of the repository.
401
+ This methods analyzes the delta and applies the changes to the blobs of the repository.
402
402
A commit message is built with help of message and if called from endpoint with query,
403
403
default_graph and named_graph. **kwargs can be used to extend the commit message with
404
404
custom key-value-pairs.
@@ -407,7 +407,7 @@ def commit(self, graph, delta, message, commit_id, ref, query=None, default_grap
407
407
graph: the current graph instance
408
408
delta: delta that will be applied
409
409
message: commit message
410
- commit_id : the commit-id of preceeding commit
410
+ parent_commit_ref : the commit-id of preceeding commit
411
411
ref: a ref/branch were the commit will be applied to
412
412
query: the query that lead to the commit
413
413
default_graph: using-graph-uri values from SPARQL protocol
@@ -445,19 +445,25 @@ def _apply(f, changeset, identifier):
445
445
if not delta :
446
446
return
447
447
448
- commit = self . repository . revision ( commit_id )
449
- index = self . repository . index ( commit . id )
450
-
448
+ parent_commit_id = None
449
+ parent_commit = None
450
+ blobs = []
451
451
blobs_new = set ()
452
- try :
453
- blobs = self .getFilesForCommit (commit )
454
- except KeyError :
455
- blobs = []
452
+
453
+ if parent_commit_ref :
454
+ parent_commit = self .repository .revision (parent_commit_ref )
455
+ if parent_commit :
456
+ parent_commit_id = parent_commit .id
457
+ try :
458
+ blobs = self .getFilesForCommit (parent_commit )
459
+ except KeyError :
460
+ pass
461
+ index = self .repository .index (parent_commit_id )
456
462
457
463
for blob in blobs :
458
464
(fileName , oid ) = blob
459
465
try :
460
- file_reference , contexts = self .getFileReferenceAndContext (blob , commit )
466
+ file_reference , contexts = self .getFileReferenceAndContext (blob , parent_commit )
461
467
for context in contexts :
462
468
for entry in delta :
463
469
changeset = entry .get (context .identifier , None )
0 commit comments