Example #1
0
 def search_missing_revision_ids(
         self,
         revision_id=symbol_versioning.DEPRECATED_PARAMETER,
         find_ghosts=True,
         revision_ids=None,
         if_present_ids=None,
         limit=None):
     """See InterRepository.search_missing_revision_ids()."""
     # we want all revisions to satisfy revision_id in source.
     # but we don't want to stat every file here and there.
     # we want then, all revisions other needs to satisfy revision_id
     # checked, but not those that we have locally.
     # so the first thing is to get a subset of the revisions to
     # satisfy revision_id in source, and then eliminate those that
     # we do already have.
     # this is slow on high latency connection to self, but as this
     # disk format scales terribly for push anyway due to rewriting
     # inventory.weave, this is considered acceptable.
     # - RBC 20060209
     if symbol_versioning.deprecated_passed(revision_id):
         symbol_versioning.warn(
             'search_missing_revision_ids(revision_id=...) was '
             'deprecated in 2.4.  Use revision_ids=[...] instead.',
             DeprecationWarning,
             stacklevel=2)
         if revision_ids is not None:
             raise AssertionError(
                 'revision_ids is mutually exclusive with revision_id')
         if revision_id is not None:
             revision_ids = [revision_id]
     del revision_id
     source_ids_set = self._present_source_revisions_for(
         revision_ids, if_present_ids)
     # source_ids is the worst possible case we may need to pull.
     # now we want to filter source_ids against what we actually
     # have in target, but don't try to check for existence where we know
     # we do not have a revision as that would be pointless.
     target_ids = set(self.target._all_possible_ids())
     possibly_present_revisions = target_ids.intersection(source_ids_set)
     actually_present_revisions = set(
         self.target._eliminate_revisions_not_present(
             possibly_present_revisions))
     required_revisions = source_ids_set.difference(
         actually_present_revisions)
     if revision_ids is not None:
         # we used get_ancestry to determine source_ids then we are assured all
         # revisions referenced are present as they are installed in topological order.
         # and the tip revision was validated by get_ancestry.
         result_set = required_revisions
     else:
         # if we just grabbed the possibly available ids, then
         # we only have an estimate of whats available and need to validate
         # that against the revision records.
         result_set = set(
             self.source._eliminate_revisions_not_present(
                 required_revisions))
     if limit is not None:
         topo_ordered = self.get_graph().iter_topo_order(result_set)
         result_set = set(itertools.islice(topo_ordered, limit))
     return self.source.revision_ids_to_search_result(result_set)
Example #2
0
    def __init__(self, base, userID):
        """Set the base path where files will be stored."""
        self.user = anvillib.acls.UserFS(userID)
        if not base.startswith('file://'):
            symbol_versioning.warn(
                "Instantiating AnvLocalTransport with a filesystem path"
                " is deprecated as of bzr 0.8."
                " Please use bzrlib.transport.get_transport()"
                " or pass in a file:// url.",
                 DeprecationWarning,
                 stacklevel=2
                 )
            base = urlutils.local_path_to_url(base)
        if base[-1] != '/':
            base = base + '/'

        # Special case : windows has no "root", but does have
        # multiple lettered drives inside it. #240910
        if sys.platform == 'win32' and base == 'file:///':
            base = ''
            self._local_base = ''
            super(AnvLocalTransport, self).__init__(base)
            return

        super(AnvLocalTransport, self).__init__(base)
        self._local_base = urlutils.local_path_from_url(base)
