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

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

Comments

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

Patch

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