@log_calls
  def _apply_changelist_to_items(self, items, changelist, new_rev):
    '''
    Given a list of items, apply adds, removes, and modifications, updating
    store paths for each new item. Returns (new_items, changed_items), where
    new_items is the full list of items, with modifications, and changed_items
    includes only those that have changed (due to adds or modifies).
    '''
    all_paths = set([item.path for item in items])
    assert changelist.rm_paths.issubset(all_paths)
    assert changelist.mod_paths.issubset(all_paths)
    assert len(changelist.add_paths.intersection(all_paths)) == 0
      
    new_items = []
    changed_items = []
    for item in items:
      if item.path in changelist.rm_paths:
        log.debug("changes: removing: %s", item)
        pass
      elif item.path in changelist.mod_paths:
        new_item = Item(item.path, self._store_path_file(item.path, new_rev), self.config.compression)
        log.debug("changes: modifying: %s", new_item)
        new_items.append(new_item)
        changed_items.append(new_item)
      else:
        log.debug("changes: unchanged: %s", item)
        new_items.append(item)

    for path in changelist.add_paths:
      new_item = Item(path, self._store_path_file(path, new_rev), self.config.compression)
      log.debug("changes: adding: %s", new_item)
      new_items.append(new_item)
      changed_items.append(new_item)

    # Sort results so manifests etc. look pretty
    new_items.sort(key=lambda item: item.path)
    changed_items.sort(key=lambda item: item.path)

    return (new_items, changed_items)
dataset/ETHPy150Open bloomreach/zinc/zinc.py/Repo._apply_changelist_to_items/original