Example #3
0
 def update_revprops(revprops, branch, authors=None, author=None,
                     local=False, possible_master_transports=None):
     if revprops is None:
         revprops = {}
     if possible_master_transports is None:
         possible_master_transports = []
     if not 'branch-nick' in revprops:
         revprops['branch-nick'] = branch._get_nick(
             local,
             possible_master_transports)
     if authors is not None:
         if author is not None:
             raise AssertionError('Specifying both author and authors '
                     'is not allowed. Specify just authors instead')
         if 'author' in revprops or 'authors' in revprops:
             # XXX: maybe we should just accept one of them?
             raise AssertionError('author property given twice')
         if authors:
             for individual in authors:
                 if '\n' in individual:
                     raise AssertionError('\\n is not a valid character '
                             'in an author identity')
             revprops['authors'] = '\n'.join(authors)
     if author is not None:
         symbol_versioning.warn('The parameter author was deprecated'
                ' in version 1.13. Use authors instead',
                DeprecationWarning)
         if 'author' in revprops or 'authors' in revprops:
             # XXX: maybe we should just accept one of them?
             raise AssertionError('author property given twice')
         if '\n' in author:
             raise AssertionError('\\n is not a valid character '
                     'in an author identity')
         revprops['authors'] = author
     return revprops
Example #4
0
def is_null(revision_id):
    if revision_id is None:
        symbol_versioning.warn(
            'NULL_REVISION should be used for the null'
            ' revision instead of None, as of bzr 0.90.',
            DeprecationWarning,
            stacklevel=2)
    return revision_id in (None, NULL_REVISION)
Example #5
0
 def started(self, revno, revid, location=None):
     if location is None:
         symbol_versioning.warn(
             "As of bzr 1.0 you must pass a location "
             "to started.",
             DeprecationWarning,
             stacklevel=2)
     pass
Example #6
0
def ensure_null(revision_id):
    """Ensure only NULL_REVISION is used to represent the null revision"""
    if revision_id is None:
        symbol_versioning.warn('NULL_REVISION should be used for the null'
            ' revision instead of None, as of bzr 0.91.',
            DeprecationWarning, stacklevel=2)
        return NULL_REVISION
    else:
        return revision_id
Example #7
0
    def __new__(cls, spec, _internal=False):
        if _internal:
            return object.__new__(cls, spec, _internal=_internal)

        symbol_versioning.warn('Creating a RevisionSpec directly has'
                               ' been deprecated in version 0.11. Use'
                               ' RevisionSpec.from_string()'
                               ' instead.',
                               DeprecationWarning, stacklevel=2)
        return RevisionSpec.from_string(spec)
Example #8
0
def find_unmerged(local_branch,
                  remote_branch,
                  restrict='all',
                  include_merged=None,
                  backward=False,
                  local_revid_range=None,
                  remote_revid_range=None,
                  include_merges=symbol_versioning.DEPRECATED_PARAMETER):
    """Find revisions from each side that have not been merged.

    :param local_branch: Compare the history of local_branch
    :param remote_branch: versus the history of remote_branch, and determine
        mainline revisions which have not been merged.
    :param restrict: ('all', 'local', 'remote') If 'all', we will return the
        unique revisions from both sides. If 'local', we will return None
        for the remote revisions, similarly if 'remote' we will return None for
        the local revisions.
    :param include_merged: Show mainline revisions only if False,
        all revisions otherwise.
    :param backward: Show oldest versions first when True, newest versions
        first when False.
    :param local_revid_range: Revision-id range for filtering local_branch
        revisions (lower bound, upper bound)
    :param remote_revid_range: Revision-id range for filtering remote_branch
        revisions (lower bound, upper bound)
    :param include_merges: Deprecated historical alias for include_merged

    :return: A list of [(revno, revision_id)] for the mainline revisions on
        each side.
    """
    if symbol_versioning.deprecated_passed(include_merges):
        symbol_versioning.warn(
            'include_merges was deprecated in 2.5.'
            ' Use include_merged instead.',
            DeprecationWarning,
            stacklevel=2)
        if include_merged is None:
            include_merged = include_merges
    if include_merged is None:
        include_merged = False
    local_branch.lock_read()
    try:
        remote_branch.lock_read()
        try:
            return _find_unmerged(local_branch,
                                  remote_branch,
                                  restrict=restrict,
                                  include_merged=include_merged,
                                  backward=backward,
                                  local_revid_range=local_revid_range,
                                  remote_revid_range=remote_revid_range)
        finally:
            remote_branch.unlock()
    finally:
        local_branch.unlock()
