--- a/mercurial/commands.py Wed Nov 06 16:48:06 2013 -0500
+++ b/mercurial/commands.py Wed Nov 06 22:09:15 2013 -0500
@@ -3761,12 +3761,12 @@
files, eolmode=None)
except patch.PatchError, e:
raise util.Abort(str(e))
- memctx = patch.makememctx(repo, (p1.node(), p2.node()),
- message,
- opts.get('user') or user,
- opts.get('date') or date,
- branch, files, store,
- editor=cmdutil.commiteditor)
+ memctx = context.makememctx(repo, (p1.node(), p2.node()),
+ message,
+ opts.get('user') or user,
+ opts.get('date') or date,
+ branch, files, store,
+ editor=cmdutil.commiteditor)
repo.savecommitmessage(memctx.description())
n = memctx.commit()
finally:
--- a/mercurial/context.py Wed Nov 06 16:48:06 2013 -0500
+++ b/mercurial/context.py Wed Nov 06 22:09:15 2013 -0500
@@ -195,6 +195,21 @@
def dirty(self):
return False
+def makememctx(repo, parents, text, user, date, branch, files, store,
+ editor=None):
+ def getfilectx(repo, memctx, path):
+ data, (islink, isexec), copied = store.getfile(path)
+ return memfilectx(path, data, islink=islink, isexec=isexec,
+ copied=copied)
+ extra = {}
+ if branch:
+ extra['branch'] = encoding.fromlocal(branch)
+ ctx = memctx(repo, parents, text, files, getfilectx, user,
+ date, extra)
+ if editor:
+ ctx._text = editor(repo, ctx, [])
+ return ctx
+
class changectx(basectx):
"""A changecontext object makes access to data related to a particular
changeset convenient. It represents a read-only context already present in
--- a/mercurial/patch.py Wed Nov 06 16:48:06 2013 -0500
+++ b/mercurial/patch.py Wed Nov 06 22:09:15 2013 -0500
@@ -16,7 +16,6 @@
from i18n import _
from node import hex, short
import base85, mdiff, scmutil, util, diffhelpers, copies, encoding, error
-import context
gitre = re.compile('diff --git a/(.*) b/(.*)')
@@ -1441,21 +1440,6 @@
backend = repobackend(ui, repo, ctx, store)
return patchbackend(ui, backend, patchobj, strip, files, eolmode)
-def makememctx(repo, parents, text, user, date, branch, files, store,
- editor=None):
- def getfilectx(repo, memctx, path):
- data, (islink, isexec), copied = store.getfile(path)
- return context.memfilectx(path, data, islink=islink, isexec=isexec,
- copied=copied)
- extra = {}
- if branch:
- extra['branch'] = encoding.fromlocal(branch)
- ctx = context.memctx(repo, parents, text, files, getfilectx, user,
- date, extra)
- if editor:
- ctx._text = editor(repo, ctx, [])
- return ctx
-
def patch(ui, repo, patchname, strip=1, files=None, eolmode='strict',
similarity=0):
"""Apply <patchname> to the working directory.