Page MenuHomeSoftware Heritage
Paste P143

(An Untitled Masterwork)
ActivePublic

Authored by seirl on Mar 10 2017, 5:19 PM.
def filecommands(self, rev, parent=None):
if not parent:
parent_dir = []
else:
parent_dir = self.dir_by_id[parent['directory']]
cur_dir = self.dir_by_id[rev['directory']]
parent_dir = {f['name']: f for f in parent_dir}
cur_dir = {f['name']: f for f in cur_dir}
for fname, f in cur_dir.items():
if ((fname not in parent_dir
or f['sha1'] != parent_dir[fname]['sha1']
or f['perms'] != parent_dir[fname]['perms'])):
yield fastimport.commands.FileModifyCommand(
path=f['name'],
mode=f['perms'],
dataref=self.mark(f['sha1']),
data=None,
)
for fname, f in parent_dir.items():
if fname not in cur_dir:
yield fastimport.commands.FileDeleteCommand(
path=f['name']
)

Event Timeline

or f['perms'] != parent_dir[fname]['perms'])):  # please don't remove the double parens. pydocstyle needs them.

I kid!