Patchwork [2,of,2,chg-port] commandserver: reset state of progress bar per command

login
register
mail settings
Submitter Yuya Nishihara
Date Dec. 23, 2015, 2:09 p.m.
Message ID <bdabb610a7cbb97f162f.1450879765@mimosa>
Download mbox | patch
Permalink /patch/12293/
State Accepted
Headers show

Comments

Yuya Nishihara - Dec. 23, 2015, 2:09 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1450104602 -32400
#      Mon Dec 14 23:50:02 2015 +0900
# Node ID bdabb610a7cbb97f162f0668eab6ac383b7a31e7
# Parent  38feb09b6b71681c7d141db4e013652fc2fe2c46
commandserver: reset state of progress bar per command

A progress bar is normally disabled in command-server session, but chg can
enable it. This patch makes sure the last-print time is measured per command.
Otherwise, progress.delay could be ineffective if a progbar was loaded before
forking worker process.

This patch is corresponding to the following change.

https://bitbucket.org/yuja/chg/commits/2dfe3e90b365
Augie Fackler - Dec. 29, 2015, 11:18 p.m.
On Wed, Dec 23, 2015 at 11:09:25PM +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1450104602 -32400
> #      Mon Dec 14 23:50:02 2015 +0900
> # Node ID bdabb610a7cbb97f162f0668eab6ac383b7a31e7
> # Parent  38feb09b6b71681c7d141db4e013652fc2fe2c46
> commandserver: reset state of progress bar per command

Queued these, they make enough sense.

>
> A progress bar is normally disabled in command-server session, but chg can
> enable it. This patch makes sure the last-print time is measured per command.
> Otherwise, progress.delay could be ineffective if a progbar was loaded before
> forking worker process.
>
> This patch is corresponding to the following change.
>
> https://bitbucket.org/yuja/chg/commits/2dfe3e90b365
>
> diff --git a/mercurial/commandserver.py b/mercurial/commandserver.py
> --- a/mercurial/commandserver.py
> +++ b/mercurial/commandserver.py
> @@ -214,6 +214,11 @@ class server(object):
>              self.repo.ui = self.repo.dirstate._ui = repoui
>              self.repo.invalidateall()
>
> +        # reset last-print time of progress bar per command
> +        # (progbar is singleton, we don't have to do for all uis)
> +        if copiedui._progbar:
> +            copiedui._progbar.resetstate()
> +
>          for ui in uis:
>              # any kind of interaction must use server channels, but chg may
>              # replace channels by fully functional tty files. so nontty is
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel

Patch

diff --git a/mercurial/commandserver.py b/mercurial/commandserver.py
--- a/mercurial/commandserver.py
+++ b/mercurial/commandserver.py
@@ -214,6 +214,11 @@  class server(object):
             self.repo.ui = self.repo.dirstate._ui = repoui
             self.repo.invalidateall()
 
+        # reset last-print time of progress bar per command
+        # (progbar is singleton, we don't have to do for all uis)
+        if copiedui._progbar:
+            copiedui._progbar.resetstate()
+
         for ui in uis:
             # any kind of interaction must use server channels, but chg may
             # replace channels by fully functional tty files. so nontty is