1 # Copyright (c) 2012 David Aguilar
2 """Provide cola's version number"""
4 # The current git-cola version
5 _default_version
= '1.7.3'
11 if __name__
== '__main__':
12 srcdir
= os
.path
.dirname(os
.path
.dirname(__file__
))
13 sys
.path
.insert(1, srcdir
)
15 from cola
.git
import git
16 from cola
.decorators
import memoize
18 # minimum version requirements
20 # git-diff learned --patience in 1.6.2
21 # git-mergetool learned --no-prompt in 1.6.2
22 # git-difftool moved out of contrib in git 1.6.3
26 'pyqt_qrunnable': '4.4',
27 'diff-submodule': '1.6.6',
32 """Returns an entry from the known versions table"""
33 return _versions
.get(key
)
37 """Returns the current version"""
38 return _default_version
42 def check_version(min_ver
, ver
):
43 """Check whether ver is greater or equal to min_ver
45 min_ver_list
= version_to_list(min_ver
)
46 ver_list
= version_to_list(ver
)
47 return min_ver_list
<= ver_list
52 """Checks if a version is greater than the known version for <what>"""
53 return check_version(get(key
), ver
)
56 def version_to_list(version
):
57 """Convert a version string to a list of numbers or strings
60 for p
in version
.split('.'):
70 def git_version_str():
71 """Returns the current GIT version"""
76 """Returns the current GIT version"""
77 return git_version_str().split()[-1]
80 if __name__
== '__main__':