~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/revision.py

  • Committer: Martin Pool
  • Date: 2005-07-04 07:33:32 UTC
  • Revision ID: mbp@sourcefrog.net-20050704073332-48c024b7b80671b6
- New validate_revision_id function

Show diffs side-by-side

added added

removed removed

Lines of Context:
186
186
 
187
187
    rev.message = elt.findtext('message') # text of <message>
188
188
    return rev
 
189
 
 
190
 
 
191
 
 
192
REVISION_ID_RE = None
 
193
 
 
194
def validate_revision_id(rid):
 
195
    """Check rid is syntactically valid for a revision id."""
 
196
    global REVISION_ID_RE
 
197
    if not REVISION_ID_RE:
 
198
        import re
 
199
        REVISION_ID_RE = re.compile('[\w.-]+@[\w.-]+-+\d+-[0-9a-f]+\Z')
 
200
 
 
201
    if not REVISION_ID_RE.match(rid):
 
202
        raise ValueError("malformed revision-id %r" % rid)
 
203