# HG changeset patch # User Durham Goode # Date 1360103054 28800 # Node ID 4db216b1c1546a503d43737d7e9e08b191a2beb1 # Parent 0027a5cec9d00873ca14129b4589975083e5e71d 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 diff -r 0027a5cec9d0 -r 4db216b1c154 mercurial/scmutil.py --- 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]