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

login
register
mail settings
Submitter Sean Farley
Date Sept. 5, 2013, 8:07 p.m.
Message ID <4bee0401bfe496be4aea.1378411658@laptop.local>
Download mbox | patch
Permalink /patch/2382/
State Accepted
Commit f0f8380ec516e69dc129ffe92cb48a6d6ff151d9
Headers show

Comments

Sean Farley - Sept. 5, 2013, 8:07 p.m.
# HG changeset patch
# User Sean Farley <sean.michael.farley@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.

Patch

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