0

Good Day,

Our team controls an SVN repository and is in charge of automating some of our sql deployments. We have a need to include the SVN revision number in the files that are checked out. At the moment I am able to add the line $Id$ somewhere in the file and run the command

svn propset svn:keywords "Id" filename.sql

After performing a commit, the $Id$ field is expanded and the revision information is replaced as expected.

What we are looking for is a way to run this propset command without having to commit and have the revision number changed. We have many developers using this repo and we do not want to have to request them to run this command themselves for each file. Is there a way to add this property globally or locally without committing? Is there perhaps another method we could use to obtain similar results?

Any advice is appreciated!

Thank you

Matt Kimball
  • 121
  • 2
  • 13

1 Answers1

0

Each developer will not have to set the properties on existing files; they are versioned just like the files and their contents, so you only need add them to each file once and they will be updated appropriately on every checkout & update.

You can install a pre-commit hook to check for the existence of properties on new file adds and reject the commit if it's lacking the required properties.

As of Subversion 1.8, you can use repository-dicatated configuration to configure default property settings so that your developers don't have to do it themselves. This uses the svn:auto-props property.

alroc
  • 27,574
  • 6
  • 51
  • 97
  • Hi alroc, appreciate the response. I've taken your suggestion to heart and have tried implementing this. I found a useful article right here https://stackoverflow.com/questions/2318180/automatically-add-svn-keyword-properties-for-new-files-server-side. This is working great as expected with new files that have not been committed before. However this method doesn't seem to work with existing files which already have a commit. If I have an exisiting file in my repo, I will add the $Id$ as a comment, but upon saving, committing and updating, the tag is not actually expanded as with new files. – Matt Kimball Apr 09 '19 at 18:47
  • That's the correct behavior for keywords. You will need to apply the `svn:keywords` property to existing files and commit that change for the keywords to be expanded. – alroc Apr 09 '19 at 18:48