[PATCH 08 of 48 RFC] commitablectx: move __init__ from workingctx

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


# HG changeset patch
# User Sean Farley <sean.michael.farley at gmail.com>
# Date 1376511898 18000
#      Wed Aug 14 15:24:58 2013 -0500
# Node ID aa513e429c79d5267e3072bd8525ea467c42e42a
# Parent  6add45ab8921d649e279bf3f0fc4af22fc97450c
commitablectx: move __init__ from workingctx

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -824,23 +824,10 @@
 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.
-    changes - a list of file lists as returned by localrepo.status()
-               or None to use the repository status.
-    """
-    def __init__(self, repo, text="", user=None, date=None, extra=None,
-                 changes=None):
         self._repo = repo
         self._rev = None
         self._node = None
         self._text = text
         if date:
@@ -867,10 +854,23 @@
                 raise util.Abort(_('branch name not in UTF-8!'))
             self._extra['branch'] = branch
         if self._extra['branch'] == '':
             self._extra['branch'] = 'default'
 
+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.
+    changes - a list of file lists as returned by localrepo.status()
+               or None to use the repository status.
+    """
+    def __init__(self, repo, text="", user=None, date=None, extra=None,
+                 changes=None):
+        super(workingctx, self).__init__(repo, text, user, date, extra, changes)
+
     def __str__(self):
         return str(self._parents[0]) + "+"
 
     def __nonzero__(self):
         return True


More information about the Mercurial-devel mailing list