Mercurial > hg > smartopen
comparison smartopen/handlers.py @ 10:a963acb1713d
add a new handler: MercurialRevision
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Tue, 21 Sep 2010 12:01:34 -0700 |
parents | 44950f376e98 |
children | ba9058605c5a |
comparison
equal
deleted
inserted
replaced
9:4dd12cf64c0e | 10:a963acb1713d |
---|---|
1 import address | 1 import address |
2 import string | |
2 import urllib | 3 import urllib |
3 import urllib2 | 4 import urllib2 |
4 | 5 |
5 class Location: | 6 class Location: |
6 """ | 7 """ |
136 try: | 137 try: |
137 int(query) | 138 int(query) |
138 except ValueError: | 139 except ValueError: |
139 return False | 140 return False |
140 return True | 141 return True |
142 | |
143 class MercurialRevision(Location): | |
144 def __init__(self): | |
145 baseurl = 'http://hg.mozilla.org/mozilla-central/rev/' | |
146 Location.__init__(self, baseurl) | |
147 | |
148 def test(self, query): | |
149 query = set(query) | |
150 if query.issubset(string.digits + 'abcdef'): | |
151 return True | |
152 return False |