/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/revisionspec.py

  • Committer: Jelmer Vernooij
  • Date: 2017-05-30 19:16:23 UTC
  • mto: This revision was merged to the branch mainline in revision 6639.
  • Revision ID: jelmer@jelmer.uk-20170530191623-t9ls96vjy9wslpoo
Remove deprecated functionality.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
 
25
25
from breezy import (
26
26
    branch as _mod_branch,
 
27
    cache_utf8,
27
28
    osutils,
28
29
    revision,
29
 
    symbol_versioning,
30
30
    workingtree,
31
31
    )
32
32
from breezy.i18n import gettext
109
109
            self.revno, self.rev_id, self.branch)
110
110
 
111
111
    @staticmethod
112
 
    def from_revision_id(branch, revision_id, revs=symbol_versioning.DEPRECATED_PARAMETER):
 
112
    def from_revision_id(branch, revision_id):
113
113
        """Construct a RevisionInfo given just the id.
114
114
 
115
115
        Use this if you don't know or care what the revno is.
116
116
        """
117
 
        if symbol_versioning.deprecated_passed(revs):
118
 
            symbol_versioning.warn(
119
 
                'RevisionInfo.from_revision_id(revs) was deprecated in 2.5.',
120
 
                DeprecationWarning,
121
 
                stacklevel=2)
122
117
        return RevisionInfo(branch, revno=None, rev_id=revision_id)
123
118
 
124
119
 
142
137
    """
143
138
 
144
139
    prefix = None
145
 
    # wants_revision_history has been deprecated in 2.5.
146
 
    wants_revision_history = False
147
140
    dwim_catchable_exceptions = (errors.InvalidRevisionSpec,)
148
141
    """Exceptions that RevisionSpec_dwim._match_on will catch.
149
142
 
185
178
            called directly. Only from RevisionSpec.from_string()
186
179
        """
187
180
        if not _internal:
188
 
            symbol_versioning.warn('Creating a RevisionSpec directly has'
189
 
                                   ' been deprecated in version 0.11. Use'
190
 
                                   ' RevisionSpec.from_string()'
191
 
                                   ' instead.',
192
 
                                   DeprecationWarning, stacklevel=2)
 
181
            raise AssertionError(
 
182
                'Creating a RevisionSpec directly is not supported. '
 
183
                'Use RevisionSpec.from_string() instead.')
193
184
        self.user_spec = spec
194
185
        if self.prefix and spec.startswith(self.prefix):
195
186
            spec = spec[len(self.prefix):]
212
203
            raise errors.InvalidRevisionSpec(self.spec, branch)
213
204
 
214
205
    def in_history(self, branch):
215
 
        if branch:
216
 
            if self.wants_revision_history:
217
 
                symbol_versioning.warn(
218
 
                    "RevisionSpec.wants_revision_history was "
219
 
                    "deprecated in 2.5 (%s)." % self.__class__.__name__,
220
 
                    DeprecationWarning)
221
 
                branch.lock_read()
222
 
                try:
223
 
                    graph = branch.repository.get_graph()
224
 
                    revs = list(graph.iter_lefthand_ancestry(
225
 
                        branch.last_revision(), [revision.NULL_REVISION]))
226
 
                finally:
227
 
                    branch.unlock()
228
 
                revs.reverse()
229
 
            else:
230
 
                revs = None
231
 
        else:
232
 
            # this should never trigger.
233
 
            # TODO: make it a deprecated code path. RBC 20060928
234
 
            revs = None
235
 
        return self._match_on_and_check(branch, revs)
 
206
        return self._match_on_and_check(branch, revs=None)
236
207
 
237
208
        # FIXME: in_history is somewhat broken,
238
209
        # it will return non-history revisions in many
341
312
            except rs_class.dwim_catchable_exceptions:
342
313
                pass
343
314
 
344
 
        # Try the old (deprecated) dwim list:
345
 
        for rs_class in dwim_revspecs:
346
 
            try:
347
 
                return self._try_spectype(rs_class, branch)
348
 
            except rs_class.dwim_catchable_exceptions:
349
 
                pass
350
 
 
351
315
        # Well, I dunno what it is. Note that we don't try to keep track of the
352
316
        # first of last exception raised during the DWIM tries as none seems
353
317
        # really relevant.
502
466
        # self.spec comes straight from parsing the command line arguments,
503
467
        # so we expect it to be a Unicode string. Switch it to the internal
504
468
        # representation.
505
 
        return osutils.safe_revision_id(self.spec, warn=False)
 
469
        if isinstance(self.spec, unicode):
 
470
            return cache_utf8.encode(self.spec)
 
471
        return self.spec
506
472
 
507
473
 
508
474
 
986
952
# The order in which we want to DWIM a revision spec without any prefix.
987
953
# revno is always tried first and isn't listed here, this is used by
988
954
# RevisionSpec_dwim._match_on
989
 
dwim_revspecs = symbol_versioning.deprecated_list(
990
 
    symbol_versioning.deprecated_in((2, 4, 0)), "dwim_revspecs", [])
991
 
 
992
955
RevisionSpec_dwim.append_possible_revspec(RevisionSpec_tag)
993
956
RevisionSpec_dwim.append_possible_revspec(RevisionSpec_revid)
994
957
RevisionSpec_dwim.append_possible_revspec(RevisionSpec_date)