我怎么知道我的工作副本是否不同步 [英] how do i know if my working copy is out of sync
问题描述
我们将当前发布代码的图像保存在某个本地目录中,并且为了构建代码,我们使用该目录中的代码.在构建脚本中,我需要一种方法来确定图像目录中的代码是否与存储库中的当前发布分支同步.如果是这样,我将从脚本中执行 svn update.修订号能否以某种方式用于检测不同步条件?如果是这样怎么办?
We keep a image of current release code in some local directory and for building the code we use the code in this directory. In the build script, I need a way to figure out if the code in image directory in sync with the current release branch in repository. If it is so, I will do a svn update from within script. Can the revision numbers be somehow used to detect the out of sync condition? If so how?
瓦迪拉吉
推荐答案
svn status -u
添加工作修订和服务器过时信息.
adds working revision and server out-of-date information.
如果目录中没有非版本化文件,那么只有当 status 命令不返回任何内容时它才是最新的.否则 * 表示它不是最新的,?表示非版本化、M - 修改等
If you don't have non-versioned files in the directory then it's up to date only if the status command returns nothing. Otherwise * means it's not up to date, ? means non-versioned, M - modified, etc.
换句话说,当且仅当以下返回 0 时它是最新的:
In other words it's up to date if and only if the following returns 0:
svn status -u | grep -E -c "^\s+[^\?]"
这篇关于我怎么知道我的工作副本是否不同步的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!