修改hook脚本中svn下的文件 [英] Modify files under svn in hook script

查看:30
本文介绍了修改hook脚本中svn下的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 post_commit hook 中修改我们存储库下 特定文件的最佳方法(如果有的话)是什么?

What is the best way (if any) to modify a particular file under our repository within a post_commit hook?

例如:我想将校验和行附加到 somefile.conf 文件

eg: I want to append a checksum line to a somefile.conf file

推荐答案

不要在挂钩中执行此操作 - 在单独的更改中执行此操作,然后该分支的其他用户可以将其下拉到他们的工作副本中.它不需要比这更复杂(在伪代码中):

Don't do this in a hook -- do it in a separate change, that other users of that branch can then pull down into their working copy. It doesn't need to be more complicated than this (in pseudocode):

  • 脚本从存储库获取工作副本到本地目录
  • 脚本修改文件
  • 脚本提交带有良好提交消息的文件例如脚本 Foo:添加校验和"

构建脚本(在 cron 下运行或由 Makefile 触发)定期修改存储库的情况并不少见,例如根据其他文件重新生成文件.有时这些文件会被签入存储库,有时则不会,这取决于谁使用这些文件以及如何使用.

It's not uncommon for build scripts (running under cron or triggered by a Makefile) to make periodic revisions to a repository, for example regenerating files based on other files. Sometimes these are checked into the repository and sometimes they aren't, depending on who consumes these files and how.

这篇关于修改hook脚本中svn下的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