Mercurial > hg
changeset 18624:4db216b1c154
pathauditor: add check() method
The pathauditor currently throws exceptions when it encounters an invalid
path. This change adds a method to allow people to treat it as a boolean.
This is currently used by scmutil.addremove and in a subsequent patch it
will be used by dirstate.walk
author | Durham Goode <durham@fb.com> |
---|---|
date | Tue, 05 Feb 2013 14:24:14 -0800 |
parents | 0027a5cec9d0 |
children | 2cbd27f4f3c4 |
files | mercurial/scmutil.py |
diffstat | 1 files changed, 8 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/scmutil.py Sat Feb 09 22:54:34 2013 +0000 +++ b/mercurial/scmutil.py Tue Feb 05 14:24:14 2013 -0800 @@ -184,6 +184,13 @@ # want to add "foo/bar/baz" before checking if there's a "foo/.hg" self.auditeddir.update(prefixes) + def check(self, path): + try: + self(path) + return True + except (OSError, util.Abort): + return False + class abstractvfs(object): """Abstract base class; cannot be instantiated""" @@ -745,11 +752,7 @@ ctx = repo[None] walkresults = repo.dirstate.walk(m, sorted(ctx.substate), True, False) for abs in sorted(walkresults): - good = True - try: - audit_path(abs) - except (OSError, util.Abort): - good = False + good = audit_path.check(abs) st = walkresults[abs] dstate = repo.dirstate[abs]