Mercurial > hg
comparison mercurial/store.py @ 40624:66adfd58cb77
store: raise ProgrammingError if unable to decode a storage path
Right now, the function magically return False which is dangerous, so let's
raise ProgrammingError.
Suggested by Augie in D5139.
Differential Revision: https://phab.mercurial-scm.org/D5264
author | Pulkit Goyal <pulkit@yandex-team.ru> |
---|---|
date | Tue, 13 Nov 2018 18:44:09 +0300 |
parents | a694a7159125 |
children | 0728d87a8631 |
comparison
equal
deleted
inserted
replaced
40623:7c5a922be068 | 40624:66adfd58cb77 |
---|---|
35 path = decodedir(path) | 35 path = decodedir(path) |
36 if path.startswith('data/'): | 36 if path.startswith('data/'): |
37 return matcher(path[len('data/'):-len('.i')]) | 37 return matcher(path[len('data/'):-len('.i')]) |
38 elif path.startswith('meta/'): | 38 elif path.startswith('meta/'): |
39 return matcher.visitdir(path[len('meta/'):-len('/00manifest.i')] or '.') | 39 return matcher.visitdir(path[len('meta/'):-len('/00manifest.i')] or '.') |
40 | |
41 raise error.ProgrammingError("cannot decode path %s" % path) | |
40 | 42 |
41 # This avoids a collision between a file named foo and a dir named | 43 # This avoids a collision between a file named foo and a dir named |
42 # foo.i or foo.d | 44 # foo.i or foo.d |
43 def _encodedir(path): | 45 def _encodedir(path): |
44 ''' | 46 ''' |