简体   繁体   中英

Maintain and automatically update a file containing current revision

I'm currently writing a script to report which revision of the base framework each of our projects are using. I'm trying to do this by creating a version.txt file in our framework trunk which gets automatically updated with the current revision after each commit. This is so each project that has a copy of this base framework know it's revision that it is using.

The problem i'm having is getting the version.txt to get updated with the revision after every commit.

I've tried using $Revision$ keyword substitution, but this will only update if version.txt is modified itself (which defeats the purpose).

I've thought about using a pre-commit hook to make a change to version.txt so it gets added to the list of files to commit but not sure how to add a file to the commit list during a pre-commit.

Any better ways to go about this?

Thanks

  1. You must not and can not change content of transaction in pre-commit hook
  2. You still can use keyword in version.txt and modify+commit in additional commit from post-commit hook (hook will get rather exotic logic, but it will work) for the cost of "poisoning" repository by 2x amount of commits (1 data + 1 control)
  3. You still can use keyword in version.txt and use single commit, if you before every commit join needed for commit files and version.txt in changelist

    • If you Projects are also versioned as Framework (and framework linked with externals) at the development stage you can always check svn:external property or svn info in nested WC of framework inside WC of your projects
    • If you want to know version of framework in deployed project, you can inside deploy-process create version.txt with needed content inside deployable tree, read about SubWCRev (part of TortoiseSVN) or it's Linux-equivalent SVNRev

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM