From patchwork Thu Sep 5 20:07:01 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [07, of, 48, RFC] commitablectx: add a class that will be used as a parent of mutable contexts From: Sean Farley X-Patchwork-Id: 2345 Message-Id: <6add45ab8921d649e279.1378411621@laptop.local> To: mercurial-devel@selenic.com Date: Thu, 05 Sep 2013 15:07:01 -0500 # HG changeset patch # User Sean Farley # Date 1376510528 18000 # Wed Aug 14 15:02:08 2013 -0500 # Node ID 6add45ab8921d649e279bf3f0fc4af22fc97450c # Parent 7fa9dbb4d6ea9ac15c8ec0e9631bc9f626034a34 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. diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -819,11 +819,18 @@ # hard for renames c = self._filelog.children(self._filenode) 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. user - username string, or None. extra - a dictionary of extra values, or None.