Skip to content

Commit

Permalink
Merge pull request gperciva#15 from jrioux/rietveld
Browse files Browse the repository at this point in the history
Handle https links.
  • Loading branch information
jrioux committed Sep 7, 2013
2 parents 2e7016d + 00773ae commit eda29ad
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions patches/projecthosting_patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@
if not os.path.exists (patches_dirname):
os.makedirs (patches_dirname)

RIETVELD_URL = "http://codereview.appspot.com/"

class CodeReviewIssue (object):
def __init__ (self, url, tracker_id, title=""):
self.url = url
for url_base in self.url_bases:
if url.startswith (url_base):
self.url_base = url_base
break
self.tracker_id = tracker_id
self.title = title.encode ("ascii", "ignore")
self.id = url.replace (self.url_base, "").strip ("/")
Expand All @@ -62,7 +64,9 @@ def unapply_patch_commands (self):
raise NotImplementedError

class RietveldIssue (CodeReviewIssue):
url_base = RIETVELD_URL
# Valid Rietveld urls
url_bases = ("http://codereview.appspot.com/",
"https://codereview.appspot.com/")
patch_method = "file"
def get_patch (self):
api_url = os.path.join (self.url_base, "api", self.id)
Expand Down Expand Up @@ -100,11 +104,12 @@ def get_patch (self):
self.patch_id = self.format_id (patch_filename)
return patch_filename_full

codereview_url_map = dict ((T.url_base, T)
for T in (RietveldIssue,
))
codereview_url_map = dict ()
for T in (RietveldIssue,):
codereview_url_map.update (dict ((url_base, T)
for url_base in T.url_bases))
codereview_url_re = re.compile (
"((?:" + "|".join (codereview_url_map.keys ()) + r').*?)(?:>|\s|"|$)')
"((?:" + "|".join (codereview_url_map.keys ()) + r').*?)(?:<|>|\s|"|$)')

class replacementClient (gdata.projecthosting.client.ProjectHostingClient):
"A replacement client that fetches data using csv queries."
Expand Down

0 comments on commit eda29ad

Please sign in to comment.