Patchwork D1985: wireprotoserver: remove support for do_<command> handlers (API)

login
register
mail settings
Submitter phabricator
Date Feb. 1, 2018, 11:12 p.m.
Message ID <differential-rev-PHID-DREV-xqpeseucpnsdvibgbyrv-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/27176/
State Superseded
Headers show

Comments

phabricator - Feb. 1, 2018, 11:12 p.m.
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Old versions of wire protocol handlers relied on methods
  named do_<command> to handle wire protocol commands. The last
  definition of these methods on sshserver was removed by
  https://phab.mercurial-scm.org/rHG9f6e0e7ef82884e3ec66455dac7312820c2b35ce ~2 years ago. I think it's time to not support this
  mechanism for defining command handlers.
  
  .. api::
  
    sshserver now longers looks for wire protocol command handlers
    in methods named do_<command>. Use @wireproto.wireprotocommand
    to declare wire protocol command handler functions.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D1985

AFFECTED FILES
  mercurial/wireprotoserver.py

CHANGE DETAILS




To: indygreg, #hg-reviewers
Cc: mercurial-devel
phabricator - Feb. 1, 2018, 11:22 p.m.
durin42 accepted this revision.
durin42 added a comment.
This revision is now accepted and ready to land.


  Fixing a typo (now instead of no) in log message in flight.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D1985

To: indygreg, #hg-reviewers, durin42
Cc: durin42, mercurial-devel

Patch

diff --git a/mercurial/wireprotoserver.py b/mercurial/wireprotoserver.py
--- a/mercurial/wireprotoserver.py
+++ b/mercurial/wireprotoserver.py
@@ -344,13 +344,7 @@ 
             rsp = wireproto.dispatch(self.repo, self, cmd)
             self.handlers[rsp.__class__](self, rsp)
         elif cmd:
-            impl = getattr(self, 'do_' + cmd, None)
-            if impl:
-                r = impl()
-                if r is not None:
-                    self.sendresponse(r)
-            else:
-                self.sendresponse("")
+            self.sendresponse("")
         return cmd != ''
 
     def _client(self):