MCPcopy Create free account
hub / github.com/chubin/cheat.sh / current_state_command

Method current_state_command

lib/adapter/git_adapter.py:113–133  ·  view source on GitHub ↗

Get current state of repository (current revision). This is used to find what cache entries should be invalidated.

(cls)

Source from the content-addressed store, hash-verified

111
112 @classmethod
113 def current_state_command(cls):
114 """
115 Get current state of repository (current revision).
116 This is used to find what cache entries should be invalidated.
117 """
118
119 if not cls._repository_url:
120 return None
121
122 local_repository_dir = cls.local_repository_location()
123 if not local_repository_dir:
124 return None
125
126 if not cls._repository_url.startswith("https://github.com/"):
127 # in this case `update` has to be implemented
128 # in the distinct adapter subclass
129 raise RuntimeError(
130 "Do not known how to handle this repository: %s" % cls._repository_url
131 )
132
133 return ["git", "rev-parse", "--short", "HEAD", "--"]
134
135 @classmethod
136 def save_state(cls, state):

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected