code: def rebuild_references(self, src, path, reject=None):
          
          if reject is None:
              reject = set()
          reject.add(path)
  
          try:
              filename = os.path.join(src, path)
              mtime = os.path.getmtime(filename)
              contents = open(filename)
          except EnvironmentError:
              raise ValueError("Unable to open '{0}'".format(path))
  
          if \
                  path in self.parents and \
                  self.parents[path].updated == mtime:
              # cache hit; no need to update
              return
  
          # drop existing references
          if path in self.parents:
              self.deleted(src, path)
  
          # build a list of parents
          parents = TimedSet(mtime)
          current = os.path.dirname(path)
  
          for line in contents:
              match = self.line_regex.search(line)
              if match:
                  parent = match.group(1)
                  relative = os.path.normpath(os.path.join(current, parent))
                  if relative.startswith(".."):
                      raise ValueError("Parent reference '{0}' outside of "
                                       "watched folder in '{1}'".format(parent,
                                                                        path))
                  parent = os.path.normcase(relative)
                  if parent in reject:
                      raise ValueError("Circular reference to '{0}' "
                                       "detected in '{1}'".format(parent,
                                                                  path))
                  parents.add(parent)
  
          for parent in parents:
              # recursively build references for all parents; this will
              # usually be a cache hit and no-op
              self.rebuild_references(src, parent, reject)
  
          self.parents[path] = parents
          for parent in parents:
              # add this node to each of its parents' children
              if parent not in self.children:
                  self.children[parent] = set()
              self.children[parent].add(path)
docs: Updates `parents` and `children` to be in sync with the changes to
          `src` if any.