D2379: sshpeer: move logic for sending a request into a new function
This revision was automatically updated to reflect the committed changes. Closed by commit rHGa34d5ef53c2e: sshpeer: move logic for sending a request into a new function (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2379?vs=5965=5997 REVISION DETAIL https://phab.mercurial-scm.org/D2379 AFFECTED FILES mercurial/sshpeer.py CHANGE DETAILS diff --git a/mercurial/sshpeer.py b/mercurial/sshpeer.py --- a/mercurial/sshpeer.py +++ b/mercurial/sshpeer.py @@ -410,8 +410,7 @@ work += chunk yield wireproto.unescapearg(work) -def _callstream(self, cmd, **args): -args = pycompat.byteskwargs(args) +def _sendrequest(self, cmd, args): if (self.ui.debugflag and self.ui.configbool('devel', 'debug.peer-request')): dbg = self.ui.debug @@ -447,11 +446,17 @@ return self._pipei +def _callstream(self, cmd, **args): +args = pycompat.byteskwargs(args) +return self._sendrequest(cmd, args) + def _callcompressable(self, cmd, **args): -return self._callstream(cmd, **args) +args = pycompat.byteskwargs(args) +return self._sendrequest(cmd, args) def _call(self, cmd, **args): -self._callstream(cmd, **args) +args = pycompat.byteskwargs(args) +self._sendrequest(cmd, args) return self._readframed() def _callpush(self, cmd, fp, **args): To: indygreg, #hg-reviewers, yuja Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2379: sshpeer: move logic for sending a request into a new function
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY The **args being used to pass arbitrary command arguments is limiting because it makes it harder to control behavior of the function. We factor most of _callstream() into a new function that doesn't use **args. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2379 AFFECTED FILES mercurial/sshpeer.py CHANGE DETAILS diff --git a/mercurial/sshpeer.py b/mercurial/sshpeer.py --- a/mercurial/sshpeer.py +++ b/mercurial/sshpeer.py @@ -410,8 +410,7 @@ work += chunk yield wireproto.unescapearg(work) -def _callstream(self, cmd, **args): -args = pycompat.byteskwargs(args) +def _sendrequest(self, cmd, args): if (self.ui.debugflag and self.ui.configbool('devel', 'debug.peer-request')): dbg = self.ui.debug @@ -447,11 +446,17 @@ return self._pipei +def _callstream(self, cmd, **args): +args = pycompat.byteskwargs(args) +return self._sendrequest(cmd, args) + def _callcompressable(self, cmd, **args): -return self._callstream(cmd, **args) +args = pycompat.byteskwargs(args) +return self._sendrequest(cmd, args) def _call(self, cmd, **args): -self._callstream(cmd, **args) +args = pycompat.byteskwargs(args) +self._sendrequest(cmd, args) return self._readframed() def _callpush(self, cmd, fp, **args): To: indygreg, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel