Match name and result of is_detached() method
Change the is_detached() method to negate the test within the method call, so that result is True if the tree is in a detached stage, instead of needing to invert the result from where the program calls the method. Change-Id: I30ea105fa354fcd975c134e87f9422d69864de9f
This commit is contained in:
@@ -69,7 +69,7 @@ class Drop(LogDedentMixin, GitMixin):
|
||||
self._author = author
|
||||
|
||||
# test that we can use this git repo
|
||||
if not self.is_detached():
|
||||
if self.is_detached():
|
||||
raise DropError("In 'detached HEAD' state")
|
||||
|
||||
# To Do: check if it possible and useful.
|
||||
|
||||
@@ -48,7 +48,7 @@ class ImportUpstream(LogDedentMixin, GitMixin):
|
||||
super(ImportUpstream, self).__init__(*args, **kwargs)
|
||||
|
||||
# test that we can use this git repo
|
||||
if not self.is_detached():
|
||||
if self.is_detached():
|
||||
raise ImportUpstreamError("In 'detached HEAD' state")
|
||||
|
||||
if self.repo.bare:
|
||||
|
||||
@@ -62,7 +62,7 @@ class Supersede(LogDedentMixin, GitMixin):
|
||||
raise SupersedeError("Commit should be provided")
|
||||
|
||||
# test that we can use this git repo
|
||||
if not self.is_detached():
|
||||
if self.is_detached():
|
||||
raise SupersedeError("In 'detached HEAD' state")
|
||||
|
||||
# To Do: check if it possible and useful.
|
||||
|
||||
@@ -53,7 +53,7 @@ class GitMixin(object):
|
||||
return self.__git
|
||||
|
||||
def is_detached(self):
|
||||
return self.git.symbolic_ref("HEAD", q=True, with_exceptions=False)
|
||||
return not self.git.symbolic_ref("HEAD", q=True, with_exceptions=False)
|
||||
|
||||
def get_name(self, sha1, pattern=None):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user