~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/version_info_formats/format_python.py

  • Committer: Vincent Ladeuil
  • Date: 2017-01-17 13:48:10 UTC
  • mfrom: (6615.3.6 merges)
  • mto: This revision was merged to the branch mainline in revision 6620.
  • Revision ID: v.ladeuil+lp@free.fr-20170117134810-j9p3lidfy6pfyfsc
Merge 2.7, resolving conflicts

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')