Patchwork [1,of,4,v2] debuginstall: add mercurial version

login
register
mail settings
Submitter timeless
Date May 11, 2016, 5:51 p.m.
Message ID <2ab114fef14fd6d1ef10.1462989084@gcc2-power8.osuosl.org>
Download mbox | patch
Permalink /patch/15027/
State Accepted
Commit c5f9ff302065f1116d42c23a3187e5e6874d9e22
Delegated to: Yuya Nishihara
Headers show

Comments

timeless - May 11, 2016, 5:51 p.m.
# HG changeset patch
# User timeless <timeless@mozdev.org>
# Date 1462920345 0
#      Tue May 10 22:45:45 2016 +0000
# Node ID 2ab114fef14fd6d1ef109043e9300b015b0c0e2f
# Parent  c641b8dfb98c2ade6995ba3aa341fe4d7b154827
# Available At bb://timeless/mercurial-crew
#              hg pull bb://timeless/mercurial-crew -r 2ab114fef14f
debuginstall: add mercurial version
Yuya Nishihara - May 20, 2016, 1:59 p.m.
On Wed, 11 May 2016 17:51:24 +0000, timeless wrote:
> # HG changeset patch
> # User timeless <timeless@mozdev.org>
> # Date 1462920345 0
> #      Tue May 10 22:45:45 2016 +0000
> # Node ID 2ab114fef14fd6d1ef109043e9300b015b0c0e2f
> # Parent  c641b8dfb98c2ade6995ba3aa341fe4d7b154827
> # Available At bb://timeless/mercurial-crew
> #              hg pull bb://timeless/mercurial-crew -r 2ab114fef14f
> debuginstall: add mercurial version

Just curious. What's the advantage over "hg version" ?


> diff -r c641b8dfb98c -r 2ab114fef14f mercurial/commands.py
> --- a/mercurial/commands.py	Wed May 11 01:46:11 2016 +0000
> +++ b/mercurial/commands.py	Tue May 10 22:45:45 2016 +0000
> @@ -2740,6 +2740,13 @@
>      fm.write('pythonlib', _("checking Python lib (%s)...\n"),
>               os.path.dirname(os.__file__))
>  
> +    # hg version
> +    hgver = util.version()
> +    fm.write('hgver', _("checking Mercurial version (%s)\n"),
> +             hgver.split('+')[0])
> +    fm.write('hgverextra', _("checking Mercurial custom build (%s)\n"),
> +             '+'.join(hgver.split('+')[1:]))

I don't think it's worth printing two separate lines for hg version. You can
strip extra part from "hgver" as necessary.

  {sub(r"\+.*", "", hgver)}
timeless - May 26, 2016, 2:27 a.m.
Yuya Nishihara wrote:
> Just curious. What's the advantage over "hg version" ?

Parsing hg version is annoying.
Yuya Nishihara - May 26, 2016, 12:27 p.m.
On Wed, 25 May 2016 22:27:47 -0400, timeless wrote:
> Yuya Nishihara wrote:
> > Just curious. What's the advantage over "hg version" ?  
> 
> Parsing hg version is annoying.

We can add version -T.
timeless - May 26, 2016, 1:37 p.m.
On Thu, May 26, 2016 at 8:27 AM, Yuya Nishihara <yuya@tcha.org> wrote:
> On Wed, 25 May 2016 22:27:47 -0400, timeless wrote:
>> Yuya Nishihara wrote:
>> > Just curious. What's the advantage over "hg version" ?
>>
>> Parsing hg version is annoying.
>
> We can add version -T.

Probably a good idea.

But the reason I want debuginstall, is that when you're asking for
debug information, you want all of this information (everything from
debuginstall), including the hg version. In fact, the first question
we need to ask is "what version are you running?"

Note: the next thing I'd probably like to add to debuginstall is the
list of enabled extensions. I haven't figured out which way I want
them.

One approach is:
{ "extensions":
  [
    "rebase"
  ]
}
Another is:
{ "extensions":
 {
  "rebase": "",
  "topics": "~/hg/topic/hgext3rd/topic/"
 }
}
But I think I'm going to lean toward:
{ "extensions":
 [
  {
   "name":"rebase",
   "version":"internal",
   "path":""
  },
  {
   "name":"topics",
   "version":"",
   "path":"~/hg/topic/hgext3rd/topic/"
  },
  {
   "name":"evolve",
   "version":"5.4.0",
   "path":"~/hg/evolve-main/hgext/evolve.py"
  }
 ]
}

We could require people to run:
hg version; hg debuginstall; hg extensions (*)
And thus:
hg version -T...; hg debuginstall -T...; hg extensions -T...
or, we could just allow:
hg debuginstall / hg debuginstall -T...

