libmozdata 0.2.11__tar.gz → 0.2.12__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {libmozdata-0.2.11/libmozdata.egg-info → libmozdata-0.2.12}/PKG-INFO +1 -1
- libmozdata-0.2.12/VERSION +1 -0
- {libmozdata-0.2.11 → libmozdata-0.2.12}/libmozdata/lando.py +60 -0
- {libmozdata-0.2.11 → libmozdata-0.2.12/libmozdata.egg-info}/PKG-INFO +1 -1
- libmozdata-0.2.11/VERSION +0 -1
- {libmozdata-0.2.11 → libmozdata-0.2.12}/MANIFEST.in +0 -0
- {libmozdata-0.2.11 → libmozdata-0.2.12}/README.md +0 -0
- {libmozdata-0.2.11 → libmozdata-0.2.12}/libmozdata/BZInfo.py +0 -0
- {libmozdata-0.2.11 → libmozdata-0.2.12}/libmozdata/FXRevision.py +0 -0
- {libmozdata-0.2.11 → libmozdata-0.2.12}/libmozdata/FileStats.py +0 -0
- {libmozdata-0.2.11 → libmozdata-0.2.12}/libmozdata/HGFileInfo.py +0 -0
- {libmozdata-0.2.11 → libmozdata-0.2.12}/libmozdata/__init__.py +0 -0
- {libmozdata-0.2.11 → libmozdata-0.2.12}/libmozdata/bugzilla.py +0 -0
- {libmozdata-0.2.11 → libmozdata-0.2.12}/libmozdata/buildhub.py +0 -0
- {libmozdata-0.2.11 → libmozdata-0.2.12}/libmozdata/clouseau.py +0 -0
- {libmozdata-0.2.11 → libmozdata-0.2.12}/libmozdata/config.py +0 -0
- {libmozdata-0.2.11 → libmozdata-0.2.12}/libmozdata/connection.py +0 -0
- {libmozdata-0.2.11 → libmozdata-0.2.12}/libmozdata/fx_trains.py +0 -0
- {libmozdata-0.2.11 → libmozdata-0.2.12}/libmozdata/handler.py +0 -0
- {libmozdata-0.2.11 → libmozdata-0.2.12}/libmozdata/hgmozilla.py +0 -0
- {libmozdata-0.2.11 → libmozdata-0.2.12}/libmozdata/modules.json +0 -0
- {libmozdata-0.2.11 → libmozdata-0.2.12}/libmozdata/modules.py +0 -0
- {libmozdata-0.2.11 → libmozdata-0.2.12}/libmozdata/patchanalysis.py +0 -0
- {libmozdata-0.2.11 → libmozdata-0.2.12}/libmozdata/phabricator.py +0 -0
- {libmozdata-0.2.11 → libmozdata-0.2.12}/libmozdata/redash.py +0 -0
- {libmozdata-0.2.11 → libmozdata-0.2.12}/libmozdata/release_owners.py +0 -0
- {libmozdata-0.2.11 → libmozdata-0.2.12}/libmozdata/socorro.py +0 -0
- {libmozdata-0.2.11 → libmozdata-0.2.12}/libmozdata/utils.py +0 -0
- {libmozdata-0.2.11 → libmozdata-0.2.12}/libmozdata/vcs_map.py +0 -0
- {libmozdata-0.2.11 → libmozdata-0.2.12}/libmozdata/versions.py +0 -0
- {libmozdata-0.2.11 → libmozdata-0.2.12}/libmozdata/wiki_parser.py +0 -0
- {libmozdata-0.2.11 → libmozdata-0.2.12}/libmozdata.egg-info/SOURCES.txt +0 -0
- {libmozdata-0.2.11 → libmozdata-0.2.12}/libmozdata.egg-info/dependency_links.txt +0 -0
- {libmozdata-0.2.11 → libmozdata-0.2.12}/libmozdata.egg-info/not-zip-safe +0 -0
- {libmozdata-0.2.11 → libmozdata-0.2.12}/libmozdata.egg-info/requires.txt +0 -0
- {libmozdata-0.2.11 → libmozdata-0.2.12}/libmozdata.egg-info/top_level.txt +0 -0
- {libmozdata-0.2.11 → libmozdata-0.2.12}/requirements.txt +0 -0
- {libmozdata-0.2.11 → libmozdata-0.2.12}/setup.cfg +0 -0
- {libmozdata-0.2.11 → libmozdata-0.2.12}/setup.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.2.12
|
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
4
4
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
5
5
|
|
|
6
|
+
from collections import namedtuple
|
|
7
|
+
from urllib.parse import urljoin
|
|
8
|
+
|
|
6
9
|
import requests
|
|
7
10
|
|
|
8
11
|
from . import config
|
|
@@ -91,3 +94,60 @@ class LandoWarnings(object):
|
|
|
91
94
|
|
|
92
95
|
if len(current_warnings):
|
|
93
96
|
return self.del_warnings(current_warnings)
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
# Represent the commit in both mercurial & git sources, using full hashes
|
|
100
|
+
CommitMap = namedtuple("CommitMap", "git_hash, hg_hash")
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
class LandoMissingCommit(Exception):
|
|
104
|
+
"""
|
|
105
|
+
Raised when a commit is not available on Lando CommitMap API
|
|
106
|
+
"""
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
class LandoCommitMapAPI:
|
|
110
|
+
"""
|
|
111
|
+
Anonymous API calls on Lando API to convert mercurial <=> git commits
|
|
112
|
+
"""
|
|
113
|
+
|
|
114
|
+
def __init__(self, api_url="https://lando.moz.tools/api/"):
|
|
115
|
+
self.api_url = api_url
|
|
116
|
+
assert self.api_url.endswith("/"), "Lando API url must end with a /"
|
|
117
|
+
self.USER_AGENT = config.get("User-Agent", "name", required=True)
|
|
118
|
+
|
|
119
|
+
def request(self, method, repository, revision) -> CommitMap:
|
|
120
|
+
"""
|
|
121
|
+
Call a conversion method on Lando API and return a CommitMap object
|
|
122
|
+
with both full hashes
|
|
123
|
+
"""
|
|
124
|
+
url = urljoin(self.api_url, f"{method}/{repository}/{revision}")
|
|
125
|
+
resp = requests.get(
|
|
126
|
+
url,
|
|
127
|
+
headers={
|
|
128
|
+
"User-Agent": self.USER_AGENT,
|
|
129
|
+
},
|
|
130
|
+
)
|
|
131
|
+
if not resp.ok:
|
|
132
|
+
if resp.status_code == 404:
|
|
133
|
+
raise LandoMissingCommit(
|
|
134
|
+
f"No commit found for {method} {revision}@{repository}"
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
raise Exception(
|
|
138
|
+
f"Failed to resolve {method} {revision}@{repository}: {resp.text}"
|
|
139
|
+
)
|
|
140
|
+
|
|
141
|
+
return CommitMap(**resp.json())
|
|
142
|
+
|
|
143
|
+
def git2hg(self, revision: str, repository="firefox") -> CommitMap:
|
|
144
|
+
"""
|
|
145
|
+
Convert a git hash into a mercurial one
|
|
146
|
+
"""
|
|
147
|
+
return self.request("git2hg", repository, revision)
|
|
148
|
+
|
|
149
|
+
def hg2git(self, revision: str, repository="firefox") -> CommitMap:
|
|
150
|
+
"""
|
|
151
|
+
Convert a mercurial hash into a git one
|
|
152
|
+
"""
|
|
153
|
+
return self.request("hg2git", repository, revision)
|
libmozdata-0.2.11/VERSION
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
0.2.11
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|