comparison mercurial/util.py @ 13926:61ba09d8d118

util: move checkosfilename call from path_auditor to opener path_auditor is used for checking patterns too, but a pattern is not a valid filename. This patch fixes 98ee3dd5bab4, which introduced the bug: $ hg log -l3 glob:**.py abort: filename contains '*', which is reserved on Windows: mercurial\**.py
author Adrian Buehlmann <adrian@cadifra.com>
date Sun, 10 Apr 2011 19:31:49 +0200
parents 98ee3dd5bab4
children 155d2e17884e
comparison
equal deleted inserted replaced
13925:c315ffc13a25 13926:61ba09d8d118
600 break 600 break
601 check(prefix) 601 check(prefix)
602 prefixes.append(prefix) 602 prefixes.append(prefix)
603 parts.pop() 603 parts.pop()
604 604
605 r = checkosfilename(path)
606 if r:
607 raise Abort("%s: %s" % (r, path))
608 self.audited.add(path) 605 self.audited.add(path)
609 # only add prefixes to the cache after checking everything: we don't 606 # only add prefixes to the cache after checking everything: we don't
610 # want to add "foo/bar/baz" before checking if there's a "foo/.hg" 607 # want to add "foo/bar/baz" before checking if there's a "foo/.hg"
611 self.auditeddir.update(prefixes) 608 self.auditeddir.update(prefixes)
612 609
914 if self.createmode is None: 911 if self.createmode is None:
915 return 912 return
916 os.chmod(name, self.createmode & 0666) 913 os.chmod(name, self.createmode & 0666)
917 914
918 def __call__(self, path, mode="r", text=False, atomictemp=False): 915 def __call__(self, path, mode="r", text=False, atomictemp=False):
916 r = checkosfilename(path)
917 if r:
918 raise Abort("%s: %s" % (r, path))
919 self.auditor(path) 919 self.auditor(path)
920 f = os.path.join(self.base, path) 920 f = os.path.join(self.base, path)
921 921
922 if not text and "b" not in mode: 922 if not text and "b" not in mode:
923 mode += "b" # for that other OS 923 mode += "b" # for that other OS