32
32
each revision specifier supplied.
34
34
>>> _parse_revision_str('234')
35
[<RevisionSpec_int 234>]
35
[<RevisionSpec_revno 234>]
36
36
>>> _parse_revision_str('234..567')
37
[<RevisionSpec_int 234>, <RevisionSpec_int 567>]
37
[<RevisionSpec_revno 234>, <RevisionSpec_revno 567>]
38
38
>>> _parse_revision_str('..')
39
39
[<RevisionSpec None>, <RevisionSpec None>]
40
40
>>> _parse_revision_str('..234')
41
[<RevisionSpec None>, <RevisionSpec_int 234>]
41
[<RevisionSpec None>, <RevisionSpec_revno 234>]
42
42
>>> _parse_revision_str('234..')
43
[<RevisionSpec_int 234>, <RevisionSpec None>]
43
[<RevisionSpec_revno 234>, <RevisionSpec None>]
44
44
>>> _parse_revision_str('234..456..789') # Maybe this should be an error
45
[<RevisionSpec_int 234>, <RevisionSpec_int 456>, <RevisionSpec_int 789>]
45
[<RevisionSpec_revno 234>, <RevisionSpec_revno 456>, <RevisionSpec_revno 789>]
46
46
>>> _parse_revision_str('234....789') #Error ?
47
[<RevisionSpec_int 234>, <RevisionSpec None>, <RevisionSpec_int 789>]
47
[<RevisionSpec_revno 234>, <RevisionSpec None>, <RevisionSpec_revno 789>]
48
48
>>> _parse_revision_str('revid:test@other.com-234234')
49
49
[<RevisionSpec_revid revid:test@other.com-234234>]
50
50
>>> _parse_revision_str('revid:test@other.com-234234..revid:test@other.com-234235')
51
51
[<RevisionSpec_revid revid:test@other.com-234234>, <RevisionSpec_revid revid:test@other.com-234235>]
52
52
>>> _parse_revision_str('revid:test@other.com-234234..23')
53
[<RevisionSpec_revid revid:test@other.com-234234>, <RevisionSpec_int 23>]
53
[<RevisionSpec_revid revid:test@other.com-234234>, <RevisionSpec_revno 23>]
54
54
>>> _parse_revision_str('date:2005-04-12')
55
55
[<RevisionSpec_date date:2005-04-12>]
56
56
>>> _parse_revision_str('date:2005-04-12 12:24:33')
60
60
>>> _parse_revision_str('date:2005-04-12,12:24:33')
61
61
[<RevisionSpec_date date:2005-04-12,12:24:33>]
62
62
>>> _parse_revision_str('-5..23')
63
[<RevisionSpec_int -5>, <RevisionSpec_int 23>]
63
[<RevisionSpec_revno -5>, <RevisionSpec_revno 23>]
64
64
>>> _parse_revision_str('-5')
65
[<RevisionSpec_int -5>]
65
[<RevisionSpec_revno -5>]
66
66
>>> _parse_revision_str('123a')
67
67
Traceback (most recent call last):
69
BzrError: No namespace registered for string: '123a'
69
NoSuchRevisionSpec: No namespace registered for string: '123a'
70
70
>>> _parse_revision_str('abc')
71
71
Traceback (most recent call last):
73
BzrError: No namespace registered for string: 'abc'
73
NoSuchRevisionSpec: No namespace registered for string: 'abc'
74
74
>>> _parse_revision_str('branch:../branch2')
75
75
[<RevisionSpec_branch branch:../branch2>]
76
76
>>> _parse_revision_str('branch:../../branch2')
77
77
[<RevisionSpec_branch branch:../../branch2>]
78
78
>>> _parse_revision_str('branch:../../branch2..23')
79
[<RevisionSpec_branch branch:../../branch2>, <RevisionSpec_int 23>]
79
[<RevisionSpec_branch branch:../../branch2>, <RevisionSpec_revno 23>]
81
81
# TODO: Maybe move this into revisionspec.py
82
old_format_re = re.compile('\d*:\d*')
83
m = old_format_re.match(revstr)
86
warning('Colon separator for revision numbers is deprecated.'
88
for rev in revstr.split(':'):
90
revs.append(RevisionSpec(int(rev)))
92
revs.append(RevisionSpec(None))
94
sep = re.compile("\\.\\.(?!/)")
95
for x in sep.split(revstr):
96
revs.append(RevisionSpec(x or None))
83
sep = re.compile("\\.\\.(?!/)")
84
for x in sep.split(revstr):
85
revs.append(RevisionSpec.from_string(x or None))