[meld] vc: Clean up valid_repo calls



commit 156b79288773e5c9422f8793b0ddbd283f97ef8a
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sun Aug 18 13:48:42 2013 +1000

    vc: Clean up valid_repo calls

 meld/vc/bzr.py       |    5 +----
 meld/vc/cvs.py       |    5 +----
 meld/vc/darcs.py     |    5 +----
 meld/vc/fossil.py    |    5 +----
 meld/vc/git.py       |    5 +----
 meld/vc/mercurial.py |    5 +----
 meld/vc/monotone.py  |    5 +----
 7 files changed, 7 insertions(+), 28 deletions(-)
---
diff --git a/meld/vc/bzr.py b/meld/vc/bzr.py
index 42071a2..caf3d18 100644
--- a/meld/vc/bzr.py
+++ b/meld/vc/bzr.py
@@ -109,10 +109,7 @@ class Vc(_vc.CachedVc):
             working_dir=self.root)
 
     def valid_repo(self):
-        if _vc.call([self.CMD, "root"], cwd=self.root):
-            return False
-        else:
-            return True
+        return not _vc.call([self.CMD, "root"], cwd=self.root)
 
     def get_working_directory(self, workdir):
         return self.root
diff --git a/meld/vc/cvs.py b/meld/vc/cvs.py
index ca8f8e2..5541b75 100644
--- a/meld/vc/cvs.py
+++ b/meld/vc/cvs.py
@@ -75,10 +75,7 @@ class Vc(_vc.Vc):
 
     def valid_repo(self):
         entry_path = os.path.join(self.root, self.VC_DIR, "Entries")
-        if os.path.exists(entry_path):
-            return True
-        else:
-            return False
+        return os.path.exists(entry_path)
 
     def get_path_for_repo_file(self, path, commit=None):
         if commit is not None:
diff --git a/meld/vc/darcs.py b/meld/vc/darcs.py
index d854eff..01f086d 100644
--- a/meld/vc/darcs.py
+++ b/meld/vc/darcs.py
@@ -70,10 +70,7 @@ class Vc(_vc.CachedVc):
         return [self.CMD, "resolve"]
 
     def valid_repo(self):
-        if _vc.call([self.CMD, "query", "tags"], cwd=self.root):
-            return False
-        else:
-            return True
+        return not _vc.call([self.CMD, "query", "tags"], cwd=self.root)
 
     def get_working_directory(self, workdir):
         return self.root
diff --git a/meld/vc/fossil.py b/meld/vc/fossil.py
index c29411c..8d8f956 100644
--- a/meld/vc/fossil.py
+++ b/meld/vc/fossil.py
@@ -66,10 +66,7 @@ class Vc(_vc.CachedVc):
         return [self.CMD, "revert"]
 
     def valid_repo(self):
-        if _vc.call([self.CMD, "info"], cwd=self.root):
-            return False
-        else:
-            return True
+        return not _vc.call([self.CMD, "info"], cwd=self.root)
 
     @classmethod
     def check_repo_root(self, location):
diff --git a/meld/vc/git.py b/meld/vc/git.py
index 22e0364..2dba2f7 100644
--- a/meld/vc/git.py
+++ b/meld/vc/git.py
@@ -258,10 +258,7 @@ class Vc(_vc.CachedVc):
     def valid_repo(self):
         # TODO: On Windows, this exit code is wrong under the normal shell; it
         # appears to be correct under the default git bash shell however.
-        if _vc.call([self.CMD, "branch"], cwd=self.root):
-            return False
-        else:
-            return True
+        return not _vc.call([self.CMD, "branch"], cwd=self.root)
 
     def get_working_directory(self, workdir):
         if workdir.startswith("/"):
diff --git a/meld/vc/mercurial.py b/meld/vc/mercurial.py
index ab51f39..8d606be 100644
--- a/meld/vc/mercurial.py
+++ b/meld/vc/mercurial.py
@@ -62,10 +62,7 @@ class Vc(_vc.CachedVc):
         return [self.CMD, "revert"]
 
     def valid_repo(self):
-        if _vc.call([self.CMD, "root"], cwd=self.root):
-            return False
-        else:
-            return True
+        return not _vc.call([self.CMD, "root"], cwd=self.root)
 
     def get_working_directory(self, workdir):
         if workdir.startswith("/"):
diff --git a/meld/vc/monotone.py b/meld/vc/monotone.py
index 1a8f950..6f5922f 100644
--- a/meld/vc/monotone.py
+++ b/meld/vc/monotone.py
@@ -134,10 +134,7 @@ class Vc(_vc.CachedVc):
         return [self.CMD, "resolved"]
 
     def valid_repo(self):
-        if _vc.call([self.CMD, "list", "tags"], cwd=self.root):
-            return False
-        else:
-            return True
+        return not _vc.call([self.CMD, "list", "tags"], cwd=self.root)
 
     def get_working_directory(self, workdir):
         return self.root


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]