示例#1
0
 def _live_entry(self, path):
     path = urlutils.quote_from_bytes(path)
     stat_val = self._lstat(path)
     if stat.S_ISDIR(stat_val.st_mode):
         return None
     elif stat.S_ISLNK(stat_val.st_mode):
         blob = Blob.from_string(
             self._file_transport.readlink(path).encode('utf-8'))
     elif stat.S_ISREG(stat_val.st_mode):
         blob = Blob.from_string(self._file_transport.get_bytes(path))
     else:
         raise AssertionError('unknown type %d' % stat_val.st_mode)
     return index_entry_from_stat(stat_val, blob.id, 0)
示例#2
0
def dq(p):
    if not isinstance(p, bytes):
        p = p.encode('UTF-8')
    return urlutils.quote(urlutils.quote_from_bytes(p, safe=''))