~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/commands.py

  • Committer: Robert Collins
  • Date: 2005-10-10 01:32:08 UTC
  • Revision ID: robertc@robertcollins.net-20051010013208-163c23746972763a
branch: namespace

Show diffs side-by-side

added added

removed removed

Lines of Context:
71
71
    """This handles a revision string -> revno.
72
72
 
73
73
    This always returns a list.  The list will have one element for
74
 
    each revision.
 
74
    each revision specifier supplied.
75
75
 
76
76
    >>> _parse_revision_str('234')
77
77
    [<RevisionSpec_int 234>]
85
85
    [<RevisionSpec_int 234>, <RevisionSpec None>]
86
86
    >>> _parse_revision_str('234..456..789') # Maybe this should be an error
87
87
    [<RevisionSpec_int 234>, <RevisionSpec_int 456>, <RevisionSpec_int 789>]
88
 
    >>> _parse_revision_str('234....789') # Error?
 
88
    >>> _parse_revision_str('234....789') #Error ?
89
89
    [<RevisionSpec_int 234>, <RevisionSpec None>, <RevisionSpec_int 789>]
90
90
    >>> _parse_revision_str('revid:test@other.com-234234')
91
91
    [<RevisionSpec_revid revid:test@other.com-234234>]
113
113
    Traceback (most recent call last):
114
114
      ...
115
115
    BzrError: No namespace registered for string: 'abc'
 
116
    >>> _parse_revision_str('branch:../branch2')
 
117
    [<RevisionSpec_branch branch:../branch2>]
116
118
    """
117
119
    import re
118
120
    old_format_re = re.compile('\d*:\d*')
127
129
            else:
128
130
                revs.append(RevisionSpec(None))
129
131
    else:
 
132
        next_prefix = None
130
133
        for x in revstr.split('..'):
131
134
            if not x:
132
135
                revs.append(RevisionSpec(None))
 
136
            elif x[-1] == ':':
 
137
                # looks like a namespace:.. has happened
 
138
                next_prefix = x + '..'
133
139
            else:
 
140
                if next_prefix is not None:
 
141
                    x = next_prefix + x
134
142
                revs.append(RevisionSpec(x))
 
143
                next_prefix = None
 
144
        if next_prefix is not None:
 
145
            revs.append(RevisionSpec(next_prefix))
135
146
    return revs
136
147
 
137
148