Storing file permissions in Subversion repository

前端 未结 12 1083
情话喂你
情话喂你 2020-12-01 20:57

How do you store file permissions in a repository? A few files need to be read-only to stop a third party program from trashing it but after checking out of the repository t

相关标签:
12条回答
  • 2020-12-01 21:15

    I would recommend to generate permissions map using mtree utility (FreeBSD has it by default), store the map in the repository, and, as was mentioned above, run a script that would restore proper file permissions from the map as the first step of the build process.

    0 讨论(0)
  • 2020-12-01 21:17

    SVN does have the capability of storing metadata (properties) along with a file. The properties are basically just key/value pairs, however there are some special keys like the 'svn:executable', if this property exists for a file, Subversion will set the filesystem's executable bit for that file when checking the file out. While I know this is not exactly what you are looking for it might just be enough (was for me).

    There are other properties for line ending (svn:eol-style) and mime type(svn:mime-type).

    0 讨论(0)
  • 2020-12-01 21:18

    Graham, svn doesn't store permissions. Your only option is to wrap your call to svn in a script. The script should call svn with its arguments, then set the permissions afterward. Depending on your environment, you might need to call your script svn and tweak your PATH to ensure it gets called.

    I quite like morechilli's idea to have the list of files and permissions checked into the repository itself.

    0 讨论(0)
  • 2020-12-01 21:22

    One possible solution would be to write a script that you check in with the rest of your code and which is run as the first step of your build process.

    This script runs through your copy of the codebase and sets read permissions on certain files.

    Ideally the script would read the list of files from a simple input file. This would make it easy to maintain and easy for other developers to understand which files get marked as read-only.

    0 讨论(0)
  • 2020-12-01 21:25

    Consider using svn lock to disallow others from writing to the file.

    0 讨论(0)
  • 2020-12-01 21:26

    We created a batch file to do this for us. Would prefer actual support in subversion though...

    0 讨论(0)
提交回复
热议问题