How do I determine the SVN working copy layout version?

33,331

Solution 1

If .svn/format exists, then read the number in it:

  • Version 7 is SVN 1.3
  • Version 8 is SVN 1.4
  • Version 9 is SVN 1.5

If .svn/format doesn't exist then the version number is on the first line in .svn/entries:

  • Version 10 is SVN 1.6
  • Version 12 is SVN 1.7

Subversion 1.6 was the first one not to use .svn/format. Version 7 and older used XML-based .svn/entries file, newer versions use less verbose line-based file format.

Since Subversion 1.7 the version number is stored in the .svn/wc.db SQLite database in the "user_version" field. So even though .svn/format is bumped to version 12 the actual format version is 29 and future versions may not update .svn/format anymore. To obtain the version number from .svn/wc.db there are two methods:

  1. if you have sqlite3 in your path, sqlite3 .svn/wc.db "PRAGMA user_version"
  2. if you DO NOT have sqlite3 in your path, open .svn/wc.db in a hex editor and read the DWORD at offset 0x3c

All the format version numbers are described in wc.h along with the version numbers of respective Subversion releases.

Solution 2

From Stack Overflow question Find out SVN working copy version (1.7 or 1.8):

One can use sqlite3 .svn/wc.db "PRAGMA user_version" on SVN 1.7 or later (or od -An -j63 -N1 -t dC .svn/wc.db if you only have the SQLite 3.0 libraries, YMMV).

Share:
33,331
William Leara
Author by

William Leara

BIOS Architect, Dell Inc. M.S./Electrical & Computer Engineering, Univ. of Texas, Austin

Updated on July 05, 2022

Comments

  • William Leara
    William Leara almost 2 years

    For example, the SVN 1.5 client has one layout for working copies, and the SVN 1.6 client has a different layout. I understand that the layout automatically gets upgraded when it gets touched by a newer client.

    If I have a working copy on my system, how can I find out the version of the layout it's using?

  • Sharique Abdullah
    Sharique Abdullah almost 12 years
    My file has format value = 4. This does not make sense. Does it ?
  • Filip Navara
    Filip Navara almost 12 years
    @ShariqueAbdullah I believe version 4 corresponds to the original Subversion 1.0 release, but I could be mistaken.
  • Charles Duffy
    Charles Duffy about 11 years
    @ShariqueAbdullah That sounds more like a repository format version than a remotely modern working copy format version.
  • Kai
    Kai almost 11 years
    As of Subversion 1.8, this method is sadly broken.
  • Filip Navara
    Filip Navara almost 11 years
    I've already updated the answer to mention that Subversion 1.7+ stores the version number in the SQLite database (pragma user_version). The link to wc.h also contains the relevant version number for Subversion 1.8.
  • smile.al.d.way
    smile.al.d.way over 9 years
    link to wc.h is broken now. Do we have a new link?
  • Mark A. Fitzgerald
    Mark A. Fitzgerald over 7 years
    The od command works on my system which I believe lacks the SQLite libraries. Thanks!