changeset 19664:61dcb2aa7378

commitablectx: add a class that will be used as a parent of mutable contexts Currently, we have basectx that serves as a common ancestor of all contexts. We will now add a new class commitablectx that will inherit from basectx and will serve as a common place for code that will be shared between mutable contexts, e.g. workingctx and memctx.
author Sean Farley <sean.michael.farley@gmail.com>
date Wed, 14 Aug 2013 15:02:08 -0500
parents 0af73d7869a6
children cb0c94ef1ebe
files mercurial/context.py
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/context.py	Wed Aug 14 13:32:56 2013 -0500
+++ b/mercurial/context.py	Wed Aug 14 15:02:08 2013 -0500
@@ -821,7 +821,14 @@
         return [filectx(self._repo, self._path, fileid=x,
                         filelog=self._filelog) for x in c]
 
-class workingctx(basectx):
+class commitablectx(basectx):
+    """A commitablectx object provides common functionality for a context that
+    wants the ability to commit, e.g. workingctx or memctx."""
+    def __init__(self, repo, text="", user=None, date=None, extra=None,
+                 changes=None):
+        pass
+
+class workingctx(commitablectx):
     """A workingctx object makes access to data related to
     the current working directory convenient.
     date - any valid date string or (unixtime, offset), or None.