Exemplo n.º 1
0
 def remote_ref(self) -> Union[RemoteReference, TagReference]:
     """
     :return:
         Remote Reference or TagReference in the local repository corresponding
         to the remote_ref_string kept in this instance."""
     # translate heads to a local remote, tags stay as they are
     if self.remote_ref_string.startswith("refs/tags"):
         return TagReference(self._remote.repo, self.remote_ref_string)
     elif self.remote_ref_string.startswith("refs/heads"):
         remote_ref = Reference(self._remote.repo, self.remote_ref_string)
         return RemoteReference(self._remote.repo, "refs/remotes/%s/%s" % (str(self._remote), remote_ref.name))
     else:
         raise ValueError("Could not handle remote ref: %r" % self.remote_ref_string)
Exemplo n.º 2
0
 def remote_ref(self):
     """
     :return:
         Remote Reference or TagReference in the local repository corresponding 
         to the remote_ref_string kept in this instance."""
     # translate heads to a local remote, tags stay as they are
     if self.remote_ref_string.startswith("refs/tags"):
         return TagReference(self.repo, self.remote_ref_string)
     elif self.remote_ref_string.startswith("refs/heads"):
         remote_ref = Reference(self.repo, self.remote_ref_string)
         if '/' in self._remotename_or_url:
             sys.stderr.write("Cannot provide RemoteReference instance if it was created from a url instead of of a remote name: %s. Returning Reference instance instead" % sefl._remotename_or_url)
             return remote_ref
         #END assert correct input
         return RemoteReference(self.repo, "refs/remotes/%s/%s" % (str(self._remotename_or_url), remote_ref.name))
     else:
         raise ValueError("Could not handle remote ref: %r" % self.remote_ref_string)