Patchwork perf: add perflist to make finding available perf commands easier

login
register
mail settings
Submitter Augie Fackler
Date Nov. 14, 2014, 3:44 p.m.
Message ID <481938f95e2a7babaac5.1415979859@arthedain.pit.corp.google.com>
Download mbox | patch
Permalink /patch/6732/
State Rejected
Headers show

Comments

Augie Fackler - Nov. 14, 2014, 3:44 p.m.
# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 1415979725 18000
#      Fri Nov 14 10:42:05 2014 -0500
# Node ID 481938f95e2a7babaac569a3288f237ec900a615
# Parent  787ccc893f1fe3fce36debddaa12d3223fa9efc5
perf: add perflist to make finding available perf commands easier
Pierre-Yves David - Nov. 14, 2014, 4:31 p.m.
On 11/14/2014 03:44 PM, Augie Fackler wrote:
> # HG changeset patch
> # User Augie Fackler <augie@google.com>
> # Date 1415979725 18000
> #      Fri Nov 14 10:42:05 2014 -0500
> # Node ID 481938f95e2a7babaac569a3288f237ec900a615
> # Parent  787ccc893f1fe3fce36debddaa12d3223fa9efc5
> perf: add perflist to make finding available perf commands easier
>
> diff --git a/contrib/perf.py b/contrib/perf.py
> --- a/contrib/perf.py
> +++ b/contrib/perf.py
> @@ -1,5 +1,7 @@
>   # perf.py - performance test routines
> -'''helper extension to measure performance'''
> +'''helper extension to measure performance
> +
> +Run the perflist subcommand to list available measurements.'''
>
>   from mercurial import cmdutil, scmutil, util, commands, obsolete
>   from mercurial import repoview, branchmap, merge, copies
> @@ -9,6 +11,13 @@ import functools
>   cmdtable = {}
>   command = cmdutil.command(cmdtable)
>
> +@command('perflist', norepo=True)
> +def perflist(ui):

Can I trick you into adding a docstring to this shinning new methods?
Simon King - Nov. 14, 2014, 4:50 p.m.
On Fri, Nov 14, 2014 at 3:44 PM, Augie Fackler <raf@durin42.com> wrote:
> # HG changeset patch
> # User Augie Fackler <augie@google.com>
> # Date 1415979725 18000
> #      Fri Nov 14 10:42:05 2014 -0500
> # Node ID 481938f95e2a7babaac569a3288f237ec900a615
> # Parent  787ccc893f1fe3fce36debddaa12d3223fa9efc5
> perf: add perflist to make finding available perf commands easier
>
> diff --git a/contrib/perf.py b/contrib/perf.py
> --- a/contrib/perf.py
> +++ b/contrib/perf.py
> @@ -1,5 +1,7 @@
>  # perf.py - performance test routines
> -'''helper extension to measure performance'''
> +'''helper extension to measure performance
> +
> +Run the perflist subcommand to list available measurements.'''
>
>  from mercurial import cmdutil, scmutil, util, commands, obsolete
>  from mercurial import repoview, branchmap, merge, copies
> @@ -9,6 +11,13 @@ import functools
>  cmdtable = {}
>  command = cmdutil.command(cmdtable)
>
> +@command('perflist', norepo=True)
> +def perflist(ui):
> +    for c in cmdtable:
> +        if c == 'perflist':
> +            continue
> +        ui.write('%s\n' % c)
> +
>  def gettimer(ui, opts=None):
>      """return a timer function and formatter: (timer, formatter)
>

Doesn't "hg help -e perf" give you this information?

Simon
Pierre-Yves David - Nov. 14, 2014, 5:49 p.m.
On 11/14/2014 04:50 PM, Simon King wrote:
> On Fri, Nov 14, 2014 at 3:44 PM, Augie Fackler <raf@durin42.com> wrote:
>> # HG changeset patch
>> # User Augie Fackler <augie@google.com>
>> # Date 1415979725 18000
>> #      Fri Nov 14 10:42:05 2014 -0500
>> # Node ID 481938f95e2a7babaac569a3288f237ec900a615
>> # Parent  787ccc893f1fe3fce36debddaa12d3223fa9efc5
>> perf: add perflist to make finding available perf commands easier
>>
>> diff --git a/contrib/perf.py b/contrib/perf.py
>> --- a/contrib/perf.py
>> +++ b/contrib/perf.py
>> @@ -1,5 +1,7 @@
>>   # perf.py - performance test routines
>> -'''helper extension to measure performance'''
>> +'''helper extension to measure performance
>> +
>> +Run the perflist subcommand to list available measurements.'''
>>
>>   from mercurial import cmdutil, scmutil, util, commands, obsolete
>>   from mercurial import repoview, branchmap, merge, copies
>> @@ -9,6 +11,13 @@ import functools
>>   cmdtable = {}
>>   command = cmdutil.command(cmdtable)
>>
>> +@command('perflist', norepo=True)
>> +def perflist(ui):
>> +    for c in cmdtable:
>> +        if c == 'perflist':
>> +            continue
>> +        ui.write('%s\n' % c)
>> +
>>   def gettimer(ui, opts=None):
>>       """return a timer function and formatter: (timer, formatter)
>>
>
> Doesn't "hg help -e perf" give you this information?


