/breezy-builder/trunk

To get this branch, use:
bzr branch https://code.breezy-vcs.org/breezy-builder/trunk

« back to all changes in this revision

Viewing changes to deb_version.py

  • Committer: Jelmer Vernooij
  • Date: 2018-05-19 14:06:00 UTC
  • Revision ID: jelmer@jelmer.uk-20180519140600-47c7x7j8wka332cx
Port to breezy.

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
# You should have received a copy of the GNU General Public License along
14
14
# with this program.  If not, see <http://www.gnu.org/licenses/>.
15
15
 
16
 
from bzrlib import (
 
16
from breezy import (
17
17
    errors,
18
18
    lazy_regex,
19
19
    )
20
20
 
21
 
from bzrlib.plugins.builder.recipe import (
 
21
from breezy.plugins.builder.recipe import (
22
22
    BranchSubstitutionVariable,
23
23
    DateVariable,
24
24
    GitCommitVariable,
174
174
    revtime_var = RevtimeVariable(branch_name, branch, revid)
175
175
    base_branch.deb_version = revtime_var.replace(base_branch.deb_version)
176
176
    tree = branch.repository.revision_tree(revid)
177
 
    cl_file_id = tree.path2id("debian/changelog")
178
 
    if cl_file_id is not None:
179
 
        tree.lock_read()
180
 
        try:
181
 
            cl = changelog.Changelog(tree.get_file_text(cl_file_id))
 
177
    if tree.has_filename('debian/changelog'):
 
178
        with tree.lock_read():
 
179
            cl = changelog.Changelog(tree.get_file_text('debian/changelog'))
182
180
            substitute_changelog_vars(base_branch, branch_name, cl)
183
 
        finally:
184
 
            tree.unlock()
185
181
 
186
182
 
187
183
def substitute_changelog_vars(base_branch, branch_name, changelog):
190
186
    :param branch_name: Branch name (None for root branch)
191
187
    :param changelog: Changelog object to use
192
188
    """
193
 
    from bzrlib.plugins.builder.deb_version import DebUpstreamVariable, DebUpstreamBaseVariable, DebVersionVariable
 
189
    from breezy.plugins.builder.deb_version import DebUpstreamVariable, DebUpstreamBaseVariable, DebVersionVariable
194
190
    debupstream_var = DebUpstreamVariable.from_changelog(branch_name, changelog)
195
191
    base_branch.deb_version = debupstream_var.replace(base_branch.deb_version)
196
192
    if base_branch.format < 0.3: