# `Dagger.Changeset`
[🔗](https://github.com/dagger/dagger/blob/v0.21.7/sdk/elixir/lib/dagger/gen/changeset.ex#L2)

A comparison between two directories representing changes that can be applied.

# `t`

```elixir
@type t() :: %Dagger.Changeset{client: term(), query_builder: term()}
```

# `added_paths`

```elixir
@spec added_paths(t()) :: {:ok, [String.t()]} | {:error, term()}
```

Files and directories that were added in the newer directory.

# `after_`

```elixir
@spec after_(t()) :: Dagger.Directory.t()
```

The newer/upper snapshot.

# `as_patch`

```elixir
@spec as_patch(t()) :: Dagger.File.t()
```

Return a Git-compatible patch of the changes

# `before`

```elixir
@spec before(t()) :: Dagger.Directory.t()
```

The older/lower snapshot to compare against.

# `diff_stats`

```elixir
@spec diff_stats(t()) :: {:ok, [Dagger.DiffStat.t()]} | {:error, term()}
```

Structured per-path diff statistics (kind and line counts) for this changeset.

# `empty?`

```elixir
@spec empty?(t()) :: {:ok, boolean()} | {:error, term()}
```

Returns true if the changeset is empty (i.e. there are no changes).

# `export`

```elixir
@spec export(t(), String.t()) :: {:ok, String.t()} | {:error, term()}
```

Applies the diff represented by this changeset to a path on the host.

# `id`

```elixir
@spec id(t()) :: {:ok, String.t()} | {:error, term()}
```

A unique identifier for this Changeset.

# `layer`

```elixir
@spec layer(t()) :: Dagger.Directory.t()
```

Return a snapshot containing only the created and modified files

# `modified_paths`

```elixir
@spec modified_paths(t()) :: {:ok, [String.t()]} | {:error, term()}
```

Files and directories that existed before and were updated in the newer directory.

# `removed_paths`

```elixir
@spec removed_paths(t()) :: {:ok, [String.t()]} | {:error, term()}
```

Files and directories that were removed. Directories are indicated by a trailing slash, and their child paths are not included.

# `sync`

```elixir
@spec sync(t()) :: {:ok, t()} | {:error, term()}
```

Force evaluation in the engine.

# `with_changeset`

```elixir
@spec with_changeset(t(), t(), [
  {:on_conflict, Dagger.ChangesetMergeConflict.t() | nil}
]) :: t()
```

Add changes to an existing changeset

By default the operation will fail in case of conflicts, for instance a file modified in both changesets. The behavior can be adjusted using onConflict argument

# `with_changesets`

```elixir
@spec with_changesets(t(), [String.t()], [
  {:on_conflict, Dagger.ChangesetsMergeConflict.t() | nil}
]) ::
  t()
```

Add changes from multiple changesets using git octopus merge strategy

This is more efficient than chaining multiple withChangeset calls when merging many changesets.

Only FAIL and FAIL_EARLY conflict strategies are supported (octopus merge cannot use -X ours/theirs).

---

*Consult [api-reference.md](api-reference.md) for complete listing*
