diff --git a/swh/vault/cookers/revision_gitfast.py b/swh/vault/cookers/revision_gitfast.py --- a/swh/vault/cookers/revision_gitfast.py +++ b/swh/vault/cookers/revision_gitfast.py @@ -17,7 +17,7 @@ ) from swh.model import hashutil -from swh.model.from_disk import mode_to_perms +from swh.model.from_disk import DentryPerms, mode_to_perms from swh.model.toposort import toposort from swh.vault.cookers.base import BaseVaultCooker from swh.vault.cookers.utils import revision_log @@ -203,7 +203,7 @@ ): yield FileModifyCommand( path=os.path.join(root, fname), - mode=0o160000, + mode=DentryPerms.revision, dataref=hashutil.hash_to_hex(f["target"]).encode(), data=None, ) diff --git a/swh/vault/to_disk.py b/swh/vault/to_disk.py --- a/swh/vault/to_disk.py +++ b/swh/vault/to_disk.py @@ -124,11 +124,10 @@ identifier.""" for file_data in revs_data: path = os.path.join(self.root, file_data["path"]) - self._create_file( - path, hashutil.hash_to_hex(file_data["target"]), mode=0o120000 - ) + target = hashutil.hash_to_hex(file_data["target"]) + self._create_file(path, target, mode=DentryPerms.symlink) - def _create_file(self, path, content, mode=0o100644): + def _create_file(self, path, content, mode=DentryPerms.content): """Create the given file and fill it with content.""" perms = mode_to_perms(mode) if perms == DentryPerms.symlink: