views:

190

answers:

3

Is it possible to keep the attributes of a version controlled file unchanged? I have a directory structure which I'd like my installer to recreate on the client machine. I was hoping the entire directory could be placed on VCS without affecting the file attributes.

I'm using TFS but would also like to hear about other version control systems.

Edit: I'm talking about Windows file system attributes such as Hidden/Archive/System/Read-only but any other information such as creation/modification dates is also welcome. I have a directory structure in which some files are read-only and need to have those files installed as such on the client's machine. TFS tends to set/unset the read-only attribute depending on whether the file is checked-in or checked-out.

+1  A: 

TFS does not store the file attribute data (such as created date, modified date) etc in the current versions of TFS. The values for those attributes will be the time on the local computer when the files is first downloaded / modifed.

Martin Woodward
That's a limitation I didn't know about. So I can't preserve the real file dates? Preserving the dates on (3rd party, binary) files is often important. Guess you'll need to not check those files into TFS?
Aardvark
I've never had it be important that the attributes of the assemblies be preserved. The only people I'd heard with that issue in the past are for web application people who only want to push files that have changed between builds. Any idea why the dates on 3rd party libs might be needed to be preserved?
Martin Woodward
A: 

Usually version control systems do not store full metadata information about the files under its control in repository. In usual usage of version control systems this is not needed, and might have even cause problems; version control systems store "sane" subset of metadata (like e.g. executable permissions, and symbolic links).

Possible solution is to use hooks to save required parts of file metadata on commit to some file (usually plain text file), keep this file under version control to distribute it automatically to all clients, and use hooks to restore metadata on checkout.


Example solutions of tools to save and restore metadata include (unfortunately examples are for Git, and not TFS, but it is the idea that matters):

Example solutions of tools to keep configuration files under version control (again: all of them using Git as a backend) include:

Jakub Narębski
+1  A: 

TFS 2010 has the ability to attach arbitrary metadata to version control objects. You'd have to write your own tool, however.

API specification (prelease): http://blogs.msdn.com/mrod/archive/2008/05/09/team-foundation-server-properties.aspx

Richard Berg