##// END OF EJS Templates
makememctx: move from patch to context to break import cycle
Augie Fackler -
r20035:cd79d9ab default
parent child Browse files
Show More
@@ -3761,7 +3761,7 b' def import_(ui, repo, patch1=None, *patc'
3761 files, eolmode=None)
3761 files, eolmode=None)
3762 except patch.PatchError, e:
3762 except patch.PatchError, e:
3763 raise util.Abort(str(e))
3763 raise util.Abort(str(e))
3764 memctx = patch.makememctx(repo, (p1.node(), p2.node()),
3764 memctx = context.makememctx(repo, (p1.node(), p2.node()),
3765 message,
3765 message,
3766 opts.get('user') or user,
3766 opts.get('user') or user,
3767 opts.get('date') or date,
3767 opts.get('date') or date,
@@ -195,6 +195,21 b' class basectx(object):'
195 def dirty(self):
195 def dirty(self):
196 return False
196 return False
197
197
198 def makememctx(repo, parents, text, user, date, branch, files, store,
199 editor=None):
200 def getfilectx(repo, memctx, path):
201 data, (islink, isexec), copied = store.getfile(path)
202 return memfilectx(path, data, islink=islink, isexec=isexec,
203 copied=copied)
204 extra = {}
205 if branch:
206 extra['branch'] = encoding.fromlocal(branch)
207 ctx = memctx(repo, parents, text, files, getfilectx, user,
208 date, extra)
209 if editor:
210 ctx._text = editor(repo, ctx, [])
211 return ctx
212
198 class changectx(basectx):
213 class changectx(basectx):
199 """A changecontext object makes access to data related to a particular
214 """A changecontext object makes access to data related to a particular
200 changeset convenient. It represents a read-only context already present in
215 changeset convenient. It represents a read-only context already present in
@@ -16,7 +16,6 b' import email.Parser'
16 from i18n import _
16 from i18n import _
17 from node import hex, short
17 from node import hex, short
18 import base85, mdiff, scmutil, util, diffhelpers, copies, encoding, error
18 import base85, mdiff, scmutil, util, diffhelpers, copies, encoding, error
19 import context
20
19
21 gitre = re.compile('diff --git a/(.*) b/(.*)')
20 gitre = re.compile('diff --git a/(.*) b/(.*)')
22
21
@@ -1441,21 +1440,6 b' def patchrepo(ui, repo, ctx, store, patc'
1441 backend = repobackend(ui, repo, ctx, store)
1440 backend = repobackend(ui, repo, ctx, store)
1442 return patchbackend(ui, backend, patchobj, strip, files, eolmode)
1441 return patchbackend(ui, backend, patchobj, strip, files, eolmode)
1443
1442
1444 def makememctx(repo, parents, text, user, date, branch, files, store,
1445 editor=None):
1446 def getfilectx(repo, memctx, path):
1447 data, (islink, isexec), copied = store.getfile(path)
1448 return context.memfilectx(path, data, islink=islink, isexec=isexec,
1449 copied=copied)
1450 extra = {}
1451 if branch:
1452 extra['branch'] = encoding.fromlocal(branch)
1453 ctx = context.memctx(repo, parents, text, files, getfilectx, user,
1454 date, extra)
1455 if editor:
1456 ctx._text = editor(repo, ctx, [])
1457 return ctx
1458
1459 def patch(ui, repo, patchname, strip=1, files=None, eolmode='strict',
1443 def patch(ui, repo, patchname, strip=1, files=None, eolmode='strict',
1460 similarity=0):
1444 similarity=0):
1461 """Apply <patchname> to the working directory.
1445 """Apply <patchname> to the working directory.
General Comments 0
You need to be logged in to leave comments. Login now