1. mdelagra
  2. mercurial-reviewboard

Commits

mdelagra  committed 772584c Merge

merging in changes from the parent project, removed longdiff option (which is redundant with the existing outgoingchanges option)

  • Participants
  • Parent commits 2d3386d, 3b8ca6c
  • Branches default
  • Tags rel_3_2_0

Comments (0)

Files changed (5)

File CHANGELOG

View file
+Version 3.2.0 (1/26/10)
+
+    * merged in latest changes from parent project
+
+    changes included below
+
+    * disable the proxy auto detection
+
+    urlib2 does not seem to obey/follow the proxy exclusions
+
+    * added a 'repo_id' config variable 
+
+    Configure a reviewboard repo_id in the project .hg/hgrc file
+
 Version 3.1.0 (12/9/09)
 
     * added config option to automatically open reviews in a web browser

File README

View file
 server          = http://reviewboard.example.com/
 
 # OPTIONAL ITEMS:
-# user              = ...  # username for login
-# target_groups     = ...  # default review groups
-# target_people     = ...  # default review people
+# user            = ... # username for login
+# password        = ...
+# target_groups   = ... # default review groups
+# target_people   = ... # default review people
 # launch_webbrowser = true # open review in a browser
+
+# For a specific proxy specify:
+# http_proxy = http://192.168.1.1:3128
+# For no proxy use
+# http_proxy = none
+# otherwise your proxy will be autodetected from the 'http_proxy' env var(unix)
+# or the registry(windows)
+
 --- ~/.hgrc ---
 
+Configure the Review Board reposity id for this Hg repo per in your per project
+mercurial prefs(.hg/hgrc).
+
+--- .hg/hgrc ---
+[reviewboard]
+repoid = n
+--- .hg/hgrc ---
 
 USAGE:
 

File __init__.py

File contents unchanged.

File mercurial_reviewboard/__init__.py

View file
     return output
 
 def getreviewboard(ui, opts):
+    
+    '''We are going to fetch the setting string from hg prefs, there we can set
+    our own proxy, or specify 'none' to pass an empty dictionary to urllib2
+    which overides the default autodetection when we want to force no proxy'''
+    http_proxy = ui.config('reviewboard', 'http_proxy' )
+    if http_proxy:
+        if http_proxy == 'none':
+            proxy = {}
+        else:
+            proxy = { 'http':http_proxy }
+    else:
+        proxy=None
+    
     server = ui.config('reviewboard', 'server')
     
-    reviewboard = ReviewBoard(server)
+    reviewboard = ReviewBoard(server, proxy)
     ui.status('reviewboard:\t%s\n' % server)
     ui.status('\n')
     username = opts.get('username') or ui.config('reviewboard', 'user')
 def find_reviewboard_repo_id(ui, reviewboard, opts):
     if opts.get('repoid'):
         return int(opts.get('repoid'))
+    elif ui.config('reviewboard','repoid'):
+        return int(ui.config('reviewboard','repoid'))
     
     try:
         repositories = reviewboard.repositories()

File mercurial_reviewboard/reviewboard.py

View file
 
 
 class ReviewBoard:
-    def __init__(self, url):
+    def __init__(self, url, proxy=None):
         if not url.endswith('/'):
             url = url + '/'
         self.url       = url
         self._cj = cookielib.MozillaCookieJar(self.cookie_file)
         password_mgr = ReviewBoardHTTPPasswordMgr(self.url)
         self._opener = opener = urllib2.build_opener(
-                        urllib2.ProxyHandler(),
+                        urllib2.ProxyHandler(proxy),
                         urllib2.UnknownHandler(),
                         urllib2.HTTPHandler(),
                         urllib2.HTTPDefaultErrorHandler(),