Patchwork version: extension info in verbose mode (issue4209) (issue 105040046 by techtonik@gmail.com)

login
register
mail settings
Submitter anatoly techtonik
Date June 11, 2014, 10:16 p.m.
Message ID <90e6ba1efca07cc5da04fb96cbda@google.com>
Download mbox | patch
Permalink /patch/4978/
State Deferred
Headers show

Comments

anatoly techtonik - June 11, 2014, 10:16 p.m.
Reviewers: gward, Augie fackler,

Message:
Please take a look.

Description:
Complete fix for issue 4209:
http://bz.selenic.com/show_bug.cgi?id=4209

Modified code from
http://mercurial.selenic.com/wiki/VersionsExtension
by Markus Zapke-GrĂ¼ndeman.

Please review this at https://codereview.appspot.com/105040046/

Affected files (+29, -0 lines):
   M mercurial/commands.py
   M mercurial/extensions.py
anatoly techtonik - June 11, 2014, 10:20 p.m.
The previous email was from Rietveld just to show an example of alternative
review process. I've uploaded all change history incrementally.
Matt Mackall - June 12, 2014, 6:08 p.m.
On Thu, 2014-06-12 at 01:20 +0300, anatoly techtonik wrote:
> The previous email was from Rietveld just to show an example of alternative
> review process. I've uploaded all change history incrementally.

We're aware that such tools exists, and it's not an accident that we're
not using them after 9 years. But I've gone ahead and looked at Rietveld
again and it's served to reaffirm my position.

If I need to leave my mail client to review or apply your patch, it's a
complete absolute 100% non-starter. Things that make my workflow slower
are simply not viable.

Secondly, if reviews of your patch don't show up in the inboxes of _all
other reviewers and contributors_ such that everyone can at least
potentially read them and avoid making the same mistakes, then I'm going
to end up repeating myself a lot more. I hate repeating myself; I hate
web review tools.

There's a lot of other stuff that I find awful about Rietveld, but the
big one is "it's not email". Until a "web" review tool shows up that is
indistinguishable from the current workflow on my end, I'm just not
interested.
anatoly techtonik - June 13, 2014, 8:36 a.m.
On Thu, Jun 12, 2014 at 9:08 PM, Matt Mackall <mpm@selenic.com> wrote:

>
>  If I need to leave my mail client to review or apply your patch, it's a
> complete absolute 100% non-starter. Things that make my workflow slower
> are simply not viable.
>

Interesting point. Making email interface for such thinkgs leads to debian
style
tracker. Some people enjoy it, and others (like me) hate. Never thought
about
joining the two appropriately.

For me the only reason to use that is properly organized and referable
review
history - for Chromium it is embedded in each commit.

Secondly, if reviews of your patch don't show up in the inboxes of _all
> other reviewers and contributors_ such that everyone can at least
> potentially read them and avoid making the same mistakes, then I'm going
> to end up repeating myself a lot more. I hate repeating myself; I hate
> web review tools.
>

Port public IRC bot to email, so that it can repeat things for you and
maintain
monthly FAQ with stats on most repeated issues.


> There's a lot of other stuff that I find awful about Rietveld, but the
> big one is "it's not email". Until a "web" review tool shows up that is
> indistinguishable from the current workflow on my end, I'm just not
> interested.
>

Got it. Thanks for the feedback.

Patch

Index: mercurial/commands.py
===================================================================
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -14,6 +14,7 @@ 
  import patch, help, encoding, templatekw, discovery
  import archival, changegroup, cmdutil, hbisect
  import sshserver, hgweb, commandserver
+from extensions import extensions, moduleversion
  from hgweb import server as hgweb_server
  import merge as mergemod
  import minirst, revset, fileset
@@ -5921,6 +5922,21 @@ 
          "not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR  
PURPOSE.\n"
      ))

+    # This code is inspired by hg-versions extension (GPLv2)
+    # by Markus Zapke-Gruendemann <info@keimlink.de>
+    ui.note(_("\nEnabled extensions:\n\n"))
+    if ui.verbose:
+        # format names and versions into columns
+        names = []
+        vers = []
+        for name, module in extensions():
+            names.append(name)
+            vers.append(moduleversion(module))
+        maxnamelen = max(len(n) for n in names)
+        for i,n in enumerate(names):
+            ui.write("  %s  %s\n" % (n.ljust(maxnamelen), vers[i]))
+
+
  norepo = ("clone init version help debugcommands debugcomplete"
            " debugdate debuginstall debugfsinfo debugpushkey debugwireargs"
            " debugknown debuggetbundle debugbundle")
Index: mercurial/extensions.py
===================================================================
--- a/mercurial/extensions.py
+++ b/mercurial/extensions.py
@@ -367,3 +367,16 @@ 
          exts[ename] = doc.splitlines()[0].strip()

      return exts
+
+def moduleversion(module):
+    '''return version information from given module as a string'''
+    if (util.safehasattr(module, 'get_version')
+          and callable(module.get_version)):
+        version = module.get_version()
+    elif util.safehasattr(module, '__version__'):
+        version = module.__version__
+    else:
+        version = ''
+    if isinstance(version, (list, tuple)):
+        version = '.'.join(str(o) for o in version)
+    return version