Example #9
0
def ensure_null(revision_id):
    """Ensure only NULL_REVISION is used to represent the null revision"""
    if revision_id is None:
        symbol_versioning.warn(
            'NULL_REVISION should be used for the null'
            ' revision instead of None, as of bzr 0.91.',
            DeprecationWarning,
            stacklevel=2)
        return NULL_REVISION
    else:
        return revision_id
Example #10
0
 def started(self, revno, rev_id, location=None):
     if location is not None:
         location = ' to: ' + unescape_for_display(location, 'utf-8')
     else:
         # When started was added, location was only made optional by
         # accident.  Matt Nordhoff 20071129
         symbol_versioning.warn("As of bzr 1.0 you must pass a location "
                                "to started.", DeprecationWarning,
                                stacklevel=2)
         location = ''
     self._note('Committing%s', location)
Example #11
0
 def search_missing_revision_ids(self,
         revision_id=symbol_versioning.DEPRECATED_PARAMETER,
         find_ghosts=True, revision_ids=None, if_present_ids=None,
         limit=None):
     """See InterRepository.search_missing_revision_ids()."""
     # we want all revisions to satisfy revision_id in source.
     # but we don't want to stat every file here and there.
     # we want then, all revisions other needs to satisfy revision_id
     # checked, but not those that we have locally.
     # so the first thing is to get a subset of the revisions to
     # satisfy revision_id in source, and then eliminate those that
     # we do already have.
     # this is slow on high latency connection to self, but as this
     # disk format scales terribly for push anyway due to rewriting
     # inventory.weave, this is considered acceptable.
     # - RBC 20060209
     if symbol_versioning.deprecated_passed(revision_id):
         symbol_versioning.warn(
             'search_missing_revision_ids(revision_id=...) was '
             'deprecated in 2.4.  Use revision_ids=[...] instead.',
             DeprecationWarning, stacklevel=2)
         if revision_ids is not None:
             raise AssertionError(
                 'revision_ids is mutually exclusive with revision_id')
         if revision_id is not None:
             revision_ids = [revision_id]
     del revision_id
     source_ids_set = self._present_source_revisions_for(
         revision_ids, if_present_ids)
     # source_ids is the worst possible case we may need to pull.
     # now we want to filter source_ids against what we actually
     # have in target, but don't try to check for existence where we know
     # we do not have a revision as that would be pointless.
     target_ids = set(self.target._all_possible_ids())
     possibly_present_revisions = target_ids.intersection(source_ids_set)
     actually_present_revisions = set(
         self.target._eliminate_revisions_not_present(possibly_present_revisions))
     required_revisions = source_ids_set.difference(actually_present_revisions)
     if revision_ids is not None:
         # we used get_ancestry to determine source_ids then we are assured all
         # revisions referenced are present as they are installed in topological order.
         # and the tip revision was validated by get_ancestry.
         result_set = required_revisions
     else:
         # if we just grabbed the possibly available ids, then
         # we only have an estimate of whats available and need to validate
         # that against the revision records.
         result_set = set(
             self.source._eliminate_revisions_not_present(required_revisions))
     if limit is not None:
         topo_ordered = self.get_graph().iter_topo_order(result_set)
         result_set = set(itertools.islice(topo_ordered, limit))
     return self.source.revision_ids_to_search_result(result_set)
Example #12
0
 def _ensure(self):
     if self._feature is None:
         from bzrlib import pyutils
         depr_msg = self._dep_version % ('%s.%s'
                                         % (self._module, self._name))
         use_msg = ' Use %s.%s instead.' % (self._replacement_module,
                                            self._replacement_name)
         symbol_versioning.warn(depr_msg + use_msg, DeprecationWarning,
                                stacklevel=5)
         # Import the new feature and use it as a replacement for the
         # deprecated one.
         self._feature = pyutils.get_named_object(
             self._replacement_module, self._replacement_name)