Good catch!, dropping the patch.
Augie Fackler - Nov. 14, 2014, 5:50 p.m.
Now I feel dumb. Thanks!

On Fri, Nov 14, 2014 at 12:49 PM, Pierre-Yves David
<pierre-yves.david@ens-lyon.org> wrote:
>
>
> On 11/14/2014 04:50 PM, Simon King wrote:
>>
>> On Fri, Nov 14, 2014 at 3:44 PM, Augie Fackler <raf@durin42.com> wrote:
>>>
>>> # HG changeset patch
>>> # User Augie Fackler <augie@google.com>
>>> # Date 1415979725 18000
>>> #      Fri Nov 14 10:42:05 2014 -0500
>>> # Node ID 481938f95e2a7babaac569a3288f237ec900a615
>>> # Parent  787ccc893f1fe3fce36debddaa12d3223fa9efc5
>>> perf: add perflist to make finding available perf commands easier
>>>
>>> diff --git a/contrib/perf.py b/contrib/perf.py
>>> --- a/contrib/perf.py
>>> +++ b/contrib/perf.py
>>> @@ -1,5 +1,7 @@
>>>   # perf.py - performance test routines
>>> -'''helper extension to measure performance'''
>>> +'''helper extension to measure performance
>>> +
>>> +Run the perflist subcommand to list available measurements.'''
>>>
>>>   from mercurial import cmdutil, scmutil, util, commands, obsolete
>>>   from mercurial import repoview, branchmap, merge, copies
>>> @@ -9,6 +11,13 @@ import functools
>>>   cmdtable = {}
>>>   command = cmdutil.command(cmdtable)
>>>
>>> +@command('perflist', norepo=True)
>>> +def perflist(ui):
>>> +    for c in cmdtable:
>>> +        if c == 'perflist':
>>> +            continue
>>> +        ui.write('%s\n' % c)
>>> +
>>>   def gettimer(ui, opts=None):
>>>       """return a timer function and formatter: (timer, formatter)
>>>
>>
>> Doesn't "hg help -e perf" give you this information?
>
>
>
> Good catch!, dropping the patch.
>
> --
> Pierre-Yves David

Patch

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -1,5 +1,7 @@ 
 # perf.py - performance test routines
-'''helper extension to measure performance'''
+'''helper extension to measure performance
+
+Run the perflist subcommand to list available measurements.'''
 
 from mercurial import cmdutil, scmutil, util, commands, obsolete
 from mercurial import repoview, branchmap, merge, copies
@@ -9,6 +11,13 @@  import functools
 cmdtable = {}
 command = cmdutil.command(cmdtable)
 
+@command('perflist', norepo=True)
+def perflist(ui):
+    for c in cmdtable:
+        if c == 'perflist':
+            continue
+        ui.write('%s\n' % c)
+
 def gettimer(ui, opts=None):
     """return a timer function and formatter: (timer, formatter)