D2723: httppeer: remove _requestbuilder attribute

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

D2723: httppeer: remove _requestbuilder attribute

indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This was a glorified alias to a function in another module. I have no
  clue why it existed.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/httppeer.py

CHANGE DETAILS

diff --git a/mercurial/httppeer.py b/mercurial/httppeer.py
--- a/mercurial/httppeer.py
+++ b/mercurial/httppeer.py
@@ -138,7 +138,6 @@
         self._path = path
         self._caps = None
         self._urlopener = None
-        self._requestbuilder = None
         u = util.url(path)
         if u.query or u.fragment:
             raise error.Abort(_('unsupported URL component: "%s"') %
@@ -151,7 +150,6 @@
         ui.debug('using %s\n' % self._url)
 
         self._urlopener = url.opener(ui, authinfo)
-        self._requestbuilder = urlreq.request
 
     def __del__(self):
         urlopener = getattr(self, '_urlopener', None)
@@ -328,7 +326,7 @@
         if varyheaders:
             headers[r'Vary'] = r','.join(varyheaders)
 
-        req = self._requestbuilder(pycompat.strurl(cu), data, headers)
+        req = urlreq.request(pycompat.strurl(cu), data, headers)
 
         if data is not None:
             self.ui.debug("sending %d bytes\n" % size)



To: indygreg, #hg-reviewers
Cc: mercurial-devel
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

D2723: httppeer: remove _requestbuilder attribute

indygreg (Gregory Szorc)
indygreg updated this revision to Diff 6973.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2723?vs=6718&id=6973

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

AFFECTED FILES
  mercurial/httppeer.py

CHANGE DETAILS

diff --git a/mercurial/httppeer.py b/mercurial/httppeer.py
--- a/mercurial/httppeer.py
+++ b/mercurial/httppeer.py
@@ -138,7 +138,6 @@
         self._path = path
         self._caps = None
         self._urlopener = None
-        self._requestbuilder = None
         u = util.url(path)
         if u.query or u.fragment:
             raise error.Abort(_('unsupported URL component: "%s"') %
@@ -151,7 +150,6 @@
         ui.debug('using %s\n' % self._url)
 
         self._urlopener = url.opener(ui, authinfo)
-        self._requestbuilder = urlreq.request
 
     def __del__(self):
         urlopener = getattr(self, '_urlopener', None)
@@ -328,7 +326,7 @@
         if varyheaders:
             headers[r'Vary'] = r','.join(varyheaders)
 
-        req = self._requestbuilder(pycompat.strurl(cu), data, headers)
+        req = urlreq.request(pycompat.strurl(cu), data, headers)
 
         if data is not None:
             self.ui.debug("sending %d bytes\n" % size)



To: indygreg, #hg-reviewers
Cc: mercurial-devel
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

D2723: httppeer: remove _requestbuilder attribute

indygreg (Gregory Szorc)
In reply to this post by indygreg (Gregory Szorc)
pulkit added a comment.


  Looks like this was added so that extensions can replace using urllib2.Request. https://www.mercurial-scm.org/repo/hg/rev/00ecc894138d

REPOSITORY
  rHG Mercurial

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

To: indygreg, #hg-reviewers
Cc: pulkit, mercurial-devel
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

D2723: httppeer: remove _requestbuilder attribute

indygreg (Gregory Szorc)
In reply to this post by indygreg (Gregory Szorc)
martinvonz added a comment.


  In https://phab.mercurial-scm.org/D2723#46187, @pulkit wrote:
 
  > Looks like this was added so that extensions can replace using urllib2.Request. https://www.mercurial-scm.org/repo/hg/rev/00ecc894138d
 
 
  Thanks for looking that up. We still depend on it, so we'd appreciate if it could stay. Perhaps we should have added comment saying that it was there for extensibility.

REPOSITORY
  rHG Mercurial

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

To: indygreg, #hg-reviewers
Cc: martinvonz, pulkit, mercurial-devel
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

D2723: httppeer: consolidate _requestbuilder assignments and document

indygreg (Gregory Szorc)
In reply to this post by indygreg (Gregory Szorc)
indygreg updated this revision to Diff 7070.
indygreg edited the summary of this revision.
indygreg retitled this revision from "httppeer: remove _requestbuilder attribute" to "httppeer: consolidate _requestbuilder assignments and document".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2723?vs=6973&id=7070

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

AFFECTED FILES
  mercurial/httppeer.py

CHANGE DETAILS

diff --git a/mercurial/httppeer.py b/mercurial/httppeer.py
--- a/mercurial/httppeer.py
+++ b/mercurial/httppeer.py
@@ -138,7 +138,9 @@
         self._path = path
         self._caps = None
         self._urlopener = None
-        self._requestbuilder = None
+        # This is an its own attribute to facilitate extensions overriding
+        # the default type.
+        self._requestbuilder = urlreq.request
         u = util.url(path)
         if u.query or u.fragment:
             raise error.Abort(_('unsupported URL component: "%s"') %
@@ -151,7 +153,6 @@
         ui.debug('using %s\n' % self._url)
 
         self._urlopener = urlmod.opener(ui, authinfo)
-        self._requestbuilder = urlreq.request
 
     def __del__(self):
         urlopener = getattr(self, '_urlopener', None)



To: indygreg, #hg-reviewers
Cc: martinvonz, pulkit, mercurial-devel
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

D2723: httppeer: consolidate _requestbuilder assignments and document

indygreg (Gregory Szorc)
In reply to this post by indygreg (Gregory Szorc)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG2d5d3033ff4e: httppeer: consolidate _requestbuilder assignments and document (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2723?vs=7070&id=7072

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

AFFECTED FILES
  mercurial/httppeer.py

CHANGE DETAILS

diff --git a/mercurial/httppeer.py b/mercurial/httppeer.py
--- a/mercurial/httppeer.py
+++ b/mercurial/httppeer.py
@@ -138,7 +138,9 @@
         self._path = path
         self._caps = None
         self._urlopener = None
-        self._requestbuilder = None
+        # This is an its own attribute to facilitate extensions overriding
+        # the default type.
+        self._requestbuilder = urlreq.request
         u = util.url(path)
         if u.query or u.fragment:
             raise error.Abort(_('unsupported URL component: "%s"') %
@@ -151,7 +153,6 @@
         ui.debug('using %s\n' % self._url)
 
         self._urlopener = urlmod.opener(ui, authinfo)
-        self._requestbuilder = urlreq.request
 
     def __del__(self):
         urlopener = getattr(self, '_urlopener', None)



To: indygreg, #hg-reviewers, pulkit
Cc: martinvonz, pulkit, mercurial-devel
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel