13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
from __future__ import absolute_import
20
from bzrlib.lazy_import import lazy_import
21
lazy_import(globals(), """
22
25
from bzrlib import (
26
branch as _mod_branch,
32
from bzrlib.i18n import gettext
35
43
class RevisionInfo(object):
36
44
"""The results of applying a revision specification to a branch."""
49
57
or treat the result as a tuple.
52
def __init__(self, branch, revno, rev_id=_marker):
60
def __init__(self, branch, revno=None, rev_id=None):
53
61
self.branch = branch
62
self._has_revno = (revno is not None)
65
if self.rev_id is None and self._revno is not None:
56
66
# allow caller to be lazy
57
if self.revno is None:
60
self.rev_id = branch.get_rev_id(self.revno)
67
self.rev_id = branch.get_rev_id(self._revno)
71
if not self._has_revno and self.rev_id is not None:
73
self._revno = self.branch.revision_id_to_revno(self.rev_id)
74
except errors.NoSuchRevision:
76
self._has_revno = True
64
79
def __nonzero__(self):
65
# first the easy ones...
66
80
if self.rev_id is None:
68
if self.revno is not None:
70
82
# TODO: otherwise, it should depend on how I was built -
71
83
# if it's in_history(branch), then check revision_history(),
72
84
# if it's in_store(branch), do the check below
95
107
self.revno, self.rev_id, self.branch)
98
def from_revision_id(branch, revision_id, revs):
110
def from_revision_id(branch, revision_id, revs=symbol_versioning.DEPRECATED_PARAMETER):
99
111
"""Construct a RevisionInfo given just the id.
101
113
Use this if you don't know or care what the revno is.
104
revno = revs.index(revision_id) + 1
107
return RevisionInfo(branch, revno, revision_id)
110
# classes in this list should have a "prefix" attribute, against which
111
# string specs are matched
115
if symbol_versioning.deprecated_passed(revs):
116
symbol_versioning.warn(
117
'RevisionInfo.from_revision_id(revs) was deprecated in 2.5.',
120
return RevisionInfo(branch, revno=None, rev_id=revision_id)
116
123
class RevisionSpec(object):
137
def __new__(cls, spec, _internal=False):
139
return object.__new__(cls, spec, _internal=_internal)
141
symbol_versioning.warn('Creating a RevisionSpec directly has'
142
' been deprecated in version 0.11. Use'
143
' RevisionSpec.from_string()'
145
DeprecationWarning, stacklevel=2)
146
return RevisionSpec.from_string(spec)
143
# wants_revision_history has been deprecated in 2.5.
144
wants_revision_history = False
145
dwim_catchable_exceptions = (errors.InvalidRevisionSpec,)
146
"""Exceptions that RevisionSpec_dwim._match_on will catch.
148
If the revspec is part of ``dwim_revspecs``, it may be tried with an
149
invalid revspec and raises some exception. The exceptions mentioned here
150
will not be reported to the user but simply ignored without stopping the
149
155
def from_string(spec):
160
166
return RevisionSpec(None, _internal=True)
162
assert isinstance(spec, basestring), \
163
"You should only supply strings not %s" % (type(spec),)
165
for spectype in SPEC_TYPES:
166
if spec.startswith(spectype.prefix):
167
trace.mutter('Returning RevisionSpec %s for %s',
168
spectype.__name__, spec)
169
return spectype(spec, _internal=True)
167
match = revspec_registry.get_prefix(spec)
168
if match is not None:
169
spectype, specsuffix = match
170
trace.mutter('Returning RevisionSpec %s for %s',
171
spectype.__name__, spec)
172
return spectype(spec, _internal=True)
171
# RevisionSpec_revno is special cased, because it is the only
172
# one that directly handles plain integers
173
# TODO: This should not be special cased rather it should be
174
# a method invocation on spectype.canparse()
176
if _revno_regex is None:
177
_revno_regex = re.compile(r'^(?:(\d+(\.\d+)*)|-\d+)(:.*)?$')
178
if _revno_regex.match(spec) is not None:
179
return RevisionSpec_revno(spec, _internal=True)
181
raise errors.NoSuchRevisionSpec(spec)
174
# Otherwise treat it as a DWIM, build the RevisionSpec object and
175
# wait for _match_on to be called.
176
return RevisionSpec_dwim(spec, _internal=True)
183
178
def __init__(self, spec, _internal=False):
184
179
"""Create a RevisionSpec referring to the Null revision.
233
241
# will do what you expect.
234
242
in_store = in_history
235
243
in_branch = in_store
245
def as_revision_id(self, context_branch):
246
"""Return just the revision_id for this revisions spec.
248
Some revision specs require a context_branch to be able to determine
249
their value. Not all specs will make use of it.
251
return self._as_revision_id(context_branch)
253
def _as_revision_id(self, context_branch):
254
"""Implementation of as_revision_id()
256
Classes should override this function to provide appropriate
257
functionality. The default is to just call '.in_history().rev_id'
259
return self.in_history(context_branch).rev_id
261
def as_tree(self, context_branch):
262
"""Return the tree object for this revisions spec.
264
Some revision specs require a context_branch to be able to determine
265
the revision id and access the repository. Not all specs will make
268
return self._as_tree(context_branch)
270
def _as_tree(self, context_branch):
271
"""Implementation of as_tree().
273
Classes should override this function to provide appropriate
274
functionality. The default is to just call '.as_revision_id()'
275
and get the revision tree from context_branch's repository.
277
revision_id = self.as_revision_id(context_branch)
278
return context_branch.repository.revision_tree(revision_id)
237
280
def __repr__(self):
238
281
# this is mostly for helping with testing
239
282
return '<%s %s>' % (self.__class__.__name__,
242
285
def needs_branch(self):
243
286
"""Whether this revision spec needs a branch.
302
class RevisionSpec_dwim(RevisionSpec):
303
"""Provides a DWIMish revision specifier lookup.
305
Note that this does not go in the revspec_registry because by definition
306
there is no prefix to identify it. It's solely called from
307
RevisionSpec.from_string() because the DWIMification happen when _match_on
308
is called so the string describing the revision is kept here until needed.
313
_revno_regex = lazy_regex.lazy_compile(r'^(?:(\d+(\.\d+)*)|-\d+)(:.*)?$')
315
# The revspecs to try
316
_possible_revspecs = []
318
def _try_spectype(self, rstype, branch):
319
rs = rstype(self.spec, _internal=True)
320
# Hit in_history to find out if it exists, or we need to try the
322
return rs.in_history(branch)
324
def _match_on(self, branch, revs):
325
"""Run the lookup and see what we can get."""
327
# First, see if it's a revno
328
if self._revno_regex.match(self.spec) is not None:
330
return self._try_spectype(RevisionSpec_revno, branch)
331
except RevisionSpec_revno.dwim_catchable_exceptions:
334
# Next see what has been registered
335
for objgetter in self._possible_revspecs:
336
rs_class = objgetter.get_obj()
338
return self._try_spectype(rs_class, branch)
339
except rs_class.dwim_catchable_exceptions:
342
# Try the old (deprecated) dwim list:
343
for rs_class in dwim_revspecs:
345
return self._try_spectype(rs_class, branch)
346
except rs_class.dwim_catchable_exceptions:
349
# Well, I dunno what it is. Note that we don't try to keep track of the
350
# first of last exception raised during the DWIM tries as none seems
352
raise errors.InvalidRevisionSpec(self.spec, branch)
355
def append_possible_revspec(cls, revspec):
356
"""Append a possible DWIM revspec.
358
:param revspec: Revision spec to try.
360
cls._possible_revspecs.append(registry._ObjectGetter(revspec))
363
def append_possible_lazy_revspec(cls, module_name, member_name):
364
"""Append a possible lazily loaded DWIM revspec.
366
:param module_name: Name of the module with the revspec
367
:param member_name: Name of the revspec within the module
369
cls._possible_revspecs.append(
370
registry._LazyObjectGetter(module_name, member_name))
259
373
class RevisionSpec_revno(RevisionSpec):
260
374
"""Selects a revision using a number."""
262
376
help_txt = """Selects a revision using a number.
264
378
Use an integer to specify a revision in the history of the branch.
265
Optionally a branch can be specified. The 'revno:' prefix is optional.
266
A negative number will count from the end of the branch (-1 is the
267
last revision, -2 the previous one). If the negative number is larger
268
than the branch's history, the first revision is returned.
270
revno:1 -> return the first revision
379
Optionally a branch can be specified. A negative number will count
380
from the end of the branch (-1 is the last revision, -2 the previous
381
one). If the negative number is larger than the branch's history, the
382
first revision is returned.
385
revno:1 -> return the first revision of this branch
271
386
revno:3:/path/to/branch -> return the 3rd revision of
272
387
the branch '/path/to/branch'
273
388
revno:-1 -> The last revision in a branch.
312
# the user has override the branch to look in.
313
# we need to refresh the revision_history map and
315
from bzrlib.branch import Branch
316
branch = Branch.open(branch_spec)
317
# Need to use a new revision history
318
# because we are using a specific branch
319
revs = branch.revision_history()
431
# the user has overriden the branch to look in.
432
branch = _mod_branch.Branch.open(branch_spec)
324
revision_id_to_revno = branch.get_revision_id_to_revno_map()
325
revisions = [revision_id for revision_id, revno
326
in revision_id_to_revno.iteritems()
327
if revno == match_revno]
330
if len(revisions) != 1:
331
return RevisionInfo(branch, None, None)
436
revision_id = branch.dotted_revno_to_revision_id(match_revno,
438
except errors.NoSuchRevision:
439
raise errors.InvalidRevisionSpec(self.user_spec, branch)
333
441
# there is no traditional 'revno' for dotted-decimal revnos.
334
# so for API compatability we return None.
335
return RevisionInfo(branch, None, revisions[0])
442
# so for API compatibility we return None.
443
return branch, None, revision_id
445
last_revno, last_revision_id = branch.last_revision_info()
338
447
# if get_rev_id supported negative revnos, there would not be a
339
448
# need for this special case.
340
if (-revno) >= len(revs):
449
if (-revno) >= last_revno:
343
revno = len(revs) + revno + 1
452
revno = last_revno + revno + 1
345
revision_id = branch.get_rev_id(revno, revs)
454
revision_id = branch.get_rev_id(revno)
346
455
except errors.NoSuchRevision:
347
456
raise errors.InvalidRevisionSpec(self.user_spec, branch)
348
return RevisionInfo(branch, revno, revision_id)
457
return branch, revno, revision_id
459
def _as_revision_id(self, context_branch):
460
# We would have the revno here, but we don't really care
461
branch, revno, revision_id = self._lookup(context_branch)
350
464
def needs_branch(self):
351
465
return self.spec.find(':') == -1
357
471
return self.spec[self.spec.find(':')+1:]
360
474
RevisionSpec_int = RevisionSpec_revno
362
SPEC_TYPES.append(RevisionSpec_revno)
365
class RevisionSpec_revid(RevisionSpec):
477
class RevisionIDSpec(RevisionSpec):
479
def _match_on(self, branch, revs):
480
revision_id = self.as_revision_id(branch)
481
return RevisionInfo.from_revision_id(branch, revision_id)
484
class RevisionSpec_revid(RevisionIDSpec):
366
485
"""Selects a revision using the revision id."""
368
487
help_txt = """Selects a revision using the revision id.
370
489
Supply a specific revision id, that can be used to specify any
371
revision id in the ancestry of the branch.
490
revision id in the ancestry of the branch.
372
491
Including merges, and pending merges.
374
494
revid:aaaa@bbbb-123456789 -> Select revision 'aaaa@bbbb-123456789'
376
497
prefix = 'revid:'
378
def _match_on(self, branch, revs):
499
def _as_revision_id(self, context_branch):
379
500
# self.spec comes straight from parsing the command line arguments,
380
501
# so we expect it to be a Unicode string. Switch it to the internal
381
502
# representation.
382
revision_id = osutils.safe_revision_id(self.spec, warn=False)
383
return RevisionInfo.from_revision_id(branch, revision_id, revs)
503
return osutils.safe_revision_id(self.spec, warn=False)
385
SPEC_TYPES.append(RevisionSpec_revid)
388
507
class RevisionSpec_last(RevisionSpec):
393
512
Supply a positive number to get the nth revision from the end.
394
513
This is the same as supplying negative numbers to the 'revno:' spec.
396
516
last:1 -> return the last revision
397
517
last:3 -> return the revision 2 before the end.
402
522
def _match_on(self, branch, revs):
523
revno, revision_id = self._revno_and_revision_id(branch)
524
return RevisionInfo(branch, revno, revision_id)
526
def _revno_and_revision_id(self, context_branch):
527
last_revno, last_revision_id = context_branch.last_revision_info()
403
529
if self.spec == '':
405
raise errors.NoCommits(branch)
406
return RevisionInfo(branch, len(revs), revs[-1])
531
raise errors.NoCommits(context_branch)
532
return last_revno, last_revision_id
409
535
offset = int(self.spec)
410
536
except ValueError, e:
411
raise errors.InvalidRevisionSpec(self.user_spec, branch, e)
537
raise errors.InvalidRevisionSpec(self.user_spec, context_branch, e)
414
raise errors.InvalidRevisionSpec(self.user_spec, branch,
540
raise errors.InvalidRevisionSpec(self.user_spec, context_branch,
415
541
'you must supply a positive value')
416
revno = len(revs) - offset + 1
543
revno = last_revno - offset + 1
418
revision_id = branch.get_rev_id(revno, revs)
545
revision_id = context_branch.get_rev_id(revno)
419
546
except errors.NoSuchRevision:
420
raise errors.InvalidRevisionSpec(self.user_spec, branch)
421
return RevisionInfo(branch, revno, revision_id)
423
SPEC_TYPES.append(RevisionSpec_last)
547
raise errors.InvalidRevisionSpec(self.user_spec, context_branch)
548
return revno, revision_id
550
def _as_revision_id(self, context_branch):
551
# We compute the revno as part of the process, but we don't really care
553
revno, revision_id = self._revno_and_revision_id(context_branch)
426
558
class RevisionSpec_before(RevisionSpec):
429
561
help_txt = """Selects the parent of the revision specified.
431
Supply any revision spec to return the parent of that revision.
563
Supply any revision spec to return the parent of that revision. This is
564
mostly useful when inspecting revisions that are not in the revision history
432
567
It is an error to request the parent of the null revision (before:0).
433
This is mostly useful when inspecting revisions that are not in the
434
revision history of a branch.
437
571
before:1913 -> Return the parent of revno 1913 (revno 1912)
438
572
before:revid:aaaa@bbbb-1234567890 -> return the parent of revision
439
573
aaaa@bbbb-1234567890
440
bzr diff -r before:revid:aaaa..revid:aaaa
441
-> Find the changes between revision 'aaaa' and its parent.
442
(what changes did 'aaaa' introduce)
574
bzr diff -r before:1913..1913
575
-> Find the changes between revision 1913 and its parent (1912).
576
(What changes did revision 1913 introduce).
577
This is equivalent to: bzr diff -c 1913
445
580
prefix = 'before:'
447
582
def _match_on(self, branch, revs):
448
583
r = RevisionSpec.from_string(self.spec)._match_on(branch, revs)
471
602
return RevisionInfo(branch, revno, revision_id)
473
SPEC_TYPES.append(RevisionSpec_before)
604
def _as_revision_id(self, context_branch):
605
base_revision_id = RevisionSpec.from_string(self.spec)._as_revision_id(context_branch)
606
if base_revision_id == revision.NULL_REVISION:
607
raise errors.InvalidRevisionSpec(self.user_spec, context_branch,
608
'cannot go before the null: revision')
609
context_repo = context_branch.repository
610
context_repo.lock_read()
612
parent_map = context_repo.get_parent_map([base_revision_id])
614
context_repo.unlock()
615
if base_revision_id not in parent_map:
616
# Ghost, or unknown revision id
617
raise errors.InvalidRevisionSpec(self.user_spec, context_branch,
618
'cannot find the matching revision')
619
parents = parent_map[base_revision_id]
621
raise errors.InvalidRevisionSpec(self.user_spec, context_branch,
622
'No parents for revision.')
476
627
class RevisionSpec_tag(RevisionSpec):
636
dwim_catchable_exceptions = (errors.NoSuchTag, errors.TagsNotSupported)
486
638
def _match_on(self, branch, revs):
487
639
# Can raise tags not supported, NoSuchTag, etc
488
640
return RevisionInfo.from_revision_id(branch,
489
branch.tags.lookup_tag(self.spec),
492
SPEC_TYPES.append(RevisionSpec_tag)
641
branch.tags.lookup_tag(self.spec))
643
def _as_revision_id(self, context_branch):
644
return context_branch.tags.lookup_tag(self.spec)
495
648
class _RevListToTimestamps(object):
496
649
"""This takes a list of revisions, and allows you to bisect by date"""
498
__slots__ = ['revs', 'branch']
651
__slots__ = ['branch']
500
def __init__(self, revs, branch):
653
def __init__(self, branch):
502
654
self.branch = branch
504
656
def __getitem__(self, index):
505
657
"""Get the date of the index'd item"""
506
r = self.branch.repository.get_revision(self.revs[index])
658
r = self.branch.repository.get_revision(self.branch.get_rev_id(index))
507
659
# TODO: Handle timezone.
508
660
return datetime.datetime.fromtimestamp(r.timestamp)
510
662
def __len__(self):
511
return len(self.revs)
663
return self.branch.revno()
514
666
class RevisionSpec_date(RevisionSpec):
622
775
trace.mutter('matching ancestor: on: %s, %s', self.spec, branch)
623
776
return self._find_revision_info(branch, self.spec)
778
def _as_revision_id(self, context_branch):
779
return self._find_revision_id(context_branch, self.spec)
626
782
def _find_revision_info(branch, other_location):
783
revision_id = RevisionSpec_ancestor._find_revision_id(branch,
785
return RevisionInfo(branch, None, revision_id)
788
def _find_revision_id(branch, other_location):
627
789
from bzrlib.branch import Branch
629
other_branch = Branch.open(other_location)
630
revision_a = branch.last_revision()
631
revision_b = other_branch.last_revision()
632
for r, b in ((revision_a, branch), (revision_b, other_branch)):
633
if r in (None, revision.NULL_REVISION):
634
raise errors.NoCommits(b)
635
revision_source = revision.MultipleRevisionSources(
636
branch.repository, other_branch.repository)
637
rev_id = revision.common_ancestor(revision_a, revision_b,
640
revno = branch.revision_id_to_revno(rev_id)
641
except errors.NoSuchRevision:
643
return RevisionInfo(branch, revno, rev_id)
646
SPEC_TYPES.append(RevisionSpec_ancestor)
793
revision_a = revision.ensure_null(branch.last_revision())
794
if revision_a == revision.NULL_REVISION:
795
raise errors.NoCommits(branch)
796
if other_location == '':
797
other_location = branch.get_parent()
798
other_branch = Branch.open(other_location)
799
other_branch.lock_read()
801
revision_b = revision.ensure_null(other_branch.last_revision())
802
if revision_b == revision.NULL_REVISION:
803
raise errors.NoCommits(other_branch)
804
graph = branch.repository.get_graph(other_branch.repository)
805
rev_id = graph.find_unique_lca(revision_a, revision_b)
807
other_branch.unlock()
808
if rev_id == revision.NULL_REVISION:
809
raise errors.NoCommonAncestor(revision_a, revision_b)
649
817
class RevisionSpec_branch(RevisionSpec):
664
834
revision_b = other_branch.last_revision()
665
835
if revision_b in (None, revision.NULL_REVISION):
666
836
raise errors.NoCommits(other_branch)
667
# pull in the remote revisions so we can diff
668
branch.fetch(other_branch, revision_b)
670
revno = branch.revision_id_to_revno(revision_b)
671
except errors.NoSuchRevision:
673
return RevisionInfo(branch, revno, revision_b)
675
SPEC_TYPES.append(RevisionSpec_branch)
838
branch = other_branch
841
# pull in the remote revisions so we can diff
842
branch.fetch(other_branch, revision_b)
843
except errors.ReadOnlyError:
844
branch = other_branch
845
return RevisionInfo(branch, None, revision_b)
847
def _as_revision_id(self, context_branch):
848
from bzrlib.branch import Branch
849
other_branch = Branch.open(self.spec)
850
last_revision = other_branch.last_revision()
851
last_revision = revision.ensure_null(last_revision)
852
context_branch.fetch(other_branch, last_revision)
853
if last_revision == revision.NULL_REVISION:
854
raise errors.NoCommits(other_branch)
857
def _as_tree(self, context_branch):
858
from bzrlib.branch import Branch
859
other_branch = Branch.open(self.spec)
860
last_revision = other_branch.last_revision()
861
last_revision = revision.ensure_null(last_revision)
862
if last_revision == revision.NULL_REVISION:
863
raise errors.NoCommits(other_branch)
864
return other_branch.repository.revision_tree(last_revision)
866
def needs_branch(self):
869
def get_branch(self):
678
874
class RevisionSpec_submit(RevisionSpec_ancestor):
683
879
Diffing against this shows all the changes that were made in this branch,
684
880
and is a good predictor of what merge will do. The submit branch is
685
used by the bundle and merge directive comands. If no submit branch
881
used by the bundle and merge directive commands. If no submit branch
686
882
is specified, the parent branch is used instead.
688
884
The common ancestor is the last revision that existed in both
689
885
branches. Usually this is the branch point, but it could also be
690
886
a revision that was merged.
693
890
$ bzr diff -r submit:
696
893
prefix = 'submit:'
698
def _match_on(self, branch, revs):
699
trace.mutter('matching ancestor: on: %s, %s', self.spec, branch)
895
def _get_submit_location(self, branch):
700
896
submit_location = branch.get_submit_branch()
701
897
location_type = 'submit branch'
702
898
if submit_location is None:
704
900
location_type = 'parent branch'
705
901
if submit_location is None:
706
902
raise errors.NoSubmitBranch(branch)
707
trace.note('Using %s %s', location_type, submit_location)
708
return self._find_revision_info(branch, submit_location)
711
SPEC_TYPES.append(RevisionSpec_submit)
903
trace.note(gettext('Using {0} {1}').format(location_type,
905
return submit_location
907
def _match_on(self, branch, revs):
908
trace.mutter('matching ancestor: on: %s, %s', self.spec, branch)
909
return self._find_revision_info(branch,
910
self._get_submit_location(branch))
912
def _as_revision_id(self, context_branch):
913
return self._find_revision_id(context_branch,
914
self._get_submit_location(context_branch))
917
class RevisionSpec_annotate(RevisionIDSpec):
921
help_txt = """Select the revision that last modified the specified line.
923
Select the revision that last modified the specified line. Line is
924
specified as path:number. Path is a relative path to the file. Numbers
925
start at 1, and are relative to the current version, not the last-
926
committed version of the file.
929
def _raise_invalid(self, numstring, context_branch):
930
raise errors.InvalidRevisionSpec(self.user_spec, context_branch,
931
'No such line: %s' % numstring)
933
def _as_revision_id(self, context_branch):
934
path, numstring = self.spec.rsplit(':', 1)
936
index = int(numstring) - 1
938
self._raise_invalid(numstring, context_branch)
939
tree, file_path = workingtree.WorkingTree.open_containing(path)
942
file_id = tree.path2id(file_path)
944
raise errors.InvalidRevisionSpec(self.user_spec,
945
context_branch, "File '%s' is not versioned." %
947
revision_ids = [r for (r, l) in tree.annotate_iter(file_id)]
951
revision_id = revision_ids[index]
953
self._raise_invalid(numstring, context_branch)
954
if revision_id == revision.CURRENT_REVISION:
955
raise errors.InvalidRevisionSpec(self.user_spec, context_branch,
956
'Line %s has not been committed.' % numstring)
960
class RevisionSpec_mainline(RevisionIDSpec):
962
help_txt = """Select mainline revision that merged the specified revision.
964
Select the revision that merged the specified revision into mainline.
969
def _as_revision_id(self, context_branch):
970
revspec = RevisionSpec.from_string(self.spec)
971
if revspec.get_branch() is None:
972
spec_branch = context_branch
974
spec_branch = _mod_branch.Branch.open(revspec.get_branch())
975
revision_id = revspec.as_revision_id(spec_branch)
976
graph = context_branch.repository.get_graph()
977
result = graph.find_lefthand_merger(revision_id,
978
context_branch.last_revision())
980
raise errors.InvalidRevisionSpec(self.user_spec, context_branch)
984
# The order in which we want to DWIM a revision spec without any prefix.
985
# revno is always tried first and isn't listed here, this is used by
986
# RevisionSpec_dwim._match_on
987
dwim_revspecs = symbol_versioning.deprecated_list(
988
symbol_versioning.deprecated_in((2, 4, 0)), "dwim_revspecs", [])
990
RevisionSpec_dwim.append_possible_revspec(RevisionSpec_tag)
991
RevisionSpec_dwim.append_possible_revspec(RevisionSpec_revid)
992
RevisionSpec_dwim.append_possible_revspec(RevisionSpec_date)
993
RevisionSpec_dwim.append_possible_revspec(RevisionSpec_branch)
995
revspec_registry = registry.Registry()
996
def _register_revspec(revspec):
997
revspec_registry.register(revspec.prefix, revspec)
999
_register_revspec(RevisionSpec_revno)
1000
_register_revspec(RevisionSpec_revid)
1001
_register_revspec(RevisionSpec_last)
1002
_register_revspec(RevisionSpec_before)
1003
_register_revspec(RevisionSpec_tag)
1004
_register_revspec(RevisionSpec_date)
1005
_register_revspec(RevisionSpec_ancestor)
1006
_register_revspec(RevisionSpec_branch)
1007
_register_revspec(RevisionSpec_submit)
1008
_register_revspec(RevisionSpec_annotate)
1009
_register_revspec(RevisionSpec_mainline)