diff --git a/swh/provenance/provenance.gr.py b/swh/provenance/provenance.gr.py new file mode 100644 index 0000000..7c135cf --- /dev/null +++ b/swh/provenance/provenance.gr.py @@ -0,0 +1,139 @@ +def revision_process_content( + provenance: ProvenanceInterface, + revision: RevisionEntry, + directory: DirectoryEntry +): + date = provenance.directory_get_date_in_isochrone_frontier(directory) + # stack = [(directory, directory.name)] + + + # XXX + # deal with revision root (if we still want to allow directory root in D-R table) + # should be managed in revision_add() with an "else" statment folowwing the "if" + # but I put it here because I need to be sure, that all directories in the outer frontier + # will be child of a directory (the root directory is a particular case) + if (date!=None) and (daterevision.date: + # directory seen earlier as part of the outer frontier + # need to be reset and manage as it was never seen before + nextstack.append((child, None, path / child.name)) + TE[child.id]=None + elif dateDir==revision.date: + # directory of the inner frontier + # nothing to do here + pass + elif dateDirrevision.date: + # content already found + # but this revision is earliest + blobdates[child.id]=None + + # calculate max(dates) + if (len(blobs)+len(dirs))==0: + # empty dir + # return revision.dates + TE[dir.id]=revision.date + # and we are done + else: + maxdates=revision.date + for bdate in blobdates.values(): + if date is not None: + maxdates=max(maxdates,bdate) + for ddate in dirdates.values(): + maxdates=max(maxdates,ddate) + # about the directory we are processing + if maxdatesmaxdates: + provenance.directory_set_date_in_isochrone_frontier(dir, maxdates) # ! make sure insert makes a min + + elif maxdates==revision.date: + # the current directory is in the inner isochrone frontier + # that s where we can see directory nodes of the outer frontier + for child in blobs: + dateBlob=blobdates.get(child.id) + if (dateBlob is None): + # unkown or reset + provenance.content_set_early_date(child, revision.date) + # ! make sure it makes a min inserting it, + # if it already exists + provenance.content_add_to_revision(revision, child, path) + for child in dirs: + dateDir=dirdates.get(child.id) + if dateDir