Patchwork [6,of,6] rebase: use hg.updatetotally instead of commands.update for efficiency

login
register
mail settings
Submitter Katsunori FUJIWARA
Date March 11, 2016, 7:41 p.m.
Message ID <1b9adcf57c8eba8c3bee.1457725271@feefifofum>
Download mbox | patch
Permalink /patch/13809/
State Changes Requested
Headers show

Comments

Katsunori FUJIWARA - March 11, 2016, 7:41 p.m.
# HG changeset patch
# User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
# Date 1457724942 -32400
#      Sat Mar 12 04:35:42 2016 +0900
# Node ID 1b9adcf57c8eba8c3bee50a8de8b11ef0502b28f
# Parent  4ec341fd8f85ca07dc6f99d82c155e9d559be390
rebase: use hg.updatetotally instead of commands.update for efficiency

Using hg.updatetotally() instead of commands.update() is efficient in
the point of below:

  - meaningless checking options in commands.update() is omitted

  - calculation of update destination by destutil.destupdate() occurs
    only once
Sean Farley - March 11, 2016, 8:17 p.m.
FUJIWARA Katsunori <foozy@lares.dti.ne.jp> writes:

> # HG changeset patch
> # User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
> # Date 1457724942 -32400
> #      Sat Mar 12 04:35:42 2016 +0900
> # Node ID 1b9adcf57c8eba8c3bee50a8de8b11ef0502b28f
> # Parent  4ec341fd8f85ca07dc6f99d82c155e9d559be390
> rebase: use hg.updatetotally instead of commands.update for efficiency

Patch 1 in this series looks fine. I think I like the rest but haven't
fully groked it.

> Using hg.updatetotally() instead of commands.update() is efficient in
> the point of below:
>
>   - meaningless checking options in commands.update() is omitted
>
>   - calculation of update destination by destutil.destupdate() occurs
>     only once

I think that's ok but I'll defer to other reviewers.
Pierre-Yves David - March 11, 2016, 11:05 p.m.
On 03/11/2016 07:41 PM, FUJIWARA Katsunori wrote:
> # HG changeset patch
> # User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
> # Date 1457724942 -32400
> #      Sat Mar 12 04:35:42 2016 +0900
> # Node ID 1b9adcf57c8eba8c3bee50a8de8b11ef0502b28f
> # Parent  4ec341fd8f85ca07dc6f99d82c155e9d559be390
> rebase: use hg.updatetotally instead of commands.update for efficiency
>
> Using hg.updatetotally() instead of commands.update() is efficient in
> the point of below:
>
>    - meaningless checking options in commands.update() is omitted
>
>    - calculation of update destination by destutil.destupdate() occurs
>      only once

I'm unsure what kind of consistency we are talking about.

Do you have performance number?

Patch

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -1213,14 +1213,13 @@  def pullrebase(orig, ui, repo, *args, **
                     rebase(ui, repo, **opts)
                 except error.NoMergeDestAbort:
                     # we can maybe update instead
-                    rev, _a, _b = destutil.destupdate(repo)
-                    if rev == repo['.'].rev():
-                        ui.status(_('nothing to rebase\n'))
-                    else:
+                    def skipupdate(destrev):
+                        if destrev == repo['.'].rev():
+                            ui.status(_('nothing to rebase\n'))
+                            return True
                         ui.status(_('nothing to rebase - updating instead\n'))
-                        # not passing argument to get the bare update behavior
-                        # with warning and trumpets
-                        commands.update(ui, repo)
+                    hg.updatetotally(ui, repo, None, None,
+                                     skipupdate=skipupdate)
         finally:
             release(lock, wlock)
     else: