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:
Darragh Bailey
2016-02-03 12:43:02 +00:00
parent 81ad238e9b
commit 5687a7b2bd
4 changed files with 4 additions and 4 deletions

View File

@@ -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.

View File

@@ -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:

View File

@@ -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.

View File

@@ -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):
"""