Source

hgsubversion-queue / subvertpy-version.diff

# HG changeset patch
# User Dan Villiom Podlaski Christiansen <danchr@gmail.com>
# Date 1323817678 -3600
# Node ID 31c7991dcfd56b06500e0c2beee88693ade37715
# Parent  84bf8ace2e417a61dd0efbb6b1a374bab31a6ac9
subvertpy wrapper: show currently used version

Always display the currently linked version of the Subversion
libraries, and only display the version Subvertpy was compiled against
when its interesting.

For example:

hgsubversion: 1.2+56-18906cdd1d05
Subversion: 1.5.7
bindings: Subvertpy 0.7.6

Becomes:

hgsubversion: 1.2+56-18906cdd1d05
Subversion: 1.6.15 (1.5 API)
bindings: Subvertpy 0.7.6

diff --git a/hgsubversion/svnwrap/subvertpy_wrapper.py b/hgsubversion/svnwrap/subvertpy_wrapper.py
--- a/hgsubversion/svnwrap/subvertpy_wrapper.py
+++ b/hgsubversion/svnwrap/subvertpy_wrapper.py
@@ -47,10 +47,14 @@ if subversion_version[:3] < subversion_r
 
 
 def version():
-    svnvers = _versionstr(subversion_version[:3])
-    if subversion_version[3]:
-        svnvers += '-' + subversion_version[3]
-    return (svnvers, 'Subvertpy ' + _versionstr(subvertpy.__version__))
+    apivers = subvertpy.wc.api_version()
+    curvers = subvertpy.wc.version()
+    s = _versionstr(curvers[:3])
+    if curvers[3]:
+        s += '-' + curvers[3]
+    if apivers[:2] != curvers[:2]:
+        s += ' (%d.%d API)' % apivers[:2]
+    return (s, 'Subvertpy ' + _versionstr(subvertpy.__version__))
 
 # exported values
 ERR_FS_CONFLICT = subvertpy.ERR_FS_CONFLICT
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.