~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/version_info_formats/format_python.py

  • Committer: Andrew Bennetts
  • Date: 2010-10-08 08:15:14 UTC
  • mto: This revision was merged to the branch mainline in revision 5498.
  • Revision ID: andrew.bennetts@canonical.com-20101008081514-dviqzrdfwyzsqbz2
Split NEWS into per-release doc/en/release-notes/bzr-*.txt

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006, 2009, 2011 Canonical Ltd
 
1
# Copyright (C) 2006 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
16
16
 
17
17
"""A generator which creates a python script from the current tree info"""
18
18
 
19
 
from __future__ import absolute_import
20
 
 
21
19
import pprint
22
20
 
23
21
from bzrlib.revision import (
40
38
 
41
39
 
42
40
_py_version_footer = '''
 
41
 
43
42
if __name__ == '__main__':
44
 
    print 'revision: %(revno)s' % version_info
 
43
    print 'revision: %(revno)d' % version_info
45
44
    print 'nick: %(branch_nick)s' % version_info
46
45
    print 'revision id: %(revision_id)s' % version_info
47
46
'''
62
61
 
63
62
        revision_id = self._get_revision_id()
64
63
        if revision_id == NULL_REVISION:
65
 
            info['revno'] = '0'
 
64
            info['revno'] = 0
66
65
        else:
67
 
            info['revno'] = self._get_revno_str(revision_id)
 
66
            info['revno'] = self._branch.revision_id_to_revno(revision_id)
68
67
            info['revision_id'] = revision_id
69
68
            rev = self._branch.repository.get_revision(revision_id)
70
69
            info['date'] = create_date_str(rev.timestamp, rev.timezone)
85
84
        to_file.write('\n\n')
86
85
 
87
86
        if self._include_history:
88
 
            history = list(self._iter_revision_history())
89
 
            revision_str = pprint.pformat(history)
 
87
            self._extract_revision_history()
 
88
            revision_str = pprint.pformat(self._revision_history_info)
90
89
            to_file.write('revisions = ')
91
90
            to_file.write(revision_str)
92
91
            to_file.write('\n\n')