Patchwork [1,of,4] changegroup: use changelog.readfiles

login
register
mail settings
Submitter Gregory Szorc
Date Feb. 28, 2016, 7:27 a.m.
Message ID <28cf83f79951bba88e32.1456644450@ubuntu-vm-main>
Download mbox | patch
Permalink /patch/13452/
State Accepted
Commit 4ef967661751d3c1e56d9fa75e76a116af465b66
Headers show

Comments

Gregory Szorc - Feb. 28, 2016, 7:27 a.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@gmail.com>
# Date 1456643165 28800
#      Sat Feb 27 23:06:05 2016 -0800
# Node ID 28cf83f79951bba88e324c66e66261e06030dc46
# Parent  41dcd754526612c43b9695df8851557c851828ef
changegroup: use changelog.readfiles

We have a dedicated function to get just the list of files in
a changelog entry. Use it.

This will presumably speed up changegroup application since we're
no longer decoding the entire changelog entry. But I didn't measure
the impact.
Martin von Zweigbergk - Feb. 29, 2016, 6:38 a.m.
On Sat, Feb 27, 2016 at 11:27 PM, Gregory Szorc <gregory.szorc@gmail.com> wrote:
> # HG changeset patch
> # User Gregory Szorc <gregory.szorc@gmail.com>
> # Date 1456643165 28800
> #      Sat Feb 27 23:06:05 2016 -0800
> # Node ID 28cf83f79951bba88e324c66e66261e06030dc46
> # Parent  41dcd754526612c43b9695df8851557c851828ef
> changegroup: use changelog.readfiles
>
> We have a dedicated function to get just the list of files in
> a changelog entry. Use it.
>
> This will presumably speed up changegroup application since we're
> no longer decoding the entire changelog entry. But I didn't measure
> the impact.
>
> diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py
> --- a/mercurial/changegroup.py
> +++ b/mercurial/changegroup.py
> @@ -358,17 +358,17 @@ class cg1unpacker(object):
>                      def __call__(self):
>                          repo.ui.progress(self._step, self._count,
>                                           unit=_('chunks'), total=self._total)
>                          self._count += 1
>                  self.callback = prog(_('changesets'), expectedtotal)
>
>                  efiles = set()
>                  def onchangelog(cl, node):
> -                    efiles.update(cl.read(node)[3])
> +                    efiles.update(cl.readfiles(node))

This is just after write the revision, so I thought there might be
some caching that could make read() faster, but it seems like the
caching is only of the text content, so this should still be better, I
think. Thanks, pushing these first two to the clowncopter and leaving
3-4 to Matt or others.

Patch

diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py
--- a/mercurial/changegroup.py
+++ b/mercurial/changegroup.py
@@ -358,17 +358,17 @@  class cg1unpacker(object):
                     def __call__(self):
                         repo.ui.progress(self._step, self._count,
                                          unit=_('chunks'), total=self._total)
                         self._count += 1
                 self.callback = prog(_('changesets'), expectedtotal)
 
                 efiles = set()
                 def onchangelog(cl, node):
-                    efiles.update(cl.read(node)[3])
+                    efiles.update(cl.readfiles(node))
 
                 self.changelogheader()
                 srccontent = cl.addgroup(self, csmap, trp,
                                          addrevisioncb=onchangelog)
                 efiles = len(efiles)
 
                 if not (srccontent or emptyok):
                     raise error.Abort(_("received changelog group is empty"))