Class: Changeset
A comparison between two directories representing changes that can be applied.
Extends
BaseClient
Constructors
Constructor
new Changeset(
ctx?,_id?,_export?,_isEmpty?,_sync?):Changeset
Constructor is used for internal usage only, do not create object from it.
Parameters
ctx?
Context
_id?
_export?
string
_isEmpty?
boolean
_sync?
Returns
Changeset
Overrides
BaseClient.constructor
Methods
addedPaths()
addedPaths():
Promise<string[]>
Files and directories that were added in the newer directory.
Returns
Promise<string[]>
after()
after():
Directory
The newer/upper snapshot.
Returns
asPatch()
asPatch():
File
Return a Git-compatible patch of the changes
Returns
before()
before():
Directory
The older/lower snapshot to compare against.
Returns
diffStats()
diffStats():
Promise<DiffStat[]>
Structured per-path diff statistics (kind and line counts) for this changeset.
Returns
Promise<DiffStat[]>
export()
export(
path):Promise<string>
Applies the diff represented by this changeset to a path on the host.
Parameters
path
string
Location of the copied directory (e.g., "logs/").
Returns
Promise<string>
id()
id():
Promise<ID>
A unique identifier for this Changeset.
Returns
Promise<ID>
isEmpty()
isEmpty():
Promise<boolean>
Returns true if the changeset is empty (i.e. there are no changes).
Returns
Promise<boolean>
layer()
layer():
Directory
Return a snapshot containing only the created and modified files
Returns
modifiedPaths()
modifiedPaths():
Promise<string[]>
Files and directories that existed before and were updated in the newer directory.
Returns
Promise<string[]>
removedPaths()
removedPaths():
Promise<string[]>
Files and directories that were removed. Directories are indicated by a trailing slash, and their child paths are not included.
Returns
Promise<string[]>
sync()
sync():
Promise<Changeset>
Force evaluation in the engine.
Returns
Promise<Changeset>
with()
with(
arg):Changeset
Call the provided function with current Changeset.
This is useful for reusability and readability by not breaking the calling chain.
Parameters
arg
(param) => Changeset
Returns
Changeset
withChangeset()
withChangeset(
changes,opts?):Changeset
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
Parameters
changes
Changeset
Changes to merge into the actual changeset
opts?
Returns
Changeset
withChangesets()
withChangesets(
changes,opts?):Changeset
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).
Parameters
changes
Changeset[]
List of changesets to merge into the actual changeset
opts?
Returns
Changeset