def test_lazy_import(self): """Smoke test that lazy_import() does the right thing""" try: root8 except NameError: pass # root8 should not be defined yet else: self.fail('root8 was not supposed to exist yet') lazy_import.lazy_import(globals(), 'import %s as root8' % (self.root_name,), lazy_import_class=InstrumentedImportReplacer) self.assertEqual(InstrumentedImportReplacer, object.__getattribute__(root8, '__class__')) self.assertEqual(1, root8.var1) self.assertEqual(1, root8.var1) self.assertEqual(1, root8.func1(1)) self.assertEqual([('__getattribute__', 'var1'), ('_import', 'root8'), ('import', self.root_name, [], 0), ], self.actions)
def test_lazy_import(self): """Smoke test that lazy_import() does the right thing""" try: root8 except NameError: pass # root8 should not be defined yet else: self.fail('root8 was not supposed to exist yet') lazy_import.lazy_import(globals(), 'import %s as root8' % (self.root_name, ), lazy_import_class=InstrumentedImportReplacer) self.assertEqual(InstrumentedImportReplacer, object.__getattribute__(root8, '__class__')) self.assertEqual(1, root8.var1) self.assertEqual(1, root8.var1) self.assertEqual(1, root8.func1(1)) self.assertEqual([ ('__getattribute__', 'var1'), ('_import', 'root8'), ('import', self.root_name, [], 0), ], self.actions)
# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA from __future__ import absolute_import from bzrlib import registry from bzrlib.lazy_import import lazy_import lazy_import(globals(), """ from bzrlib import errors, urlutils """) """Provides a shorthand for referring to bugs on a variety of bug trackers. 'commit --fixes' stores references to bugs as a <bug_url> -> <bug_status> mapping in the properties for that revision. However, it's inconvenient to type out full URLs for bugs on the command line, particularly given that many users will be using only a single bug tracker per branch. Thus, this module provides a registry of types of bug tracker (e.g. Launchpad, Trac). Given an abbreviated name (e.g. 'lp', 'twisted') and a branch with configuration information, these tracker types can return an instance capable
# # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA # # Contributors: # Martin Albisetti from bzrlib.lazy_import import lazy_import lazy_import( globals(), """ import os, sys, time from bzrlib import ( diff, errors, osutils, revision as _mod_revision, status, trace, ) from bzrlib.plugins.xmloutput import logxml """) from writer import _escape_cdata def show_tree_status_xml(wt, show_unchanged=None, specific_files=None, show_ids=False, to_file=None,
# # On the other hand, as of 1.2 we generally only call the mutter() statement # if (according to debug_flags) we actually intend to write it. So the # increased cost of logging.py is not so bad, and we could standardize on # that. import logging import os import sys import time from bzrlib.lazy_import import lazy_import lazy_import(globals(), """ from cStringIO import StringIO import errno import locale import tempfile import traceback """) import bzrlib lazy_import(globals(), """ from bzrlib import ( debug, errors, osutils, ui, ) """)
* qcommit command does not support external snapshots via hooks, instead of it use ``ecmd qcommit`` or simple ``commit`` commands. Plugin used config files:: .bzrmeta/externals .bzrmeta/externals-snapshot Format of config files the following:: url directory [revisionspec] """ from bzrlib.lazy_import import lazy_import lazy_import(globals(), """ from bzrlib.plugins.externals import externals as lazy_externals from bzrlib.plugins.externals import commands as lazy_commands """) from bzrlib.branch import Branch from bzrlib.mutabletree import MutableTree from bzrlib.commands import Command, plugin_cmds plugin_name = 'externals' version_info = (1, 3, 2, 'final', 0) def post_change_branch_tip_hook(params): if params.old_revno == 0 and params.branch.base.startswith('file:///'): # only branch or checkout commands lazy_externals.Externals(params.branch, params.new_revid).pull() def post_pull_hook(result):
from socket import gethostname # bzrlib from bzrlib.lazy_import import lazy_import # Importing from peak.util.imports import importString lazy_import( globals(), """ # stdlib import argparse, glob, json, logging, os, subprocess, sys, tempfile, time from datetime import datetime # SQLAlchemy import sqlalchemy from sqlalchemy import orm # import sessionmaker # Zato from zato import common from zato.common import odb #.odb import engine_def, version_raw from zato.common import util #.util import fs_safe_now """) ################################################################################ ZATO_INFO_FILE = b'.zato-info' _opts_odb_type = 'Operational database type, must be one of {}'.format( odb.SUPPORTED_DB_TYPES) _opts_odb_host = 'Operational database host'
# Author: Parth Malwankar <*****@*****.**> """Undelete the file(s) deleted using 'bzr rm'""" from bzrlib.commands import Command, register_command from bzrlib.lazy_import import lazy_import lazy_import(globals(), """ from bzrlib import errors, bzrdir from bzrlib.revisionspec import RevisionSpec from bzrlib.option import Option from bzrlib.builtins import _parse_limit, _get_revision_range from undelete import ( _vprint, _undelete_file, _list_files, _get_revision_from_limit, ) """) version_info = (0, 2, 0) class cmd_undelete(Command): """Undelete file(s) deleted using 'bzr rm' This commands reverts to the last known version of a previously deleted file. It steps back in revisions starting from previous till the specified '--limit' (default: 20). Note that --limit and --revision are mutually exclusive.
# You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA """A collection of function for handling URL operations.""" import os import re import sys from bzrlib.lazy_import import lazy_import lazy_import( globals(), """ from posixpath import split as _posix_split, normpath as _posix_normpath import urllib import urlparse from bzrlib import ( errors, osutils, ) """) def basename(url, exclude_trailing_slash=True): """Return the last component of a URL. :param url: The URL in question :param exclude_trailing_slash: If the url looks like "path/to/foo/" ignore the final slash and return 'foo' rather than '' :return: Just the final component of the URL. This can return '' if you don't exclude_trailing_slash, or if you are at the
StandardButton, QBzrWindow, ThrobberWidget, runs_in_loading_queue, url_for_display, ) from bzrlib.plugins.qbzr.lib.uifactory import ui_current_widget from bzrlib.plugins.qbzr.lib.trace import reports_exception from bzrlib.lazy_import import lazy_import lazy_import(globals(), ''' from bzrlib import ( osutils, errors, ) from bzrlib.bzrdir import BzrDir from bzrlib.revisionspec import RevisionSpec from bzrlib.plugins.qbzr.lib.i18n import gettext from bzrlib.plugins.qbzr.lib.treewidget import TreeWidget, TreeFilterMenu from bzrlib.plugins.qbzr.lib.diff import DiffButtons ''') class BrowseWindow(QBzrWindow): def __init__(self, branch=None, location=None, revision=None, revision_id=None, revision_spec=None, parent=None): if branch: self.branch = branch self.location = url_for_display(branch.base) else: self.branch = None if location is None:
BZR_PLUGIN_PATH is also honoured for any plugins imported via 'import bzrlib.plugins.PLUGINNAME', as long as set_plugins_path has been called. """ import os import sys from bzrlib.lazy_import import lazy_import lazy_import(globals(), """ import imp import re import types import zipfile from bzrlib import ( config, debug, osutils, trace, ) from bzrlib import plugins as _mod_plugins """) from bzrlib.symbol_versioning import deprecated_function, one_three from bzrlib.trace import mutter, warning, log_exception_quietly DEFAULT_PLUGIN_PATH = None _loaded = False def get_default_plugin_path():
from __future__ import absolute_import from bzrlib.lazy_import import lazy_import lazy_import( globals(), """ import itertools from bzrlib import ( controldir, errors, knit as _mod_knit, lockable_files, lockdir, osutils, revision as _mod_revision, trace, transactions, versionedfile, xml5, xml6, xml7, ) """, ) from bzrlib.decorators import needs_read_lock, needs_write_lock from bzrlib.repository import InterRepository, IsInWriteGroupError, RepositoryFormatMetaDir from bzrlib.vf_repository import ( InterSameDataRepository, MetaDirVersionedFileRepository,
ProgressBarStack too if you need multiple levels of cooperating progress bars. Note that bzrlib's internal functions use the ui module, so if you are using bzrlib it really is best to use bzrlib.ui.ui_factory. """ # TODO: Optionally show elapsed time instead/as well as ETA; nicer # when the rate is unpredictable import sys import time import os from bzrlib.lazy_import import lazy_import lazy_import(globals(), """ from bzrlib import ( errors, ) """) from bzrlib.trace import mutter def _supports_progress(f): """Detect if we can use pretty progress bars on the output stream f. If this returns true we expect that a human may be looking at that output, and that we can repaint a line to update it. """ isatty = getattr(f, 'isatty', None) if isatty is None: return False
# GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA """Text UI, write output to the console. """ import sys from bzrlib.lazy_import import lazy_import lazy_import( globals(), """ import getpass from bzrlib import ( progress, osutils, ) """) from bzrlib.ui import CLIUIFactory class TextUIFactory(CLIUIFactory): """A UI factory for Text user interefaces.""" def __init__(self, bar_type=None, stdout=None, stderr=None): """Create a TextUIFactory. :param bar_type: The type of progress bar to create. It defaults to letting the bzrlib.progress.ProgressBar factory auto
"""User interaction support for Bazaar. This plugin includes the following commands: record-patch Records a patch interactively and store it in the patches/ subfolder. This plugin adds the --interactive (-i) option to the following commands: commit Allows the user to select the hunks to be committed interactively.""" __version__ = '1.2.0' version_info = tuple(int(n) for n in __version__.split('.')) from bzrlib.lazy_import import lazy_import lazy_import(globals(), """ from bzrlib import help import record import subprocess """) import sys import os.path import bzrlib.commands import bzrlib.builtins from bzrlib.option import Option from errors import CommandError, PatchFailed, PatchInvokeError from patchsource import BzrPatchSource from hunk_selector import RecordPatchHunkSelector
from bzrlib.plugins.qbzr.lib.diff_arg import * # import DiffArgProvider classes from bzrlib.plugins.qbzr.lib.i18n import gettext from bzrlib.plugins.qbzr.lib.subprocess import SimpleSubProcessDialog from bzrlib.plugins.qbzr.lib.util import ( get_qbzr_config, is_binary_content, ) from bzrlib.lazy_import import lazy_import lazy_import( globals(), ''' import errno import re import time import sys import os import glob from bzrlib.patiencediff import PatienceSequenceMatcher as SequenceMatcher from bzrlib.plugins.qbzr.lib.i18n import gettext, ngettext, N_ from bzrlib import trace, osutils, cmdline from bzrlib.workingtree import WorkingTree from bzrlib.trace import mutter ''') from bzrlib.diff import DiffFromTool, DiffPath subprocess = __import__('subprocess', {}, {}, []) qconfig = get_qbzr_config() default_diff = qconfig.get_option("default_diff") if default_diff is None: default_diff = "" ext_diffs = {gettext("Builtin Diff"): ""} for name, command in qconfig.get_section('EXTDIFF').items():
# # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA from __future__ import absolute_import from bzrlib.lazy_import import lazy_import lazy_import(globals(), """ import bisect import datetime from bzrlib import ( branch as _mod_branch, osutils, revision, symbol_versioning, workingtree, ) from bzrlib.i18n import gettext """) from bzrlib import ( errors, lazy_regex, registry, trace, )
The basic plan is that every branch knows the history of everything that has merged into it. As the first step of a merge, pull, or branch operation we copy history from the source into the destination branch. """ from __future__ import absolute_import import operator from bzrlib.lazy_import import lazy_import lazy_import( globals(), """ from bzrlib import ( tsort, versionedfile, vf_search, ) """) from bzrlib import ( errors, ui, ) from bzrlib.i18n import gettext from bzrlib.revision import NULL_REVISION from bzrlib.trace import mutter class RepoFetcher(object): """Pull revisions and texts from one repository to another.
R somefile4.XXX => file_4_a.XXX R somedir/somefile1.txt => somedir/file_1_a.txt R somedir/somefile2.txt => somedir/file_2_a.txt R somedir/subdir/somefile1.rst => somedir/subdir/file_1_a.rst R somedir/subdir/somefile3.txt => somedir/subdir/file_3_a.txt .. _`Regular Expression`: http://docs.python.org/library/re.html """ from bzrlib.option import Option from bzrlib.commands import Command, register_command from bzrlib.lazy_import import lazy_import lazy_import( globals(), ''' import re from os import path from bzrlib import workingtree ''') # TODO: # - Implement option for --recursive renaming. # - Unit tests. version_info = '0.0.1 pre-alpha' class cmd_multi_rename(Command): """Renames files using a regular expression. Renames files that match the given EXPRESSION, a regexp. Substitutes matches of EXPRESSION on each filename with
# along with Tarmac. If not, see <http://www.gnu.org/licenses/>. '''Tarmac plugin for enforcing a commit message format. This code is derived from Jelmer Vernooij's CIA script for Bazaar that is found at http://samba.org/~jelmer/bzr/cia_bzr.py and modified to fit within the needs of Tarmac. ''' # Head off lint warnings. saxutils = None xmlrpclib = None from bzrlib.lazy_import import lazy_import lazy_import(globals(), ''' import xmlrpclib from xml.sax import saxutils ''') from tarmac import __version__ as version_string from tarmac.hooks import tarmac_hooks from tarmac.plugins import TarmacPlugin class CIAVC(TarmacPlugin): '''Tarmac plugin for notifying CIA.vc of new commits.''' def run(self, command, target, source, proposal): # pylint: disable-msg=W0613,W0104,C0324 try: cia_project = target.config.cia_project
# # On the other hand, as of 1.2 we generally only call the mutter() statement # if (according to debug_flags) we actually intend to write it. So the # increased cost of logging.py is not so bad, and we could standardize on # that. import logging import os import sys import time from bzrlib.lazy_import import lazy_import lazy_import( globals(), """ from cStringIO import StringIO import errno import locale import tempfile import traceback """) import bzrlib lazy_import( globals(), """ from bzrlib import ( debug, errors, osutils, ui, ) """)
from bzrlib.hooks import Hooks from bzrlib import ( errors, trace, transport as _mod_transport, ) from bzrlib.i18n import gettext from bzrlib.lazy_import import lazy_import lazy_import(globals(), """ from bzrlib.smart import ( medium, signals, ) from bzrlib.transport import ( chroot, pathfilter, ) from bzrlib import ( config, urlutils, ) """) class SmartTCPServer(object): """Listens on a TCP socket and accepts connections from smart clients. Each connection will be served by a SmartServerSocketStreamMedium running in a thread. hooks: An instance of SmartServerHooks.
import threading from bzrlib import ( debug, errors, osutils, registry, revision, trace, urlutils, ) from bzrlib.lazy_import import lazy_import lazy_import(globals(), """ from bzrlib import bzrdir from bzrlib.bundle import serializer import tempfile import thread """) jail_info = threading.local() jail_info.transports = None def _install_hook(): bzrdir.BzrDir.hooks.install_named_hook( 'pre_open', _pre_open_hook, 'checking server jail') def _pre_open_hook(transport):
import os import re import string import sys from bzrlib.lazy_import import lazy_import lazy_import(globals(), """ import errno import subprocess import tempfile from bzrlib import ( cleanup, cmdline, controldir, errors, osutils, patiencediff, textfile, timestamp, views, ) from bzrlib.workingtree import WorkingTree from bzrlib.i18n import gettext """) from bzrlib.registry import ( Registry, ) from bzrlib.trace import mutter, note, warning
This is a fairly thin wrapper on regular file IO. """ import os from stat import ST_MODE, S_ISDIR, ST_SIZE, S_IMODE import sys from bzrlib.lazy_import import lazy_import lazy_import(globals(), """ import errno import shutil from bzrlib import ( atomicfile, osutils, urlutils, symbol_versioning, transport, ) from bzrlib.trace import mutter from bzrlib.transport import LateReadError """) from bzrlib.transport import Transport, Server _append_flags = os.O_CREAT | os.O_APPEND | os.O_WRONLY | osutils.O_BINARY _put_non_atomic_flags = os.O_CREAT | os.O_TRUNC | os.O_WRONLY | osutils.O_BINARY class LocalTransport(Transport):
# -*- coding: utf-8 -*- """ Copyright (C) 2010 Dariusz Suchojad <dsuch at zato.io> Licensed under LGPLv3, see LICENSE.txt for terms and conditions. """ from __future__ import absolute_import, division, print_function, unicode_literals # Zato from zato.cli import ZatoCommand, ZATO_INFO_FILE # bzrlib from bzrlib.lazy_import import lazy_import lazy_import(globals(), """ # stdlib import json, os """) class ComponentVersion(ZatoCommand): file_needed = ZATO_INFO_FILE def execute(self, args): info = json.load(open(os.path.join(args.path, self.file_needed))) # noqa self.logger.info(info['version'])
from __future__ import absolute_import import os import sys from bzrlib import osutils from bzrlib.lazy_import import lazy_import lazy_import( globals(), """ import imp import re import types from bzrlib import ( _format_version_tuple, config, debug, errors, trace, ) from bzrlib.i18n import gettext from bzrlib import plugins as _mod_plugins """) DEFAULT_PLUGIN_PATH = None _loaded = False _plugins_disabled = False plugin_warnings = {} # Map from plugin name, to list of string warnings about eg plugin # dependencies.
from __future__ import absolute_import import os import sys from StringIO import StringIO from bzrlib.lazy_import import lazy_import lazy_import(globals(), """ import errno import subprocess from bzrlib import ( config, errors, trace, ui, ) from bzrlib.i18n import ( gettext, ngettext, ) """) from bzrlib.symbol_versioning import ( deprecated_in, deprecated_method, ) #verification results SIGNATURE_VALID = 0
* context is an optional ContentFilterContent object (possibly None) providing converters access to interesting information, e.g. the relative path of the file. Note that context is currently only supported for write converters. """ from __future__ import absolute_import from cStringIO import StringIO from bzrlib.lazy_import import lazy_import lazy_import(globals(), """ from bzrlib import ( config, errors, osutils, registry, ) """) from bzrlib.symbol_versioning import ( deprecated_function, deprecated_in, ) class ContentFilter(object): def __init__(self, reader, writer): """Create a filter that converts content while reading and writing. :param reader: function for converting convenience to canonical content
# # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA """GPG signing and checking logic.""" import os import sys from bzrlib.lazy_import import lazy_import lazy_import( globals(), """ import errno import subprocess from bzrlib import ( errors, trace, ui, ) """) class DisabledGPGStrategy(object): """A GPG Strategy that makes everything fail.""" def __init__(self, ignored): """Real strategies take a configuration.""" def sign(self, content): raise errors.SigningFailed('Signing is disabled.')
# GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA from __future__ import absolute_import from bzrlib.lazy_import import lazy_import lazy_import( globals(), """ import bisect import datetime from bzrlib import ( branch as _mod_branch, osutils, revision, symbol_versioning, workingtree, ) from bzrlib.i18n import gettext """) from bzrlib import ( errors, lazy_regex, registry, trace, )
# GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA """Ping plugin for bzr.""" from __future__ import absolute_import from bzrlib.commands import Command from bzrlib.lazy_import import lazy_import lazy_import(globals(), """ from bzrlib import errors from bzrlib.smart.client import _SmartClient from bzrlib.transport import get_transport """) class cmd_ping(Command): """Pings a Bazaar smart server. This command sends a 'hello' request to the given location using the bzr smart protocol, and reports the response. """ takes_args = ['location'] def run(self, location): transport = get_transport(location)
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA from __future__ import absolute_import from bzrlib.lazy_import import lazy_import lazy_import(globals(), """ import warnings from bzrlib import ( counted_lock, errors, lock, osutils, transactions, urlutils, ) """) from bzrlib.decorators import ( only_raises, ) class LockableFiles(object): """Object representing a set of related files locked within the same scope. This coordinates access to the lock along with providing a transaction.
# along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # TODO: For things like --diff-prefix, we want a way to customize the display # of the option argument. from __future__ import absolute_import import optparse import re from bzrlib.lazy_import import lazy_import lazy_import(globals(), """ from bzrlib import ( errors, revisionspec, i18n, ) """) from bzrlib import ( registry as _mod_registry, ) def _parse_revision_str(revstr): """This handles a revision string -> revno. This always returns a list. The list will have one element for each revision specifier supplied.
# # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA from __future__ import absolute_import import os from bzrlib.lazy_import import lazy_import lazy_import( globals(), """ import stat import warnings from bzrlib import ( errors, osutils, symbol_versioning, ) """) # not forksafe - but we dont fork. _pid = os.getpid() _hostname = None class AtomicFile(object): """A file that does an atomic-rename to move into place. This also causes hardlinks to break when it's written out.
""" import os import sys from bzrlib.lazy_import import lazy_import lazy_import(globals(), """ import errno from fnmatch import fnmatch import re from cStringIO import StringIO import bzrlib from bzrlib import ( debug, errors, mail_client, osutils, symbol_versioning, trace, ui, urlutils, win32utils, ) from bzrlib.util.configobj import configobj """) CHECK_IF_POSSIBLE=0 CHECK_ALWAYS=1 CHECK_NEVER=2
# FIXME: Sometimes we will be given a parents list for a revision # that includes some redundant parents (i.e. already a parent of # something in the list.) We should eliminate them. This can # be done fairly efficiently because the sequence numbers constrain # the possible relationships. # FIXME: the conflict markers should be *7* characters from copy import copy from cStringIO import StringIO import os from bzrlib.lazy_import import lazy_import lazy_import(globals(), """ from bzrlib import tsort """) from bzrlib import ( errors, osutils, ) from bzrlib.errors import ( WeaveError, WeaveFormatError, WeaveParentMismatch, RevisionAlreadyPresent, RevisionNotPresent, UnavailableRepresentation, ) from bzrlib.osutils import dirname, sha, sha_strings, split_lines import bzrlib.patiencediff
Standard text command-line interface, with stdin, stdout, stderr. May make more or less advanced use of them, eg in drawing progress bars, depending on the detected capabilities of the terminal. GUIs may choose to subclass this so that unimplemented methods fall back to working through the terminal. """ from __future__ import absolute_import import warnings from bzrlib.lazy_import import lazy_import lazy_import(globals(), """ from bzrlib import ( config, osutils, progress, trace, ) """) _valid_boolean_strings = dict(yes=True, no=False, y=True, n=False, on=True, off=False, true=True, false=False) _valid_boolean_strings['1'] = True _valid_boolean_strings['0'] = False def bool_from_string(s, accepted_values=None): """Returns a boolean if the string can be interpreted as such.
# (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA from bzrlib.lazy_import import lazy_import lazy_import(globals(), """ from bzrlib import ( debug, ) from bzrlib.store import revision from bzrlib.store.revision.knit import KnitRevisionStore """) from bzrlib import ( bzrdir, errors, knit, lockable_files, lockdir, osutils, symbol_versioning, transactions, xml5, xml6, xml7,
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA from StringIO import StringIO from bzrlib.lazy_import import lazy_import lazy_import( globals(), """ from bzrlib import ( errors, urlutils, ) from bzrlib.bundle import serializer as _serializer from bzrlib.transport import ( do_catching_redirections, get_transport, ) """) from bzrlib.trace import note def read_bundle_from_url(url): return read_mergeable_from_url(url, _do_directive=False) def read_mergeable_from_url(url, _do_directive=True, possible_transports=None): """Read mergable object from a given URL.
# TODO: Specific "examples" property on commands for consistent formatting. import os import sys from bzrlib.lazy_import import lazy_import lazy_import(globals(), """ import errno import threading import bzrlib from bzrlib import ( config, cleanup, cmdline, debug, errors, i18n, option, osutils, trace, ui, ) """) from bzrlib.hooks import Hooks from bzrlib.i18n import gettext # Compatibility - Option used to be in commands. from bzrlib.option import Option from bzrlib.plugin import disable_plugins, load_plugins from bzrlib import registry
from bzrlib.ui.text import TextProgressView, TextUIFactory from bzrlib.plugins.qbzr.lib.trace import (report_exception, SUB_LOAD_METHOD) from bzrlib.lazy_import import lazy_import lazy_import( globals(), ''' import codecs import re import shlex import signal import tempfile import thread from bzrlib import ( bencode, commands, errors, osutils, ui, ) from bzrlib.bzrdir import BzrDir from bzrlib.plugins.qbzr.lib.commit import CommitWindow from bzrlib.plugins.qbzr.lib.revert import RevertWindow from bzrlib.plugins.qbzr.lib.shelvewindow import ShelveWindow from bzrlib.plugins.qbzr.lib.conflicts import ConflictsWindow ''') # Subprocess service messages markers SUB_PROGRESS = "qbzr:PROGRESS:" SUB_GETPASS = "******"
# bzrlib from bzrlib.lazy_import import lazy_import # Importing from peak.util.imports import importString lazy_import(globals(), """ # stdlib import argparse, glob, json, logging, os, subprocess, sys, tempfile, time from contextlib import closing from datetime import datetime # Bunch from bunch import Bunch # SQLAlchemy import sqlalchemy from sqlalchemy import orm # import sessionmaker # Zato from zato import common from zato.common import odb #.odb import engine_def, version_raw from zato.common import util #.util import fs_safe_now from zato.common.crypto import CryptoManager """) ################################################################################ ZATO_INFO_FILE = b'.zato-info' _opts_odb_type = 'Operational database type, must be one of {}'.format(odb.SUPPORTED_DB_TYPES) # noqa
LockContention, LockCorrupt, LockFailed, LockNotHeld, NoSuchFile, PathError, ResourceBusy, TransportError, ) from bzrlib.trace import mutter, note from bzrlib.osutils import format_delta, rand_chars, get_host_name from bzrlib.i18n import gettext from bzrlib.lazy_import import lazy_import lazy_import(globals(), """ from bzrlib import rio """) # XXX: At the moment there is no consideration of thread safety on LockDir # objects. This should perhaps be updated - e.g. if two threads try to take a # lock at the same time they should *both* get it. But then that's unlikely # to be a good idea. # TODO: Perhaps store some kind of note like the bzr command line in the lock # info? # TODO: Some kind of callback run while polling a lock to show progress # indicators. # TODO: Make sure to pass the right file and directory mode bits to all # files/dirs created.
# -*- coding: utf-8 -*- """ Copyright (C) 2010 Dariusz Suchojad <dsuch at zato.io> Licensed under LGPLv3, see LICENSE.txt for terms and conditions. """ from __future__ import absolute_import, division, print_function, unicode_literals # Zato from zato.cli import ZatoCommand from zato.common import ZATO_INFO_FILE # bzrlib from bzrlib.lazy_import import lazy_import lazy_import(globals(), """ # stdlib import json, os """) class ComponentVersion(ZatoCommand): file_needed = ZATO_INFO_FILE def execute(self, args): info = json.load(open(os.path.join(args.path, self.file_needed))) # noqa self.logger.info(info['version'])
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA from bzrlib.lazy_import import lazy_import lazy_import(globals(), """ import errno import itertools import os from StringIO import StringIO from bzrlib import ( errors, patiencediff, trace, ui, ) from bzrlib.util import bencode """) from bzrlib.tuned_gzip import GzipFile def topo_iter_keys(vf, keys=None): if keys is None: keys = vf.keys() parents = vf.get_parent_map(keys) return _topo_iter(parents, keys)
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA """Support for plugin hooking logic.""" from __future__ import absolute_import from bzrlib import ( registry, symbol_versioning, ) from bzrlib.lazy_import import lazy_import lazy_import( globals(), """ import textwrap from bzrlib import ( _format_version_tuple, errors, pyutils, ) from bzrlib.i18n import gettext """) class KnownHooksRegistry(registry.Registry): # known_hooks registry contains # tuple of (module, member name) which is the hook point # module where the specific hooks are defined # callable to get the empty specific Hooks for that attribute def register_lazy_hook(self, hook_module_name, hook_member_name, hook_factory_member_name):
from bzrlib.plugins.qbzr.lib.uifactory import ui_current_widget from bzrlib.plugins.qbzr.lib.trace import reports_exception from bzrlib.plugins.qbzr.lib.logwidget import LogList from bzrlib.plugins.qbzr.lib.lazycachedrevloader import (load_revisions, cached_revisions) from bzrlib.plugins.qbzr.lib.texteditannotate import (AnnotateBarBase, AnnotateEditerFrameBase) from bzrlib.lazy_import import lazy_import lazy_import( globals(), ''' from bzrlib.config import parse_username from bzrlib.workingtree import WorkingTree from bzrlib.revisiontree import RevisionTree from bzrlib.plugins.qbzr.lib.revisionmessagebrowser import LogListRevisionMessageBrowser from bzrlib.plugins.qbzr.lib.encoding_selector import EncodingMenuSelector from bzrlib.plugins.qbzr.lib.widgets.tab_width_selector import TabWidthMenuSelector from bzrlib.plugins.qbzr.lib.syntaxhighlighter import highlight_document from bzrlib.plugins.qbzr.lib.revtreeview import paint_revno, get_text_color from bzrlib.plugins.qbzr.lib import logmodel from bzrlib.plugins.qbzr.lib.loggraphviz import BranchInfo from bzrlib.patiencediff import PatienceSequenceMatcher as SequenceMatcher ''') class AnnotateBar(AnnotateBarBase): def __init__(self, edit, parent, get_revno): super(AnnotateBar, self).__init__(edit, parent) self.get_revno = get_revno self.annotate = None self.rev_colors = {}
) from bzrlib.lazy_import import lazy_import lazy_import(globals(), """ import os import warnings from bzrlib import ( errors, graph, lockable_files, lockdir, osutils, revision as _mod_revision, trace, ui, urlutils, versionedfile, weave, xml5, ) from bzrlib.i18n import gettext from bzrlib.store.versioned import VersionedFileStore from bzrlib.transactions import WriteTransaction from bzrlib.transport import ( get_transport, local, ) from bzrlib.plugins.weave_fmt import xml4 """)
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA """A collection of function for handling URL operations.""" from __future__ import absolute_import import os import re import sys from bzrlib.lazy_import import lazy_import lazy_import(globals(), """ from posixpath import split as _posix_split import urlparse from bzrlib import ( errors, osutils, ) """) def basename(url, exclude_trailing_slash=True): """Return the last component of a URL. :param url: The URL in question :param exclude_trailing_slash: If the url looks like "path/to/foo/" ignore the final slash and return 'foo' rather than '' :return: Just the final component of the URL. This can return '' if you don't exclude_trailing_slash, or if you are at the root of the URL.
# This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA """Command which looks for unsigned commits by the current user, and signs them. """ from bzrlib.lazy_import import lazy_import lazy_import( globals(), """ from bzrlib import ( config, gpg, ) from bzrlib.bzrdir import BzrDir """) from bzrlib.commands import Command from bzrlib.option import Option class cmd_sign_my_commits(Command): """Sign all commits by a given committer. If location is not specified the local tree is used. If committer is not specified the default committer is used. This does not sign commits that already have signatures. """
""" from __future__ import absolute_import import os import sys import time from bzrlib.lazy_import import lazy_import lazy_import(globals(), """ import codecs import getpass import warnings from bzrlib import ( config, debug, progress, osutils, trace, ) """) from bzrlib.ui import ( UIFactory, NullProgressView, ) class _ChooseUI(object):