[PATCH RFC] histedit: add exec command (issue4036)

Durham Goode durham at fb.com
Tue Nov 12 12:04:45 CST 2013


On 11/12/13 10:01 AM, "Durham Goode" <durham at fb.com> wrote:

>
>diff --git a/hgext/histedit.py b/hgext/histedit.py
>--- a/hgext/histedit.py
>+++ b/hgext/histedit.py
>@@ -405,6 +402,26 @@
>     # We didn't make an edit, so just indicate no replaced nodes
>     return newctx, []
> 
>+def execute(ui, repo, ctx, ha, opts):
>+    hg.update(repo, ctx.node())
>+    os.system(ha)
>+
>+    # reset caches
>+    repo.changelog
>+    del repo.changelog
>+    repo.manifest
>+    del repo.manifest
>+    repo.dirstate
>+    del repo.dirstate
>+    repo._phasecache
>+    del repo._phasecache
>+
>+    newctx = repo['.']
>+    if not ctx.node() in repo:
>+        return newctx, [(ctx.node(), (newctx.node(),))]
>+
>+    return newctx, []
>+

It's also worth calling out that I don't think our property caches
(repo.changelog/manifest/dirstate/etc) are being invalidated correctly
when the underlying file changes. I haven't had time to dig in, but
manually invalidating the cache here was required in order for it to pick
up new changes.



More information about the Mercurial-devel mailing list