def rebuild_references(self, src, path, reject=None):
if reject is None:<EOL><INDENT>reject = set()<EOL><DEDENT>reject.add(path)<EOL>try:<EOL><INDENT>filename = os.path.join(src, path)<EOL>mtime = os.path.getmtime(filename)<EOL>contents = open(filename)<EOL><DEDENT>except EnvironmentError:<EOL><INDENT>raise ValueError("<STR_LIT>".format(path))<EOL><DEDENT>ifpath in self.parents andself.parents[path].updated == mtime:<EOL><INDENT>return<EOL><DEDENT>if path in self.parents:<EOL><INDENT>self.deleted(src, path)<EOL><DEDENT>parents = TimedSet(mtime)<EOL>current = os.path.dirname(path)<EOL>for line in contents:<EOL><INDENT>match = self.line_regex.search(line)<EOL>if match:<EOL><INDENT>parent = match.group(<NUM_LIT:1>)<EOL>relative = os.path.normpath(os.path.join(current, parent))<EOL>if relative.startswith("<STR_LIT:..>"):<EOL><INDENT>raise ValueError("<STR_LIT>"<EOL>"<STR_LIT>".format(parent,<EOL>path))<EOL><DEDENT>parent = os.path.normcase(relative)<EOL>if parent in reject:<EOL><INDENT>raise ValueError("<STR_LIT>"<EOL>"<STR_LIT>".format(parent,<EOL>path))<EOL><DEDENT>parents.add(parent)<EOL><DEDENT><DEDENT>for parent in parents:<EOL><INDENT>self.rebuild_references(src, parent, reject)<EOL><DEDENT>self.parents[path] = parents<EOL>for parent in parents:<EOL><INDENT>if parent not in self.children:<EOL><INDENT>self.children[parent] = set()<EOL><DEDENT>self.children[parent].add(path)<EOL><DEDENT>
Updates `parents` and `children` to be in sync with the changes to
        `src` if any.