MCPcopy Create free account
hub / github.com/angular/dev-infra / checkout

Method checkout

ng-dev/utils/git/git-client.ts:184–197  ·  view source on GitHub ↗

* Checks out a requested branch or revision, optionally cleaning the state of the repository * before attempting the checking. Returns a boolean indicating whether the branch or revision * was cleanly checked out.

(branchOrRevision: string, cleanState: boolean)

Source from the content-addressed store, hash-verified

182 * was cleanly checked out.
183 */
184 checkout(branchOrRevision: string, cleanState: boolean): boolean {
185 assertValidGitRef(branchOrRevision);
186 if (cleanState) {
187 // Abort any outstanding ams.
188 this.runGraceful(['am', '--abort'], {stdio: 'ignore'});
189 // Abort any outstanding cherry-picks.
190 this.runGraceful(['cherry-pick', '--abort'], {stdio: 'ignore'});
191 // Abort any outstanding rebases.
192 this.runGraceful(['rebase', '--abort'], {stdio: 'ignore'});
193 // Clear any changes in the current repo.
194 this.runGraceful(['reset', '--hard'], {stdio: 'ignore'});
195 }
196 return this.runGraceful(['checkout', branchOrRevision], {stdio: 'ignore'}).status === 0;
197 }
198
199 /** Retrieve a list of all files in the repository changed since the provided shaOrRef. */
200 allChangesFilesSince(shaOrRef = 'HEAD'): string[] {

Callers 5

git-client.spec.tsFile · 0.80
cleanupMethod · 0.80
rebasePrFunction · 0.80

Calls 2

runGracefulMethod · 0.95
assertValidGitRefFunction · 0.85

Tested by

no test coverage detected