File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -565,6 +565,20 @@ NS_ASSUME_NONNULL_BEGIN
565565// / Returns whether `ahead` and `behind` were successfully calculated.
566566- (BOOL )calculateAhead : (size_t *)ahead behind : (size_t *)behind ofOID : (GTOID *)headOID relativeToOID : (GTOID *)baseOID error : (NSError **)error ;
567567
568+ // / Creates an enumerator for walking the local commits in relative to the
569+ // / tracking branch.
570+ // /
571+ // / Note that this will only be accurate iff `trackingBranch` truly is
572+ // / `localBranch`s tracking branch. If you need more general functionality, see
573+ // / -[GTBranch uniqueCommitsRelativeToBranch:error:].
574+ // /
575+ // / localBranch - The local branch.
576+ // / trackingBranch - `localBranch`s tracking branch.
577+ // / error - The error if one occurred.
578+ // /
579+ // / Returns the enumerator or nil if an error occurred.
580+ - (nullable GTEnumerator *)enumerateLocalCommitsInBranch : (GTBranch *)localBranch trackingBranch : (GTBranch *)trackingBranch error : (NSError **)error ;
581+
568582@end
569583
570584NS_ASSUME_NONNULL_END
Original file line number Diff line number Diff line change @@ -912,4 +912,20 @@ - (BOOL)calculateAhead:(size_t *)ahead behind:(size_t *)behind ofOID:(GTOID *)he
912912 return YES ;
913913}
914914
915+ - (GTEnumerator *)enumerateLocalCommitsInBranch : (GTBranch *)localBranch trackingBranch : (GTBranch *)trackingBranch error : (NSError **)error {
916+ NSParameterAssert (localBranch != nil );
917+ NSParameterAssert (trackingBranch != nil );
918+
919+ GTEnumerator *enumerator = [[GTEnumerator alloc ] initWithRepository: self error: error];
920+ if (enumerator == nil ) return nil ;
921+
922+ BOOL success = [enumerator pushSHA: localBranch.OID.SHA error: error];
923+ if (!success) return nil ;
924+
925+ success = [enumerator hideSHA: trackingBranch.OID.SHA error: error];
926+ if (!success) return nil ;
927+
928+ return enumerator;
929+ }
930+
915931@end
You can’t perform that action at this time.
0 commit comments