MCPcopy Create free account
hub / github.com/ezyang/ghstack / _make_ref

Method _make_ref

src/ghstack/github_fake.py:221–238  ·  view source on GitHub ↗
(self, state: GitHubState, refName: str)

Source from the content-addressed store, hash-verified

219 # TODO: This should take which repository the ref is in
220 # This only works if you have upstream_sh
221 def _make_ref(self, state: GitHubState, refName: str) -> "Ref":
222 # TODO: Probably should preserve object identity here when
223 # you call this with refName/oid that are the same
224 assert state.upstream_sh
225 gitObject = GitObject(
226 id=state.next_id(),
227 # TODO: this upstream_sh hardcode wrong, but ok for now
228 # because we only have one repo
229 oid=GitObjectID(state.upstream_sh.git("rev-parse", refName)),
230 _repository=self.id,
231 )
232 ref = Ref(
233 id=state.next_id(),
234 name=refName,
235 _repository=self.id,
236 target=gitObject,
237 )
238 return ref
239
240
241@dataclass

Callers 4

__init__Method · 0.95
_create_pullMethod · 0.80
_update_pullMethod · 0.80
_set_default_branchMethod · 0.80

Calls 4

GitObjectClass · 0.85
RefClass · 0.85
next_idMethod · 0.80
gitMethod · 0.80

Tested by

no test coverage detected