Mercurial > public > mercurial-scm > hg
diff mercurial/context.py @ 21689:503bb3af70fe
memfilectx: call super.__init__ instead of duplicating code
This patch changes the calling signature of memfilectx's __init__ to fall in
line with the other file contexts.
Calling code and tests have been updated accordingly.
author | Sean Farley <sean.michael.farley@gmail.com> |
---|---|
date | Thu, 15 Aug 2013 16:49:27 -0500 |
parents | cc677803bad4 |
children | da352312fa18 |
line wrap: on
line diff
--- a/mercurial/context.py Thu Aug 15 15:23:36 2013 -0500 +++ b/mercurial/context.py Thu Aug 15 16:49:27 2013 -0500 @@ -335,8 +335,8 @@ editor=None): def getfilectx(repo, memctx, path): data, (islink, isexec), copied = store.getfile(path) - return memfilectx(path, data, islink=islink, isexec=isexec, - copied=copied) + return memfilectx(repo, path, data, islink=islink, isexec=isexec, + copied=copied, memctx=memctx) extra = {} if branch: extra['branch'] = encoding.fromlocal(branch) @@ -1589,9 +1589,10 @@ class memfilectx(committablefilectx): """memfilectx represents an in-memory file to commit. - See memctx for more details. + See memctx and commitablefilectx for more details. """ - def __init__(self, path, data, islink=False, isexec=False, copied=None): + def __init__(self, repo, path, data, islink=False, + isexec=False, copied=None, memctx=None): """ path is the normalized file path relative to repository root. data is the file content as a string. @@ -1599,7 +1600,7 @@ isexec is True if the file is executable. copied is the source file path if current file was copied in the revision being committed, or None.""" - self._path = path + super(memfilectx, self).__init__(repo, path, None, memctx) self._data = data self._flags = (islink and 'l' or '') + (isexec and 'x' or '') self._copied = None