I'd rather debuginstall cover the bases. For extensions, it could
report about extensions that aren't supported (testedwith < version).
Yuya Nishihara - May 27, 2016, 3:03 p.m.
On Thu, 26 May 2016 09:37:39 -0400, timeless wrote:
> On Thu, May 26, 2016 at 8:27 AM, Yuya Nishihara <yuya@tcha.org> wrote:
> > On Wed, 25 May 2016 22:27:47 -0400, timeless wrote:  
> >> Yuya Nishihara wrote:  
> >> > Just curious. What's the advantage over "hg version" ?  
> >>
> >> Parsing hg version is annoying.  
> >
> > We can add version -T.  
> 
> Probably a good idea.
> 
> But the reason I want debuginstall, is that when you're asking for
> debug information, you want all of this information (everything from
> debuginstall), including the hg version. In fact, the first question
> we need to ask is "what version are you running?"

Yeah, that would make some sense. Thanks for the detail.

> Note: the next thing I'd probably like to add to debuginstall is the
> list of enabled extensions. I haven't figured out which way I want
> them.

There's "hg debugextensions".

> We could require people to run:
> hg version; hg debuginstall; hg extensions (*)
> And thus:
> hg version -T...; hg debuginstall -T...; hg extensions -T...
> or, we could just allow:
> hg debuginstall / hg debuginstall -T...
> 
> I'd rather debuginstall cover the bases. For extensions, it could
> report about extensions that aren't supported (testedwith < version).

or we could provide a hint for "hg debugextensions" instead of implementing
a monolithic command.
timeless - May 27, 2016, 3:52 p.m.
Yuya Nishihara wrote:
> or we could provide a hint for "hg debugextensions" instead of implementing
> a monolithic command.

Sounds good.

Patch

diff -r c641b8dfb98c -r 2ab114fef14f mercurial/commands.py
--- a/mercurial/commands.py	Wed May 11 01:46:11 2016 +0000
+++ b/mercurial/commands.py	Tue May 10 22:45:45 2016 +0000
@@ -2740,6 +2740,13 @@ 
     fm.write('pythonlib', _("checking Python lib (%s)...\n"),
              os.path.dirname(os.__file__))
 
+    # hg version
+    hgver = util.version()
+    fm.write('hgver', _("checking Mercurial version (%s)\n"),
+             hgver.split('+')[0])
+    fm.write('hgverextra', _("checking Mercurial custom build (%s)\n"),
+             '+'.join(hgver.split('+')[1:]))
+
     # compiled modules
     fm.write('hgmodules', _("checking installed modules (%s)...\n"),
              os.path.dirname(__file__))
diff -r c641b8dfb98c -r 2ab114fef14f tests/test-install.t
--- a/tests/test-install.t	Wed May 11 01:46:11 2016 +0000
+++ b/tests/test-install.t	Tue May 10 22:45:45 2016 +0000
@@ -4,6 +4,8 @@ 
   checking Python executable (*) (glob)
   checking Python version (2.*) (glob)
   checking Python lib (*lib*)... (glob)
+  checking Mercurial version (*) (glob)
+  checking Mercurial custom build (*) (glob)
   checking installed modules (*mercurial)... (glob)
   checking templates (*mercurial?templates)... (glob)
   checking default template (*mercurial?templates?map-cmdline.default) (glob)
@@ -24,6 +26,8 @@ 
     "encodingerror": null,
     "extensionserror": null,
     "hgmodules": "*mercurial", (glob)
+    "hgver": "*", (glob)
+    "hgverextra": "*", (glob)
     "problems": 0,
     "pythonexe": "*", (glob)
     "pythonlib": "*", (glob)
@@ -41,6 +45,8 @@ 
   checking Python executable (*) (glob)
   checking Python version (2.*) (glob)
   checking Python lib (*lib*)... (glob)
+  checking Mercurial version (*) (glob)
+  checking Mercurial custom build (*) (glob)
   checking installed modules (*mercurial)... (glob)
   checking templates (*mercurial?templates)... (glob)
   checking default template (*mercurial?templates?map-cmdline.default) (glob)
@@ -62,6 +68,8 @@ 
   checking Python executable (*) (glob)
   checking Python version (*) (glob)
   checking Python lib (*lib*)... (glob)
+  checking Mercurial version (*) (glob)
+  checking Mercurial custom build (*) (glob)
   checking installed modules (*mercurial)... (glob)
   checking templates (*mercurial?templates)... (glob)
   checking default template (*mercurial?templates?map-cmdline.default) (glob)