changeset 14089:d3f7e110c3c0

opener: introduce an abstact superclass of it Currently, this class doesn't do anything useful.
author Dan Villiom Podlaski Christiansen <danchr@gmail.com>
date Sat, 30 Apr 2011 19:36:48 +0200
parents e83ced8b6464
children e24b5e3c2f27
files mercurial/scmutil.py
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/scmutil.py	Sat Apr 30 19:42:00 2011 +0200
+++ b/mercurial/scmutil.py	Sat Apr 30 19:36:48 2011 +0200
@@ -129,7 +129,14 @@
         # want to add "foo/bar/baz" before checking if there's a "foo/.hg"
         self.auditeddir.update(prefixes)
 
-class opener(object):
+class abstractopener(object):
+    """Abstract base class; cannot be instantiated"""
+
+    def __init__(self, *args, **kwargs):
+        '''Prevent instantiation; don't call this from subclasses.'''
+        raise NotImplementedError('attempted instantiating ' + str(type(self)))
+
+class opener(abstractopener):
     '''Open files relative to a base directory
 
     This class is used to hide the details of COW semantics and