Patchwork [11,of,11] histedit: use overlayfilectx

login
register
mail settings
Submitter Jun Wu
Date May 10, 2017, 8:34 a.m.
Message ID <4eee1c8299c0c4cd48cd.1494405270@x1c>
Download mbox | patch
Permalink /patch/20557/
State Accepted
Headers show

Comments

Jun Wu - May 10, 2017, 8:34 a.m.
# HG changeset patch
# User Jun Wu <quark@fb.com>
# Date 1494399497 25200
#      Tue May 09 23:58:17 2017 -0700
# Node ID 4eee1c8299c0c4cd48cd99e2bcc6dfcfcb755c9d
# Parent  c8bef30e0a55b7f71add722b4f584bd813140eca
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r 4eee1c8299c0
histedit: use overlayfilectx

Like the previous patch, this simplifies the code and could have perf win if
an involved flag processor is expensive.
Sean Farley - May 10, 2017, 5:40 p.m.
Jun Wu <quark@fb.com> writes:

> # HG changeset patch
> # User Jun Wu <quark@fb.com>
> # Date 1494399497 25200
> #      Tue May 09 23:58:17 2017 -0700
> # Node ID 4eee1c8299c0c4cd48cd99e2bcc6dfcfcb755c9d
> # Parent  c8bef30e0a55b7f71add722b4f584bd813140eca
> # Available At https://bitbucket.org/quark-zju/hg-draft
> #              hg pull https://bitbucket.org/quark-zju/hg-draft -r 4eee1c8299c0
> histedit: use overlayfilectx
>
> Like the previous patch, this simplifies the code and could have perf win if
> an involved flag processor is expensive.

Good series to move this forward. I didn't see any big gotchas so it
looks fine to me.
Yuya Nishihara - May 12, 2017, 1:40 p.m.
On Wed, 10 May 2017 10:40:12 -0700, Sean Farley wrote:
> Jun Wu <quark@fb.com> writes:
> 
> > # HG changeset patch
> > # User Jun Wu <quark@fb.com>
> > # Date 1494399497 25200
> > #      Tue May 09 23:58:17 2017 -0700
> > # Node ID 4eee1c8299c0c4cd48cd99e2bcc6dfcfcb755c9d
> > # Parent  c8bef30e0a55b7f71add722b4f584bd813140eca
> > # Available At https://bitbucket.org/quark-zju/hg-draft
> > #              hg pull https://bitbucket.org/quark-zju/hg-draft -r 4eee1c8299c0
> > histedit: use overlayfilectx
> >
> > Like the previous patch, this simplifies the code and could have perf win if
> > an involved flag processor is expensive.
> 
> Good series to move this forward. I didn't see any big gotchas so it
> looks fine to me.

I've queued the first 7 patches, thanks.

Patch

diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -581,11 +581,5 @@  def collapse(repo, first, last, commitop
         if path in headmf:
             fctx = last[path]
-            flags = fctx.flags()
-            mctx = context.memfilectx(repo,
-                                      fctx.path(), fctx.data(),
-                                      islink='l' in flags,
-                                      isexec='x' in flags,
-                                      copied=copied.get(path))
-            return mctx
+            return context.overlayfilectx(fctx, copied=copied.get(path, False))
         return None