[PATCH 3 of 5] localrepo: add memcommit() to commit without working directory
Matt Mackall
mpm at selenic.com
Mon Jun 2 18:06:15 CDT 2008
On Mon, 2008-06-02 at 23:31 +0200, Patrick Mezard wrote:
> # HG changeset patch
> # User Patrick Mezard <pmezard at gmail.com>
> # Date 1212441833 -7200
> # Node ID 50a52215368f4127b5fe720ad49ad214a9ddf8de
> # Parent 994a2a32961411354900a07bdb4a7f50ddc3a01d
> localrepo: add memcommit() to commit without working directory
>
> diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
> --- a/mercurial/localrepo.py
> +++ b/mercurial/localrepo.py
> @@ -12,6 +12,23 @@
> import lock, transaction, stat, errno, ui
> import os, revlog, time, util, extensions, hook, inspect
> import match as match_
> +
> +class fileobject:
> + def name(self):
> + raise NotImplementedError()
> + def data(self):
> + """Return the file raw data, no filters are applied when
> + committed. Raise IOError or OSError if the file does not
> + exist.
> + """
> + raise NotImplementedError()
> + def islink(self):
> + return False
> + def isexec(self):
> + return False
> + def copied(self):
> + """Return the manifest name of the copied file or None."""
> + return None
Seems unfortunate to introduce a whole new type for this when we have
something that's almost what's wanted.
Here's another approach: let's make commit take a context and then
invent a new sort of context that we'd call a memctx. A memctx would be
a subclass of a regular ctx with the ability to overlay various bits of
it (parents, branch names, file flags and contents).
So convert would take the context for the parent converted commit, make
it a memctx, set it to have the appropriate parents, and also set the
relevant file data and permissions. The latter two parts could actually
be done with callbacks, so that we don't have to have entire changesets
in memory.
This would also make it easy to kill the rawcommit concept.
--
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial-devel
mailing list