RevParse class
A class for parsing Git revision specifications and finding corresponding objects.
This class provides methods to parse Git revision strings (specs) and find the corresponding Git objects. It supports various revision string formats as described in the Git documentation.
For more information about the accepted syntax, see:
- git-rev-parse documentation
man gitrevisions
Example:
// Find a commit by its hash
final commit = RevParse.single(repo: repo, spec: 'a1b2c3d4') as Commit;
// Find a tree object
final tree = RevParse.single(repo: repo, spec: 'HEAD^{tree}') as Tree;
// Find a file in a specific commit
final blob = RevParse.single(repo: repo, spec: 'HEAD:path/to/file.txt') as Blob;
// Find a tag
final tag = RevParse.single(repo: repo, spec: 'v1.0') as Tag;
// Find a commit and its reference
final revParse = RevParse.ext(repo: repo, spec: 'master@{upstream}');
final commit = revParse.object;
final reference = revParse.reference;
// Parse a revision range
final range = RevParse.range(repo: repo, spec: 'master..develop');
final from = range.from;
final to = range.to;
final flags = range.flags;
Constructors
- RevParse.ext({required Repository repo, required String spec})
-
Finds a single object and intermediate reference (if there is one) by a
specrevision string.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- object ↔ Commit
-
The Git object found by the revision string.
latefinal
- reference ↔ Reference?
-
The intermediate reference found by the revision string, if any.
latefinal
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
range(
{required Repository repo, required String spec}) → RevSpec - Parses a revision string for from, to, and intent.
-
single(
{required Repository repo, required String spec}) → Object -
Finds a single object as specified by a
specrevision string.