在没有安装适当的 svn 二进制文件的情况下获取 svn 修订版

发布于 2024-08-26 05:56:05 字数 542 浏览 3 评论 0 原文

由于某些原因,我们无法在某些构建机器上更新 SVN。安装的svn版本是1.3.x。但Hudson Slave使用1.6来创建结帐。这意味着我们无法在这些结账上运行“svn info”:

$ svnversion 
subversion/libsvn_wc/questions.c:110: (apr_err=155021)
svn: This client is too old to work with working copy '.'; please get a newer Subversion client
$ svn info
subversion/libsvn_wc/questions.c:110: (apr_err=155021)
svn: This client is too old to work with working copy '.'; please get a newer Subversion client
$

我的问题是,有没有办法无需调用 svn 二进制文件即可访问修订号?你知道,就像尝试查看 .svn/ 目录一样?假设结账使用的是最新的 svn 版本(1.6)。

For some reason, we can't update the SVN in some build machines. Installed svn version is 1.3.x. But Hudson slave used 1.6 to create a checkout. This means we can't run "svn info" on those checkouts:

$ svnversion 
subversion/libsvn_wc/questions.c:110: (apr_err=155021)
svn: This client is too old to work with working copy '.'; please get a newer Subversion client
$ svn info
subversion/libsvn_wc/questions.c:110: (apr_err=155021)
svn: This client is too old to work with working copy '.'; please get a newer Subversion client
$

My question, is there a way to access the revision number without having to invoking the svn binary? You know, like trying to look into the .svn/ directory? Assume that the checkout is using latest svn version (1.6).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

摇划花蜜的午后 2024-09-02 05:56:06

我通过查看 setuptools 源代码找到了答案(setuptools/command/egg_info.py)

        entries_file = join(dirname(__file__), '.svn', 'entries')
        assert exists(entries_file), '%s is missing' % entries_file
        with open(entries_file) as f:
            data = f.read()
            # parsing code inherited from setuptools/command/egg_info.py
            if data.startswith('<?xml'):
                localrev = max([int(m.group(1)) for m in revre.finditer(data)]+[0])
            else:
                if data<8:
                    raise Exception, "unrecognized .svn/entries format"

                data = map(str.splitlines,data.split('\n\x0c\n'))
                del data[0][0]  # get rid of the '8' or '9'
                localrev = max([int(d[9]) for d in data if len(d)>9 and d[9]]+[0])

I found an answer to this by looking at setuptools source code (setuptools/command/egg_info.py)

        entries_file = join(dirname(__file__), '.svn', 'entries')
        assert exists(entries_file), '%s is missing' % entries_file
        with open(entries_file) as f:
            data = f.read()
            # parsing code inherited from setuptools/command/egg_info.py
            if data.startswith('<?xml'):
                localrev = max([int(m.group(1)) for m in revre.finditer(data)]+[0])
            else:
                if data<8:
                    raise Exception, "unrecognized .svn/entries format"

                data = map(str.splitlines,data.split('\n\x0c\n'))
                del data[0][0]  # get rid of the '8' or '9'
                localrev = max([int(d[9]) for d in data if len(d)>9 and d[9]]+[0])
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文