diff options
Diffstat (limited to 'libbe/storage/vcs')
-rw-r--r-- | libbe/storage/vcs/base.py | 18 | ||||
-rw-r--r-- | libbe/storage/vcs/bzr.py | 8 | ||||
-rw-r--r-- | libbe/storage/vcs/darcs.py | 8 | ||||
-rw-r--r-- | libbe/storage/vcs/git.py | 6 | ||||
-rw-r--r-- | libbe/storage/vcs/hg.py | 6 | ||||
-rw-r--r-- | libbe/storage/vcs/monotone.py | 10 |
6 files changed, 28 insertions, 28 deletions
diff --git a/libbe/storage/vcs/base.py b/libbe/storage/vcs/base.py index 0521e90..813905c 100644 --- a/libbe/storage/vcs/base.py +++ b/libbe/storage/vcs/base.py @@ -430,7 +430,7 @@ class VCS (libbe.storage.base.VersionedStorage): Get the file contents as they were in a given revision. Revision==None specifies the current revision. """ - if revision != None: + if revision is not None: raise libbe.storage.base.InvalidRevision( 'The %s VCS does not support revision specifiers' % self.name) path = os.path.join(self.repo, path) @@ -553,7 +553,7 @@ class VCS (libbe.storage.base.VersionedStorage): -1 """ if not hasattr(self, '_parsed_version') \ - or self._parsed_version == None: + or self._parsed_version is None: num_part = self.version().split(' ')[0] self._parsed_version = [] for num in num_part.split('.'): @@ -598,7 +598,7 @@ class VCS (libbe.storage.base.VersionedStorage): return -1 def installed(self): - if self.version() != None: + if self.version() is not None: return True return False @@ -769,7 +769,7 @@ class VCS (libbe.storage.base.VersionedStorage): self._cached_path_id.remove_id(id) def _ancestors(self, id=None, revision=None): - if id==None: + if id is None: path = self.be_dir else: path = self.path(id, revision, relpath=False) @@ -794,7 +794,7 @@ class VCS (libbe.storage.base.VersionedStorage): self._u_rel_path(path), revision) listdir = lambda path : self._vcs_listdir( self._u_rel_path(path), revision) - if id==None: + if id is None: path = self.be_dir else: path = self.path(id, revision, relpath=False) @@ -813,7 +813,7 @@ class VCS (libbe.storage.base.VersionedStorage): if c is None: continue cpath = os.path.join(path, c) children[i] = self._u_path_to_id(cpath) - return [c for c in children if c != None] + return [c for c in children if c is not None] def _get(self, id, default=libbe.util.InvalidObject, revision=None): try: @@ -1017,7 +1017,7 @@ class VCS (libbe.storage.base.VersionedStorage): '/a.b/c/.be' """ if root is None: - assert self.repo != None, "VCS not rooted" + assert self.repo is not None, "VCS not rooted" root = self.repo return os.path.abspath(os.path.join(root, path)) @@ -1138,7 +1138,7 @@ if libbe.TESTING: dp = os.path.realpath(self.dirname) vcs_name = self.Class.name self.assertTrue( - dp == rp or rp == None, + dp == rp or rp is None, "%(vcs_name)s VCS root in wrong dir (%(dp)s %(rp)s)" % vars()) class VCS_get_user_id_TestCase(VCSTestCase): @@ -1151,7 +1151,7 @@ if libbe.TESTING: if user_id is None: return name,email = libbe.ui.util.user.parse_user_id(user_id) - if email != None: + if email is not None: self.assertTrue('@' in email, email) def make_vcs_testcase_subclasses(vcs_class, namespace): diff --git a/libbe/storage/vcs/bzr.py b/libbe/storage/vcs/bzr.py index 6da299a..fa5b879 100644 --- a/libbe/storage/vcs/bzr.py +++ b/libbe/storage/vcs/bzr.py @@ -64,7 +64,7 @@ class Bzr(base.VCS): self.versioned = True def _vcs_version(self): - if bzrlib == None: + if bzrlib is None: return None return bzrlib.__version__ @@ -77,7 +77,7 @@ class Bzr(base.VCS): return c.username() def _vcs_detect(self, path): - if self._u_search_parent_directories(path, '.bzr') != None : + if self._u_search_parent_directories(path, '.bzr') is not None: return True return False @@ -135,7 +135,7 @@ class Bzr(base.VCS): pass def _parse_revision_string(self, revision=None): - if revision == None: + if revision is None: return revision rev_opt = bzrlib.option.Option.OPTIONS['revision'] try: @@ -145,7 +145,7 @@ class Bzr(base.VCS): return rev_spec def _vcs_get_file_contents(self, path, revision=None): - if revision == None: + if revision is None: return base.VCS._vcs_get_file_contents(self, path, revision) path = os.path.join(self.repo, path) revision = self._parse_revision_string(revision) diff --git a/libbe/storage/vcs/darcs.py b/libbe/storage/vcs/darcs.py index 12eabf4..07ddb9e 100644 --- a/libbe/storage/vcs/darcs.py +++ b/libbe/storage/vcs/darcs.py @@ -178,7 +178,7 @@ class Darcs(base.VCS): if revision is None: return base.VCS._vcs_get_file_contents(self, path, revision) if self.version_cmp(2, 0, 0) == 1: - status,output,error = self._u_invoke_client( \ + status,output,error = self._u_invoke_client( 'show', 'contents', '--patch', revision, path) return output # Darcs versions < 2.0.0pre2 lack the 'show contents' command @@ -209,7 +209,7 @@ class Darcs(base.VCS): if self.version_cmp(2, 3, 1) == 1: # Sun Nov 15 20:32:06 EST 2009 thomashartman1@gmail.com # * add versioned show files functionality (darcs show files -p 'some patch') - status,output,error = self._u_invoke_client( \ + status,output,error = self._u_invoke_client( 'show', 'files', '--no-files', '--patch', revision) children = output.rstrip('\n').splitlines() rpath = '.' @@ -227,7 +227,7 @@ class Darcs(base.VCS): # Wed Dec 9 05:42:21 EST 2009 Luca Molteni <volothamp@gmail.com> # * resolve issue835 show file with file directory arguments path = path.rstrip(os.path.sep) - status,output,error = self._u_invoke_client( \ + status,output,error = self._u_invoke_client( 'show', 'files', '--patch', revision, path) files = output.rstrip('\n').splitlines() if path == '.': @@ -243,7 +243,7 @@ class Darcs(base.VCS): def _vcs_commit(self, commitfile, allow_empty=False): id = self.get_user_id() - if id == None or '@' not in id: + if id is None or '@' not in id: id = '%s <%s@invalid.com>' % (id, id) args = ['record', '--all', '--author', id, '--logfile', commitfile] status,output,error = self._u_invoke_client(*args) diff --git a/libbe/storage/vcs/git.py b/libbe/storage/vcs/git.py index 9a15c92..d8a966d 100644 --- a/libbe/storage/vcs/git.py +++ b/libbe/storage/vcs/git.py @@ -191,7 +191,7 @@ class PygitGit(base.VCS): return eobj def _vcs_get_file_contents(self, path, revision=None): - if revision == None: + if revision is None: return base.VCS._vcs_get_file_contents(self, path, revision) else: blob = self._git_get_object(path=path, revision=revision) @@ -311,7 +311,7 @@ class ExecGit (PygitGit): return None # Git has no infomation def _vcs_detect(self, path): - if self._u_search_parent_directories(path, '.git') != None : + if self._u_search_parent_directories(path, '.git') is not None: return True return False @@ -339,7 +339,7 @@ class ExecGit (PygitGit): if not os.path.isdir(self._u_abspath(path)): self._u_invoke_client('rm', '-f', path) def _vcs_get_file_contents(self, path, revision=None): - if revision == None: + if revision is None: return base.VCS._vcs_get_file_contents(self, path, revision) else: arg = '%s:%s' % (revision,path) diff --git a/libbe/storage/vcs/hg.py b/libbe/storage/vcs/hg.py index 0ebdfb0..6198bc8 100644 --- a/libbe/storage/vcs/hg.py +++ b/libbe/storage/vcs/hg.py @@ -74,7 +74,7 @@ class Hg(base.VCS): self.__updated = [] # work around http://mercurial.selenic.com/bts/issue618 def _vcs_version(self): - if version == None: + if version is None: return None return version() @@ -106,7 +106,7 @@ class Hg(base.VCS): def _vcs_detect(self, path): """Detect whether a directory is revision-controlled using Mercurial""" - if self._u_search_parent_directories(path, '.hg') != None: + if self._u_search_parent_directories(path, '.hg') is not None: return True return False @@ -131,7 +131,7 @@ class Hg(base.VCS): self.__updated.append(path) # work around http://mercurial.selenic.com/bts/issue618 def _vcs_get_file_contents(self, path, revision=None): - if revision == None: + if revision is None: return base.VCS._vcs_get_file_contents(self, path, revision) else: return self._u_invoke_client('cat', '-r', revision, path) diff --git a/libbe/storage/vcs/monotone.py b/libbe/storage/vcs/monotone.py index 1d74c5b..4eaced8 100644 --- a/libbe/storage/vcs/monotone.py +++ b/libbe/storage/vcs/monotone.py @@ -86,7 +86,7 @@ class Monotone (base.VCS): -1 """ if not hasattr(self, '_parsed_version') \ - or self._parsed_version == None: + or self._parsed_version is None: self._parsed_version = [int(x) for x in self.version().split('.')] for current,other in zip(self._parsed_version, args): c = cmp(current,other) @@ -129,7 +129,7 @@ class Monotone (base.VCS): return None # Monotone has no infomation def _vcs_detect(self, path): - if self._u_search_parent_directories(path, '_MTN') != None : + if self._u_search_parent_directories(path, '_MTN') is not None: return True return False @@ -153,11 +153,11 @@ class Monotone (base.VCS): """Invoke the client on our branch. """ arglist = [] - if self._db_path != None: + if self._db_path is not None: arglist.extend(['--db', self._db_path]) - if self._key != None: + if self._key is not None: arglist.extend(['--key', self._key]) - if self._key_dir != None: + if self._key_dir is not None: arglist.extend(['--keydir', self._key_dir]) arglist.extend(args) args = tuple(arglist) |