[PATCH 44 of 48 RFC] commitablefilectx: add a class that will be used for mutable file contexts

Sean Farley sean.michael.farley at gmail.com
Thu Sep 5 15:07:38 CDT 2013


# HG changeset patch
# User Sean Farley <sean.michael.farley at gmail.com>
# Date 1376590311 18000
#      Thu Aug 15 13:11:51 2013 -0500
# Node ID 4bee0401bfe496be4aea50a0ff61df1aff8f814a
# Parent  337d91d1d8fa975f2e0589d87c716cabfea98592
commitablefilectx: add a class that will be used for mutable file contexts

Just like commitablectx, this will serve as a common place for code that will
be shared between workingfilectx and memfilectx.

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -1186,11 +1186,17 @@
                     self._repo.dirstate.add(dest)
                 self._repo.dirstate.copy(source, dest)
             finally:
                 wlock.release()
 
-class workingfilectx(basefilectx):
+class commitablefilectx(basefilectx):
+    """A commitablefilectx provides common functionality for a file context that
+    wants the ability to commit, e.g. workingfilectx or memfilectx."""
+    def __init__(self, repo, path, filelog=None, ctx=None):
+        pass
+
+class workingfilectx(commitablefilectx):
     """A workingfilectx object makes access to data related to a particular
        file in the working directory convenient."""
     def __init__(self, repo, path, filelog=None, workingctx=None):
         self._repo = repo
         self._path = path


More information about the Mercurial-devel mailing list