Example #13
0
def safe_revision_id(unicode_or_utf8_string, warn=True):
    """Revision ids should now be utf8, but at one point they were unicode.

    :param unicode_or_utf8_string: A possibly Unicode revision_id. (can also be
        utf8 or None).
    :param warn: Functions that are sanitizing user data can set warn=False
    :return: None or a utf8 revision id.
    """
    if (unicode_or_utf8_string is None
        or unicode_or_utf8_string.__class__ == str):
        return unicode_or_utf8_string
    if warn:
        symbol_versioning.warn(_revision_id_warning, DeprecationWarning,
                               stacklevel=2)
    return cache_utf8.encode(unicode_or_utf8_string)
Example #14
0
def find_unmerged(local_branch, remote_branch, restrict='all',
                  include_merged=None, backward=False,
                  local_revid_range=None, remote_revid_range=None,
                  include_merges=symbol_versioning.DEPRECATED_PARAMETER):
    """Find revisions from each side that have not been merged.

    :param local_branch: Compare the history of local_branch
    :param remote_branch: versus the history of remote_branch, and determine
        mainline revisions which have not been merged.
    :param restrict: ('all', 'local', 'remote') If 'all', we will return the
        unique revisions from both sides. If 'local', we will return None
        for the remote revisions, similarly if 'remote' we will return None for
        the local revisions.
    :param include_merged: Show mainline revisions only if False,
        all revisions otherwise.
    :param backward: Show oldest versions first when True, newest versions
        first when False.
    :param local_revid_range: Revision-id range for filtering local_branch
        revisions (lower bound, upper bound)
    :param remote_revid_range: Revision-id range for filtering remote_branch
        revisions (lower bound, upper bound)
    :param include_merges: Deprecated historical alias for include_merged

    :return: A list of [(revno, revision_id)] for the mainline revisions on
        each side.
    """
    if symbol_versioning.deprecated_passed(include_merges):
        symbol_versioning.warn(
            'include_merges was deprecated in 2.5.'
            ' Use include_merged instead.',
            DeprecationWarning, stacklevel=2)
        if include_merged is None:
            include_merged = include_merges
    if include_merged is None:
        include_merged = False
    local_branch.lock_read()
    try:
        remote_branch.lock_read()
        try:
            return _find_unmerged(
                local_branch, remote_branch, restrict=restrict,
                include_merged=include_merged, backward=backward,
                local_revid_range=local_revid_range,
                remote_revid_range=remote_revid_range)
        finally:
            remote_branch.unlock()
    finally:
        local_branch.unlock()
Example #15
0
def safe_revision_id(unicode_or_utf8_string, warn=True):
    """Revision ids should now be utf8, but at one point they were unicode.

    :param unicode_or_utf8_string: A possibly Unicode revision_id. (can also be
        utf8 or None).
    :param warn: Functions that are sanitizing user data can set warn=False
    :return: None or a utf8 revision id.
    """
    if (unicode_or_utf8_string is None
            or unicode_or_utf8_string.__class__ == str):
        return unicode_or_utf8_string
    if warn:
        symbol_versioning.warn(_revision_id_warning,
                               DeprecationWarning,
                               stacklevel=2)
    return cache_utf8.encode(unicode_or_utf8_string)
Example #16
0
def safe_file_id(unicode_or_utf8_string, warn=True):
    """File ids should now be utf8, but at one point they were unicode.

    This is the same as safe_utf8, except it uses the cached encode functions
    to save a little bit of performance.

    :param unicode_or_utf8_string: A possibly Unicode file_id. (can also be
        utf8 or None).
    :param warn: Functions that are sanitizing user data can set warn=False
    :return: None or a utf8 file id.
    """
    if (unicode_or_utf8_string is None
        or unicode_or_utf8_string.__class__ == str):
        return unicode_or_utf8_string
    if warn:
        symbol_versioning.warn(_file_id_warning, DeprecationWarning,
                               stacklevel=2)
    return cache_utf8.encode(unicode_or_utf8_string)
