1. 程式人生 > >svn版本過低無法讀取高版本的workcopy的問題

svn版本過低無法讀取高版本的workcopy的問題

由於工作環境依賴於cygwin,TortoiseSVN .

之前的TortoiseSVN 比較消耗系統資源,經常弄得系統無響應。升級到TortoiseSVN 1.6.2版本後,這個問題得到了較好的解決,可隨之而來的問題是:cygwin中svn的版本是1.4.5, 無法讀取TortoiseSVN 1.6.2的workcopy。而本人偶爾會使用命令列來處理一些事情,在經過一番google後,終於搞定了。

在TortoiseSVN 1.6.2的work copy目錄下使用 svn info 得到如下的提示:

$ svn info
svn: This client is too old to work with working copy '.'; please get a newer Su
bversion client

看來是cygwin中的svn版本很低

$ svn --version
svn, version 1.4.5 (r25188)
   compiled Sep 19 2007, 23:10:31

Copyright (C) 2000-2006 CollabNet.
Subversion is open source software, see http://subversion.tigris.org/
This product includes software developed by CollabNet (http://www.Collab.Net/).

The following repository access (RA) modules are available:

* ra_dav : Module for accessing a repository via WebDAV (DeltaV) protocol.
  - handles 'http' scheme
  - handles 'https' scheme
* ra_svn : Module for accessing a repository using the svn network protocol.
  - handles 'svn' scheme
* ra_local : Module for accessing a repository on local disk.
  - handles 'file' scheme

確實有點低,google一下沒有找到cygwin先有新的版本,於是下載subversion-1.6.2.tar.gz,按照READE和INSTALL的說明 一步一步從原始碼編譯安裝。

剛開始一切都很順利,可到了 make時卻出現了錯誤:


.libs/fs_fs.o: In function `svn_fs_fs__add_change':
/cygdrive/d/subversion-1.6.2/subversion/libsvn_fs_fs/fs_fs.c:4783: undefined ref
erence to `_svn_fs_path_change2_create'
Creating library file: .libs/libsvn_fs_fs-1.dll.a
collect2: ld returned 1 exit status
make: *** [subversion/libsvn_fs_fs/libsvn_fs_fs-1.la] Error 1

有Google了一番,重新仔細閱讀README INSTALL ,rm libsvn*等等,還是沒有解決。

快要崩潰時,想到了 Subversion FAQ,還真找到了,FAQ啊 太帥了:

I get an error that says "This client is too old".

You're using both an older (pre-1.4) version of the Subversion command-line client, and Subclipse. You recently upgraded Subclipse, and now your command-line client says
svn: This client is too old to work with working copy
'/path/to/your/working/copy'; please get a newer Subversion client
This happened because Subversion's working-copy format changed incompatibly—the new version of Subclipse upgraded your working copy, so now your command-line program, which is old, cannot read it. (This problem isn't specific to Subclipse; it would also have happened if you'd used a command-line client that was 1.4 or newer, along with your older command-line client.) The fix is simply to upgrade your command-line client to 1.4 or newer. As of Subversion 1.5, a helper script is provided to downgrade working copies to formats compatible with earlier releases of Subversion; see this faq.

I got an error saying "This client is too old to work with working copy '...' ". How can I fix it without upgrading Subversion?

Sometimes the working copy metadata format changes incompatibly between minor releases. For example, say you have a working copy created with Subversion 1.4.4, but one day you decide to try out Subversion 1.5.0. Afterwards, you attempt to switch back to 1.4.4, but it doesn't work — it just gives the above error.

This is because 1.5.0 upgraded your working copy format to support some new features (in this case, changelists, the keep-local flag, and variable-depth directories). Although 1.4.4 doesn't know anything about these new features, it can at least recognize that the working copy format has been upgraded to something higher than it can handle.

1.5.0 upgraded the working copy for a good reason: it realizes that 1.4.4 does not know about these new features, and that if 1.4.4 were to meddle with the working copy metadata now, important information might be lost, possibly causing corruption (see issue #2961 , for example).

But this automatic upgrade behavior can be annoying, if you just want to try out a new release of Subversion without installing it permanently. For this reason, we distribute a script that can downgrade working copies when doing so is safe:

Run that script with the "--help " option to see how to use it. As future versions of Subversion are released, we will try to keep this FAQ entry up-to-date with potential downgrade scenarios and their implications.

指令碼原始碼:

#!/usr/bin/env python

#

# change-svn-wc-format.py: Change the format of a Subversion working copy.

#

# ====================================================================

#    Licensed to the Apache Software Foundation (ASF) under one

#    or more contributor license agreements.  See the NOTICE file

#    distributed with this work for additional information

#    regarding copyright ownership.  The ASF licenses this file

#    to you under the Apache License, Version 2.0 (the

#    "License"); you may not use this file except in compliance

#    with the License.  You may obtain a copy of the License at

#

#      http://www.apache.org/licenses/LICENSE-2.0

#

#    Unless required by applicable law or agreed to in writing,

#    software distributed under the License is distributed on an

#    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY

#    KIND, either express or implied.  See the License for the

#    specific language governing permissions and limitations

#    under the License.

# ====================================================================

import sys

import os

import getopt

try:

  my_getopt = getopt.gnu_getopt

except AttributeError:

  my_getopt = getopt.getopt

### The entries file parser in subversion/tests/cmdline/svntest/entry.py

### handles the XML-based WC entries file format used by Subversion

### 1.3 and lower.  It could be rolled into this script.

LATEST_FORMATS = { "1.4" : 8,

                   "1.5" : 9,

                   "1.6" : 10,

                   # Do NOT add format 11 here.  See comment in must_retain_fields

                   # for why.

                 }

def usage_and_exit(error_msg=None):

  """Write usage information and exit.  If ERROR_MSG is provide, that

  error message is printed first (to stderr), the usage info goes to

  stderr, and the script exits with a non-zero status.  Otherwise,

  usage info goes to stdout and the script exits with a zero status."""

  progname = os.path.basename(sys.argv[0])

  stream = error_msg and sys.stderr or sys.stdout

  if error_msg:

    stream.write("ERROR: %s/n/n" % error_msg)

  stream.write("""/

usage: %s WC_PATH SVN_VERSION [--verbose] [--force] [--skip-unknown-format]

       %s --help

Change the format of a Subversion working copy to that of SVN_VERSION.

  --skip-unknown-format    : skip directories with unknown working copy

                             format and continue the update

""" % (progname, progname))

  stream.flush()

  sys.exit(error_msg and 1 or 0)

def get_adm_dir():

  """Return the name of Subversion's administrative directory,

  adjusted for the SVN_ASP_DOT_NET_HACK environment variable.  See

  <http://svn.apache.org/repos/asf/subversion/trunk/notes/asp-dot-net-hack.txt>

  for details."""

  return "SVN_ASP_DOT_NET_HACK" in os.environ and "_svn" or ".svn"

class WCFormatConverter:

  "Performs WC format conversions."

  root_path = None

  error_on_unrecognized = True

  force = False

  verbosity = 0

  def write_dir_format(self, format_nbr, dirname, paths):

    """Attempt to write the WC format FORMAT_NBR to the entries file

    for DIRNAME.  Throws LossyConversionException when not in --force

    mode, and unconvertable WC data is encountered."""

    # Avoid iterating in unversioned directories.

    if not (get_adm_dir() in paths):

      del paths[:]

      return

    # Process the entries file for this versioned directory.

    if self.verbosity:

      print("Processing directory '%s'" % dirname)

    entries = Entries(os.path.join(dirname, get_adm_dir(), "entries"))

    entries_parsed = True

    if self.verbosity:

      print("Parsing file '%s'" % entries.path)

    try:

      entries.parse(self.verbosity)

    except UnrecognizedWCFormatException, e:

      if self.error_on_unrecognized:

        raise

      sys.stderr.write("%s, skipping/n" % e)

      sys.stderr.flush()

      entries_parsed = False

    if entries_parsed:

      format = Format(os.path.join(dirname, get_adm_dir(), "format"))

      if self.verbosity:

        print("Updating file '%s'" % format.path)

      format.write_format(format_nbr, self.verbosity)

    else:

      if self.verbosity:

        print("Skipping file '%s'" % format.path)

    if self.verbosity:

      print("Checking whether WC format can be converted")

    try:

      entries.assert_valid_format(format_nbr, self.verbosity)

    except LossyConversionException, e:

      # In --force mode, ignore complaints about lossy conversion.

      if self.force:

        print("WARNING: WC format conversion will be lossy. Dropping "/

              "field(s) %s " % ", ".join(e.lossy_fields))

      else:

        raise

    if self.verbosity:

      print("Writing WC format")

    entries.write_format(format_nbr)

  def change_wc_format(self, format_nbr):

    """Walk all paths in a WC tree, and change their format to

    FORMAT_NBR.  Throw LossyConversionException or NotImplementedError

    if the WC format should not be converted, or is unrecognized."""

    for dirpath, dirs, files in os.walk(self.root_path):

      self.write_dir_format(format_nbr, dirpath, dirs + files)

class Entries:

  """Represents a .svn/entries file.

  'The entries file' section in subversion/libsvn_wc/README is a

  useful reference."""

  # The name and index of each field composing an entry's record.

  entry_fields = (

    "name",

    "kind",

    "revision",

    "url",

    "repos",

    "schedule",

    "text-time",

    "checksum",

    "committed-date",

    "committed-rev",

    "last-author",

    "has-props",

    "has-prop-mods",

    "cachable-props",

    "present-props",

    "conflict-old",

    "conflict-new",

    "conflict-wrk",

    "prop-reject-file",

    "copied",

    "copyfrom-url",

    "copyfrom-rev",

    "deleted",

    "absent",

    "incomplete",

    "uuid",

    "lock-token",

    "lock-owner",

    "lock-comment",

    "lock-creation-date",

    "changelist",

    "keep-local",

    "working-size",

    "depth",

    "tree-conflicts",

    "file-external",

  )

  # The format number.

  format_nbr = -1

  # How many bytes the format number takes in the file.  (The format number

  # may have leading zeroes after using this script to convert format 10 to

  # format 9 -- which would write the format number as '09'.)

  format_nbr_bytes = -1

  def __init__(self, path):

    self.path = path

    self.entries = []

  def parse(self, verbosity=0):

    """Parse the entries file.  Throw NotImplementedError if the WC

    format is unrecognized."""

    input = open(self.path, "r")

    # Read WC format number from INPUT.  Validate that it

    # is a supported format for conversion.

    format_line = input.readline()

    try:

      self.format_nbr = int(format_line)

      self.format_nbr_bytes = len(format_line.rstrip()) # remove '/n'

    except ValueError:

      self.format_nbr = -1

      self.format_nbr_bytes = -1

    if not self.format_nbr in LATEST_FORMATS.values():

      raise UnrecognizedWCFormatException(self.format_nbr, self.path)

    # Parse file into individual entries, to later inspect for

    # non-convertable data.

    entry = None

    while True:

      entry = self.parse_entry(input, verbosity)

      if entry is None:

        break

      self.entries.append(entry)

    input.close()

  def assert_valid_format(self, format_nbr, verbosity=0):

    if verbosity >= 2:

      print("Validating format for entries file '%s'" % self.path)

    for entry in self.entries:

      if verbosity >= 3:

        print("Validating format for entry '%s'" % entry.get_name())

      try:

        entry.assert_valid_format(format_nbr)

      except LossyConversionException:

        if verbosity >= 3:

          sys.stderr.write("Offending entry:/n%s/n" % entry)

          sys.stderr.flush()

        raise

  def parse_entry(self, input, verbosity=0):

    "Read an individual entry from INPUT stream."

    entry = None

    while True:

      line = input.readline()

      if line in ("", "/x0c/n"):

        # EOF or end of entry terminator encountered.

        break

      if entry is None:

        entry = Entry()

      # Retain the field value, ditching its field terminator ("/x0a").

      entry.fields.append(line[:-1])

    if entry is not None and verbosity >= 3:

      sys.stdout.write(str(entry))

      print("-" * 76)

    return entry

  def write_format(self, format_nbr):

    # Overwrite all bytes of the format number (which are the first bytes in

    # the file).  Overwrite format '10' by format '09', which will be converted

    # to '9' by Subversion when it rewrites the file.  (Subversion 1.4 and later

    # ignore leading zeroes in the format number.)

    assert len(str(format_nbr)) <= self.format_nbr_bytes

    format_string = '%0' + str(self.format_nbr_bytes) + 'd'

    os.chmod(self.path, 0600)

    output = open(self.path, "r+", 0)

    output.write(format_string % format_nbr)

    output.close()

    os.chmod(self.path, 0400)

class Entry:

  "Describes an entry in a WC."

  # Maps format numbers to indices of fields within an entry's record that must

  # be retained when downgrading to that format.

  must_retain_fields = {

      # Not in 1.4: changelist, keep-local, depth, tree-conflicts, file-externals

      8  : (30, 31, 33, 34, 35),

      # Not in 1.5: tree-conflicts, file-externals

      9  : (34, 35),

      10 : (),

      # Downgrading from format 11 (1.7-dev) to format 10 is not possible,

      # because 11 does not use has-props and cachable-props (but 10 does).

      # Naively downgrading in that situation causes properties to disappear

      # from the wc.

      #

      # Downgrading from the 1.7 SQLite-based format to format 10 is not

      # implemented.

      }

  def __init__(self):

    self.fields = []

  def assert_valid_format(self, format_nbr):

    "Assure that conversion will be non-lossy by examining fields."

    # Check whether lossy conversion is being attempted.

    lossy_fields = []

    for field_index in self.must_retain_fields[format_nbr]:

      if len(self.fields) - 1 >= field_index and self.fields[field_index]:

        lossy_fields.append(Entries.entry_fields[field_index])

    if lossy_fields:

      raise LossyConversionException(lossy_fields,

        "Lossy WC format conversion requested for entry '%s'/n"

        "Data for the following field(s) is unsupported by older versions "

        "of/nSubversion, and is likely to be subsequently discarded, and/or "

        "have/nunexpected side-effects: %s/n/n"

        "WC format conversion was cancelled, use the --force option to "

        "override/nthe default behavior."

        % (self.get_name(), ", ".join(lossy_fields)))

  def get_name(self):

    "Return the name of this entry."

    return len(self.fields) > 0 and self.fields[0] or ""

  def __str__(self):

    "Return all fields from this entry as a multi-line string."

    rep = ""

    for i in range(0, len(self.fields)):

      rep += "[%s] %s/n" % (Entries.entry_fields[i], self.fields[i])

    return rep

class Format:

  """Represents a .svn/format file."""

  def __init__(self, path):

    self.path = path

  def write_format(self, format_nbr, verbosity=0):

    format_string = '%d/n'

    if os.path.exists(self.path):

      if verbosity >= 1:

        print("%s will be updated." % self.path)

      os.chmod(self.path,0600)

    else:

      if verbosity >= 1:

        print("%s does not exist, creating it." % self.path)

    format = open(self.path, "w")

    format.write(format_string % format_nbr)

    format.close()

    os.chmod(self.path, 0400)

class LocalException(Exception):

  """Root of local exception class hierarchy."""

  pass

class LossyConversionException(LocalException):

  "Exception thrown when a lossy WC format conversion is requested."

  def __init__(self, lossy_fields, str):

    self.lossy_fields = lossy_fields

    self.str = str

  def __str__(self):

    return self.str

class UnrecognizedWCFormatException(LocalException):

  def __init__(self, format, path):

    self.format = format

    self.path = path

  def __str__(self):

    return ("Unrecognized WC format %d in '%s'; "

            "only formats 8, 9, and 10 can be supported") % (self.format, self.path)

def main():

  try:

    opts, args = my_getopt(sys.argv[1:], "vh?",

                           ["debug", "force", "skip-unknown-format",

                            "verbose", "help"])

  except:

    usage_and_exit("Unable to process arguments/options")

  converter = WCFormatConverter()

  # Process arguments.

  if len(args) == 2:

    converter.root_path = args[0]

    svn_version = args[1]

  else:

    usage_and_exit()

  # Process options.

  debug = False

  for opt, value in opts:

    if opt in ("--help", "-h", "-?"):

      usage_and_exit()

    elif opt == "--force":

      converter.force = True

    elif opt == "--skip-unknown-format":

      converter.error_on_unrecognized = False

    elif opt in ("--verbose", "-v"):

      converter.verbosity += 1

    elif opt == "--debug":

      debug = True

    else:

      usage_and_exit("Unknown option '%s'" % opt)

  try:

    new_format_nbr = LATEST_FORMATS[svn_version]

  except KeyError:

    usage_and_exit("Unsupported version number '%s'; "

                   "only 1.4, 1.5, and 1.6 can be supported" % svn_version)

  try:

    converter.change_wc_format(new_format_nbr)

  except LocalException, e:

    if debug:

      raise

    sys.stderr.write("%s/n" % e)

    sys.stderr.flush()

    sys.exit(1)

  print("Converted WC at '%s' into format %d for Subversion %s" % /

        (converter.root_path, new_format_nbr, svn_version))

if __name__ == "__main__":

  main()


將以上的指令碼儲存,新增可執行屬性,--help可以檢視使用說明。

我儲存的名稱為:change-svn-wc-format

chmod 777 change-svn-wc-format

svn --version

檢視自己的svn 版本為1.5.4

change-svn-wc-format  /home/feilong/code/src/android-515/src/  1.5 --verbose

 /home/feilong/code/src/android-515/src/ 為我的SVN work copy 程式碼路徑,  1.5當前的SVN 主版本號,--verbose可以檢視執行情況

相關推薦

svn版本無法讀取版本workcopy的問題

由於工作環境依賴於cygwin,TortoiseSVN . 之前的TortoiseSVN 比較消耗系統資源,經常弄得系統無響應。升級到TortoiseSVN 1.6.2版本後,這個問題得到了較好的解決,可隨之而來的問題是:cygwin中svn的版本是1.4.5, 無法讀取T

ubuntu14.04 下安裝qq完美解決版本無法使用問題。

由於Wine QQ一直沒更新版本導致目前版本報版本過低無法使用,暫時先上UK官網的國際版Wine QQ,雖然功能沒那麼新,但穩定能用: 下載: 下載地址:http://www.ubuntukylin.com/applications/showimg.php?lang=cn&id=23 下載後解壓得到

VMWare版本無法開啟版本建立的虛擬機器解決方案

created by a VMware product that is incompatible with this version of VMware 我使用version 8 的虛擬機器開啟

VMware版本無法開啟版本建立的虛擬機器

created by a VMware product that is incompatible with this version of VMware 我使用version 9 的虛擬機器開啟 version 10 的建立的虛擬機器系統 丟擲錯誤資訊: The con

flash提示版本導致無法安裝解決方法

若 FLASH 在安裝的過程中提示"正嘗試安裝的 Adobe(R) Flash(R) Player 版本不是最新的版本",請按如下步驟操作:   1、 點選 “開始”-> “執行”,輸入“regedit”,回車;如下圖所示。   2、將 "HKEY_LOCA

mac升級svn--命令列時提示版本

問題:在命令列下對專案進行版本管理操作,結果報這樣的錯:svn: E155021: This client is too old to work with the working copy at ‘/Users/user/works/v1baobao4iphone‘ (fo

使用版本的VS打開版本項目的解決方案(以VS2008打開VS2010開發的項目為例)

ref tar img 若是 如何 load 分享 項目 targe 使用低版本的VS打開高版本項目的解決方案,這裏以VS2008打開VS2010開發的項目為例。 右鍵項目的sln文件以記事本的方式打開: 將對應的前兩列版本各降到對應的版本,這邊的11.00改為10.00

釘釘自帶瀏覽器版本,導致Object.assign不兼容...

follow save 全局 上線 地址 目的 for promise 命令 最近做了一個移動端項目,提前做完了,上線以後各種沒問題,各種瀏覽器都完美棒棒噠,終於可以給自己加一個雞腿了。 But,PM有天給我說,咳咳,為什麽頁面少了一部分?? 說我的一臉懵逼,然後拿給我看,

怎麼將版本的CAD轉換成版本

怎麼將低版本的CAD轉換成高版本?就是在我們日常的工作中,每天最常見的就是CAD格式的圖紙,但是有的時候在網上查詢的CAD圖紙,在進行開啟的時候發現打不開,那就是因為CAD檔案的版本太低,導致在較高的CAD編輯器中打不開,這個時候我們就需要將CAD版本精裝轉換,那怎麼將低版本的CAD轉換成高版本,具體要怎麼來

怎麽將版本的CAD轉換成版本

轉換器 低版本 下載安裝 導致 需要 安裝 編輯器 技術分享 高版本 怎麽將低版本的CAD轉換成高版本?就是在我們日常的工作中,每天最常見的就是CAD格式的圖紙,但是有的時候在網上查找的CAD圖紙,在進行打開的時候發現打不開,那就是因為CAD文件的版本太低,導致在較高的CA

html提醒使用者IE瀏覽器版本,引導更新或下載其他瀏覽器

HTML條件註釋判斷IE<!--[if IE]><!--[if lt IE 9]>--> html 條件判斷語句, 只針對ie瀏覽器有效, 其他的瀏覽器會自動忽略掉, 例如以下的意思是在ie9以下 用jquery1版本,ie9以上用jquery2版本。 有

gcc升級和node版本問題以及node安裝問題

gcc升級 node高版本需要gcc5.X所以需要升級gcc下面貼出兩個地址 CentOS 升級gcc 至 5.2.0 安裝node Node的安裝需要依賴很多,如gcc等,首先我們需要將這些安裝成功,用rpm命令檢視下,果然我們並沒有gcc等,所以要用yum進行安裝: yu

idea解決建立maven專案時web.xml檔案版本的情況

前言 之前介紹瞭如何在idea中部署maven的web專案,但是建立maven專案之後,發現一個小瑕疵: <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"

SpringBoot內建tomcat出現APR版本解決辦法

2018-03-20 13:32:01.022 ERROR 13152 --- [ost-startStop-1] o.a.catalina.core.AprLifecycleListener   : An incompatible version [1.1.32] of the APR based Apac

本地jedis版本踩的坑

環境:jedis-2.7.3;redis-4.0.2 客戶端使用JedisCluster連線redis叢集報錯如下: 原因:jedis通過JedisClusterInfoCache.discover

標籤不可出現屬性“name”可能是你spring版本

我在。spring拷貝配置檔案時候 spring的構造注入編譯器突然提示:構造注入不能有name 屬性。上網查了下。發現是自己的spring版本的問題: 解決辦法: 把xml的表頭改為: <

VS2010等版本軟體開啟VS2012等版本工程檔案原因及其解決方案

在vs2010中開啟vs2012的專案   今天在自己的電腦上裝了vs2010然後要開啟之前在vs2012上建立的sln檔案   被提示-- 無法開啟在新版本上建立的sln--解決方案--檔案      其實vs2010與vs2012上的sln檔案沒有本質區別。   打不開

linux系統centOS7下搭建redis叢集中ruby版本問題的解決方法

問題描述:                      在Centos7中,通過yum安裝ruby的版本是2.0.0,但是如果有些應用需要高版本的ruby環境,比如2.2,2.3,2.4...      那就有點麻煩了,譬如:我準備使用redis官方給的工具:redis-tri

edge瀏覽器 您的flash可能被禁用或者版本

轉自:http://blog.sina.com.cn/s/blog_540316260102xkp1.html 從Win 8開始,微軟的Windows作業系統就已經將Flash Player內嵌。故對於Win 10系統使用微軟預設的Edge瀏覽器,或者使用IE11瀏覽器,

你使用的ie版本請。。。

放到body裡面 <body> <!--[if lte IE 8]> <p class="chromeframe">您使用的IE瀏覽器版本過低。<a href="//windows.microsoft.com/" target="_blank">升級您的IE瀏