简体   繁体   English

通过脚本自动执行提交和推送操作

[英]Automating commit and push through mercurial from script

What I would like it is to run a script that automatically checks for new assets (files that aren't code) that have been submitted to a specific directory, and then every so often automatically commit those files and push them. 我想要的是运行一个脚本,该脚本自动检查已提交到特定目录的新资产(非代码文件),然后每隔一段时间自动自动提交这些文件并将其推送。

I could make a script that does this through the command line, but I was mostly curious if mercurial offered any special functionality for this, specifically I'd really like some kind of return error code so that my script will know if the process breaks at any point so I can send an email with the error to specific developers. 我可以制作一个可以通过命令行执行此操作的脚本,但是我很好奇Mercurial是否为此提供了任何特殊功能,特别是我真的很想要某种返回错误代码,以便我的脚本可以知道进程是否在此中断随时可以将包含错误的电子邮件发送给特定的开发人员。 For example if for some reason the push fails because a pull is necessary first, I'd like the script to get a code so that it knows this and can handle it properly. 例如,如果由于某种原因推送失败,因为首先必须进行拉取,那么我希望脚本获取代码,以便它知道并可以正确处理它。

I've tried researching this and can only find things like automatically doing a push after a commit, which isn't exactly what I'm looking for. 我已经尝试研究此问题,并且只能找到诸如在提交后自动执行推送之类的事情,这与我要查找的不完全相同。

You can always check exit-code of used commands 您随时可以检查所用命令的退出代码

  • hg add (if new, unversioned files appeared in WC) "Returns 0 if all files are successfully added": non-zero means "some troubles here, not all files added" hg add (如果WC中出现新的,未版本控制的文件)“如果成功添加了所有文件,则返回0”:非零表示“这里有些麻烦,不是所有文件都添加了”
  • hg commit "Returns 0 on success, 1 if nothing changed": 1 means "no commit, nothing to push" hg commit “成功返回0,如果未更改则返回1”:1表示“无提交,无可推送”
  • hg push "Returns 0 if push was successful, 1 if nothing to push" hg push “如果推送成功,则返回0,如果没有推送则返回1”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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