forked from openlp/openlp
added code back which should not be removed in this proposal
This commit is contained in:
parent
8d5aaa927d
commit
140178a674
|
@ -102,6 +102,27 @@ def get_application_version():
|
||||||
return APPLICATION_VERSION
|
return APPLICATION_VERSION
|
||||||
if u'--dev-version' in sys.argv or u'-d' in sys.argv:
|
if u'--dev-version' in sys.argv or u'-d' in sys.argv:
|
||||||
# If we're running the dev version, let's use bzr to get the version.
|
# If we're running the dev version, let's use bzr to get the version.
|
||||||
|
try:
|
||||||
|
# If bzrlib is available, use it.
|
||||||
|
from bzrlib.branch import Branch
|
||||||
|
b = Branch.open_containing('.')[0]
|
||||||
|
b.lock_read()
|
||||||
|
try:
|
||||||
|
# Get the branch's latest revision number.
|
||||||
|
revno = b.revno()
|
||||||
|
# Convert said revision number into a bzr revision id.
|
||||||
|
revision_id = b.dotted_revno_to_revision_id((revno,))
|
||||||
|
# Get a dict of tags, with the revision id as the key.
|
||||||
|
tags = b.tags.get_reverse_tag_dict()
|
||||||
|
# Check if the latest
|
||||||
|
if revision_id in tags:
|
||||||
|
full_version = u'%s' % tags[revision_id][0]
|
||||||
|
else:
|
||||||
|
full_version = '%s-bzr%s' % (sorted(b.tags.get_tag_dict().keys())[-1], revno)
|
||||||
|
finally:
|
||||||
|
b.unlock()
|
||||||
|
except:
|
||||||
|
# Otherwise run the command line bzr client.
|
||||||
bzr = Popen((u'bzr', u'tags', u'--sort', u'time'), stdout=PIPE)
|
bzr = Popen((u'bzr', u'tags', u'--sort', u'time'), stdout=PIPE)
|
||||||
output, error = bzr.communicate()
|
output, error = bzr.communicate()
|
||||||
code = bzr.wait()
|
code = bzr.wait()
|
||||||
|
|
Loading…
Reference in New Issue