2

何らかの理由で、一部のビルド マシンで SVN を更新できません。インストールされている svn のバージョンは 1.3.x です。しかし、Hudson スレーブは 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) を使用していると仮定します。

4

1 に答える 1

1

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])
于 2010-03-26T16:05:12.467 に答える