Profile image for Ian Lewis IanLewis
A snippet showing how to do an in memory commit with Mercurial's api.
Language
Python
Tags
commit in memory mercurial

Mercurial in memory commit

1 from mercurial.localrepo import localrepository 2 from mercurial. import ui 3 from mercurial.context import memctx,memfilectx 4 5 repo = localrepository(ui.ui(), "/path/to/repository/") 6 ctx = memctx( 7 repo=repo, 8 parents=("tip", None), 9 text = "Commit Message", 10 files = ['text.txt'], 11 filectxfn = lambda repo, memctx, path: memfilectx(path, "text.txt file data", False, False, None), 12 user = "Ian Lewis", 13 ) 14 15 repo.commitctx(ctx)

Comments