Example #17
0
    def __init__(self, spec, _internal=False):
        """Create a RevisionSpec referring to the Null revision.

        :param spec: The original spec supplied by the user
        :param _internal: Used to ensure that RevisionSpec is not being
            called directly. Only from RevisionSpec.from_string()
        """
        if not _internal:
            # XXX: Update this after 0.10 is released
            symbol_versioning.warn('Creating a RevisionSpec directly has'
                                   ' been deprecated in version 0.11. Use'
                                   ' RevisionSpec.from_string()'
                                   ' instead.',
                                   DeprecationWarning, stacklevel=2)
        self.user_spec = spec
        if self.prefix and spec.startswith(self.prefix):
            spec = spec[len(self.prefix):]
        self.spec = spec
Example #18
0
def safe_file_id(unicode_or_utf8_string, warn=True):
    """File ids should now be utf8, but at one point they were unicode.

    This is the same as safe_utf8, except it uses the cached encode functions
    to save a little bit of performance.

    :param unicode_or_utf8_string: A possibly Unicode file_id. (can also be
        utf8 or None).
    :param warn: Functions that are sanitizing user data can set warn=False
    :return: None or a utf8 file id.
    """
    if (unicode_or_utf8_string is None
            or unicode_or_utf8_string.__class__ == str):
        return unicode_or_utf8_string
    if warn:
        symbol_versioning.warn(_file_id_warning,
                               DeprecationWarning,
                               stacklevel=2)
    return cache_utf8.encode(unicode_or_utf8_string)
Example #19
0
 def update_revprops(revprops,
                     branch,
                     authors=None,
                     author=None,
                     local=False,
                     possible_master_transports=None):
     if revprops is None:
         revprops = {}
     if possible_master_transports is None:
         possible_master_transports = []
     if not 'branch-nick' in revprops:
         revprops['branch-nick'] = branch._get_nick(
             local, possible_master_transports)
     if authors is not None:
         if author is not None:
             raise AssertionError(
                 'Specifying both author and authors '
                 'is not allowed. Specify just authors instead')
         if 'author' in revprops or 'authors' in revprops:
             # XXX: maybe we should just accept one of them?
             raise AssertionError('author property given twice')
         if authors:
             for individual in authors:
                 if '\n' in individual:
                     raise AssertionError('\\n is not a valid character '
                                          'in an author identity')
             revprops['authors'] = '\n'.join(authors)
     if author is not None:
         symbol_versioning.warn(
             'The parameter author was deprecated'
             ' in version 1.13. Use authors instead', DeprecationWarning)
         if 'author' in revprops or 'authors' in revprops:
             # XXX: maybe we should just accept one of them?
             raise AssertionError('author property given twice')
         if '\n' in author:
             raise AssertionError('\\n is not a valid character '
                                  'in an author identity')
         revprops['authors'] = author
     return revprops
Example #20
0
 def __init__(self, *args, **kwargs):
     symbol_versioning.warn(symbol_versioning.deprecated_in(
         (2, 3, 0)) % 'bzrlib.tuned_gzip.GzipFile',
                            DeprecationWarning,
                            stacklevel=2)
     gzip.GzipFile.__init__(self, *args, **kwargs)
Example #21
0
 def started(self, revno, revid, location=None):
     if location is None:
         symbol_versioning.warn("As of bzr 1.0 you must pass a location "
                                "to started.", DeprecationWarning,
                                stacklevel=2)
     pass
Example #22
0
def is_null(revision_id):
    if revision_id is None:
        symbol_versioning.warn('NULL_REVISION should be used for the null'
            ' revision instead of None, as of bzr 0.90.',
            DeprecationWarning, stacklevel=2)
    return revision_id in (None, NULL_REVISION)
Example #23
0
 def __init__(self, *args, **kwargs):
     symbol_versioning.warn(
         symbol_versioning.deprecated_in((2, 3, 0)) % "bzrlib.tuned_gzip.GzipFile", DeprecationWarning, stacklevel=2
     )
     gzip.GzipFile.__init__(self, *args, **kwargs)
Example #24
0
 def __init__(self):
     self._inventory = Inventory(root_id=None)
     symbol_versioning.warn('EmptyTree is deprecated as of bzr 0.9 please'
                            ' use repository.revision_tree instead.',
                            DeprecationWarning, stacklevel=2)