Beispiel #1
0
 def checkout(self, check: bool = True, track: bool = False) -> None:
     current_commit = GitOffline.current_head_commit_sha(self.path)
     if current_commit == self.sha:
         CONSOLE.stdout(' - On correct commit for tag')
         return
     CONSOLE.stdout(f' - Checkout tag {self.name}')
     super().checkout(check=check, track=track)
Beispiel #2
0
 def checkout(self, check: bool = True, track: bool = False) -> None:
     current_commit = GitOffline.current_head_commit_sha(self.path)
     # TODO: Should this always check out detached HEAD?
     if current_commit == self.sha and GitOffline.is_detached(self.path):
         CONSOLE.stdout(' - On correct commit')
         return
     CONSOLE.stdout(f' - Checkout commit {Format.Git.ref(self.short_ref)}')
     super().checkout(check=check, track=track)
Beispiel #3
0
 def is_checked_out(self) -> bool:
     current_sha = GitOffline.current_head_commit_sha(self.path)
     tag_sha = GitOnline.get_remote_tag_sha(self.path, self.name)
     return current_sha == tag_sha
Beispiel #4
0
 def sha(self, ref: Optional[str] = None, short: bool = False) -> str:
     if ref is None:
         return GitOffline.current_head_commit_sha(self.path, short=short)
     return GitOffline.get_sha(self.path, ref=ref, short=short)