~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/version_info_formats/format_python.py

  • Committer: Richard Wilbur
  • Date: 2016-02-04 19:07:28 UTC
  • mto: This revision was merged to the branch mainline in revision 6618.
  • Revision ID: richard.wilbur@gmail.com-20160204190728-p0zvfii6zase0fw7
Update COPYING.txt from the original http://www.gnu.org/licenses/gpl-2.0.txt  (Only differences were in whitespace.)  Thanks to Petr Stodulka for pointing out the discrepancy.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006 Canonical Ltd
 
1
# Copyright (C) 2006, 2009, 2011 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
 
19
21
import pprint
20
22
 
21
23
from bzrlib.revision import (
38
40
 
39
41
 
40
42
_py_version_footer = '''
41
 
 
42
43
if __name__ == '__main__':
43
 
    print 'revision: %(revno)d' % version_info
 
44
    print 'revision: %(revno)s' % version_info
44
45
    print 'nick: %(branch_nick)s' % version_info
45
46
    print 'revision id: %(revision_id)s' % version_info
46
47
'''
61
62
 
62
63
        revision_id = self._get_revision_id()
63
64
        if revision_id == NULL_REVISION:
64
 
            info['revno'] = 0
 
65
            info['revno'] = '0'
65
66
        else:
66
 
            info['revno'] = self._branch.revision_id_to_revno(revision_id)
 
67
            info['revno'] = self._get_revno_str(revision_id)
67
68
            info['revision_id'] = revision_id
68
69
            rev = self._branch.repository.get_revision(revision_id)
69
70
            info['date'] = create_date_str(rev.timestamp, rev.timezone)
84
85
        to_file.write('\n\n')
85
86
 
86
87
        if self._include_history:
87
 
            self._extract_revision_history()
88
 
            revision_str = pprint.pformat(self._revision_history_info)
 
88
            history = list(self._iter_revision_history())
 
89
            revision_str = pprint.pformat(history)
89
90
            to_file.write('revisions = ')
90
91
            to_file.write(revision_str)
91
92
            to_file.write('\n\n')