Mercurial > evolve
comparison hgext/evolve.py @ 954:ef155e3ead8f
evolve: abstract access to context.memfilectx
This class is getting altered in the future Mercurial 3.1.0. This changeset
prepare a compatibility layer.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Tue, 03 Jun 2014 01:22:31 -0700 |
parents | a02e5916a7e3 |
children | 72670e282460 |
comparison
equal
deleted
inserted
replaced
953:a02e5916a7e3 | 954:ef155e3ead8f |
---|---|
71 from mercurial import localrepo | 71 from mercurial import localrepo |
72 from mercurial.hgweb import hgweb_mod | 72 from mercurial.hgweb import hgweb_mod |
73 | 73 |
74 _pack = struct.pack | 74 _pack = struct.pack |
75 | 75 |
76 memfilectx = context.memfilectx | |
76 | 77 |
77 # This extension contains the following code | 78 # This extension contains the following code |
78 # | 79 # |
79 # - Extension Helper code | 80 # - Extension Helper code |
80 # - Obsolescence cache | 81 # - Obsolescence cache |
753 headmf = head.manifest() | 754 headmf = head.manifest() |
754 def filectxfn(repo, ctx, path): | 755 def filectxfn(repo, ctx, path): |
755 if path in headmf: | 756 if path in headmf: |
756 fctx = head[path] | 757 fctx = head[path] |
757 flags = fctx.flags() | 758 flags = fctx.flags() |
758 mctx = context.memfilectx(fctx.path(), fctx.data(), | 759 mctx = memfilectx(fctx.path(), fctx.data(), |
759 islink='l' in flags, | 760 islink='l' in flags, |
760 isexec='x' in flags, | 761 isexec='x' in flags, |
761 copied=copied.get(path)) | 762 copied=copied.get(path)) |
762 return mctx | 763 return mctx |
763 raise IOError() | 764 raise IOError() |
764 | 765 |
765 message = cmdutil.logmessage(repo.ui, commitopts) | 766 message = cmdutil.logmessage(repo.ui, commitopts) |
766 if not message: | 767 if not message: |
1403 if files: # something to commit! | 1404 if files: # something to commit! |
1404 def filectxfn(repo, ctx, path): | 1405 def filectxfn(repo, ctx, path): |
1405 if path in bumped: | 1406 if path in bumped: |
1406 fctx = bumped[path] | 1407 fctx = bumped[path] |
1407 flags = fctx.flags() | 1408 flags = fctx.flags() |
1408 mctx = context.memfilectx(fctx.path(), fctx.data(), | 1409 mctx = memfilectx(fctx.path(), fctx.data(), |
1409 islink='l' in flags, | 1410 islink='l' in flags, |
1410 isexec='x' in flags, | 1411 isexec='x' in flags, |
1411 copied=copied.get(path)) | 1412 copied=copied.get(path)) |
1412 return mctx | 1413 return mctx |
1413 raise IOError() | 1414 raise IOError() |
1414 text = 'bumped update to %s:\n\n' % prec | 1415 text = 'bumped update to %s:\n\n' % prec |
1415 text += bumped.description() | 1416 text += bumped.description() |
1416 | 1417 |
1833 def filectxfn(repo, memctx, path): | 1834 def filectxfn(repo, memctx, path): |
1834 if path not in ctx: | 1835 if path not in ctx: |
1835 raise IOError() | 1836 raise IOError() |
1836 fctx = ctx[path] | 1837 fctx = ctx[path] |
1837 flags = fctx.flags() | 1838 flags = fctx.flags() |
1838 mctx = context.memfilectx(fctx.path(), fctx.data(), | 1839 mctx = memfilectx(fctx.path(), fctx.data(), |
1839 islink='l' in flags, | 1840 islink='l' in flags, |
1840 isexec='x' in flags, | 1841 isexec='x' in flags, |
1841 copied=copied.get(path)) | 1842 copied=copied.get(path)) |
1842 return mctx | 1843 return mctx |
1843 | 1844 |
1844 new = context.memctx(repo, | 1845 new = context.memctx(repo, |
1845 parents=[base.node(), node.nullid], | 1846 parents=[base.node(), node.nullid], |
1846 text=ctx.description(), | 1847 text=ctx.description(), |