41
41
# see http://wiki.bazaar.canonical.com/Specs/BranchRegistrationTool
45
# Since we are a built-in plugin we share the bzrlib version
47
43
from bzrlib.lazy_import import lazy_import
48
44
lazy_import(globals(), """
49
45
from bzrlib import (
502
499
info = _get_package_branch_info(the_branch.base)
502
c = the_branch.get_config()
503
verbosity = c.get_user_option('launchpad.packaging_verbosity')
504
if verbosity is not None:
505
verbosity = verbosity.lower()
506
if verbosity == 'off':
507
trace.mutter('not checking %s because verbosity is turned off'
508
% (the_branch.base,))
505
510
archive, series, project = info
506
511
from bzrlib.plugins.launchpad import lp_api_lite
508
512
latest_pub = lp_api_lite.LatestPublication(archive, series, project)
509
latest_ver = latest_pub.get_latest_version()
510
t_latest_ver = time.time() - t
511
trace.mutter('LatestPublication.get_latest_version took %.3fs'
513
if latest_ver is None:
514
trace.note('Could not find a published version for packaging branch:\n'
515
' %s' % (the_branch.base,))
518
tags = the_branch.tags.get_tag_dict()
519
t_tag_dict = time.time() - t
520
trace.mutter('LatestPublication get_tag_dict took: %.3fs' % (t_tag_dict,))
521
if latest_ver in tags:
522
trace.note('Found most recent published version: %s'
523
' in packaging branch:\n %s'
524
% (latest_ver, the_branch.base))
526
place = archive.title()
527
if series is not None:
528
place = '%s/%s' % (place, series.title())
529
best_tag = lp_api_lite.get_most_recent_tag(tags, the_branch)
533
best_message = '\nThe most recent tag found is %s' % (best_tag,)
535
'Packaging branch is not up-to-date. The most recent published\n'
536
'version in %s is %s, but it is not in the branch tags for:\n %s%s'
537
% (place, latest_ver, the_branch.base, best_message))
513
lp_api_lite.report_freshness(the_branch, verbosity, latest_pub)
539
516
def _register_hooks():
540
517
_mod_branch.Branch.hooks.install_named_hook('open',