libmozdata 0.2.10__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.10/libmozdata.egg-info → libmozdata-0.2.12}/PKG-INFO +1 -1
- libmozdata-0.2.12/VERSION +1 -0
- {libmozdata-0.2.10 → libmozdata-0.2.12}/libmozdata/lando.py +60 -0
- {libmozdata-0.2.10 → libmozdata-0.2.12}/libmozdata/phabricator.py +14 -3
- {libmozdata-0.2.10 → libmozdata-0.2.12}/libmozdata/release_owners.py +10 -2
- {libmozdata-0.2.10 → libmozdata-0.2.12/libmozdata.egg-info}/PKG-INFO +1 -1
- libmozdata-0.2.10/VERSION +0 -1
- {libmozdata-0.2.10 → libmozdata-0.2.12}/MANIFEST.in +0 -0
- {libmozdata-0.2.10 → libmozdata-0.2.12}/README.md +0 -0
- {libmozdata-0.2.10 → libmozdata-0.2.12}/libmozdata/BZInfo.py +0 -0
- {libmozdata-0.2.10 → libmozdata-0.2.12}/libmozdata/FXRevision.py +0 -0
- {libmozdata-0.2.10 → libmozdata-0.2.12}/libmozdata/FileStats.py +0 -0
- {libmozdata-0.2.10 → libmozdata-0.2.12}/libmozdata/HGFileInfo.py +0 -0
- {libmozdata-0.2.10 → libmozdata-0.2.12}/libmozdata/__init__.py +0 -0
- {libmozdata-0.2.10 → libmozdata-0.2.12}/libmozdata/bugzilla.py +0 -0
- {libmozdata-0.2.10 → libmozdata-0.2.12}/libmozdata/buildhub.py +0 -0
- {libmozdata-0.2.10 → libmozdata-0.2.12}/libmozdata/clouseau.py +0 -0
- {libmozdata-0.2.10 → libmozdata-0.2.12}/libmozdata/config.py +0 -0
- {libmozdata-0.2.10 → libmozdata-0.2.12}/libmozdata/connection.py +0 -0
- {libmozdata-0.2.10 → libmozdata-0.2.12}/libmozdata/fx_trains.py +0 -0
- {libmozdata-0.2.10 → libmozdata-0.2.12}/libmozdata/handler.py +0 -0
- {libmozdata-0.2.10 → libmozdata-0.2.12}/libmozdata/hgmozilla.py +0 -0
- {libmozdata-0.2.10 → libmozdata-0.2.12}/libmozdata/modules.json +0 -0
- {libmozdata-0.2.10 → libmozdata-0.2.12}/libmozdata/modules.py +0 -0
- {libmozdata-0.2.10 → libmozdata-0.2.12}/libmozdata/patchanalysis.py +0 -0
- {libmozdata-0.2.10 → libmozdata-0.2.12}/libmozdata/redash.py +0 -0
- {libmozdata-0.2.10 → libmozdata-0.2.12}/libmozdata/socorro.py +0 -0
- {libmozdata-0.2.10 → libmozdata-0.2.12}/libmozdata/utils.py +0 -0
- {libmozdata-0.2.10 → libmozdata-0.2.12}/libmozdata/vcs_map.py +0 -0
- {libmozdata-0.2.10 → libmozdata-0.2.12}/libmozdata/versions.py +0 -0
- {libmozdata-0.2.10 → libmozdata-0.2.12}/libmozdata/wiki_parser.py +0 -0
- {libmozdata-0.2.10 → libmozdata-0.2.12}/libmozdata.egg-info/SOURCES.txt +0 -0
- {libmozdata-0.2.10 → libmozdata-0.2.12}/libmozdata.egg-info/dependency_links.txt +0 -0
- {libmozdata-0.2.10 → libmozdata-0.2.12}/libmozdata.egg-info/not-zip-safe +0 -0
- {libmozdata-0.2.10 → libmozdata-0.2.12}/libmozdata.egg-info/requires.txt +0 -0
- {libmozdata-0.2.10 → libmozdata-0.2.12}/libmozdata.egg-info/top_level.txt +0 -0
- {libmozdata-0.2.10 → libmozdata-0.2.12}/requirements.txt +0 -0
- {libmozdata-0.2.10 → libmozdata-0.2.12}/setup.cfg +0 -0
- {libmozdata-0.2.10 → 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)
|
|
@@ -19,7 +19,7 @@ HGMO_JSON_REV_URL_TEMPLATE = "https://hg.mozilla.org/mozilla-central/json-rev/{}
|
|
|
19
19
|
MOZILLA_PHABRICATOR_PROD = "https://phabricator.services.mozilla.com/api/"
|
|
20
20
|
|
|
21
21
|
PhabricatorPatch = collections.namedtuple(
|
|
22
|
-
"PhabricatorPatch", "id, phid, patch, base_revision, commits"
|
|
22
|
+
"PhabricatorPatch", "id, phid, patch, base_revision, commits, merged"
|
|
23
23
|
)
|
|
24
24
|
|
|
25
25
|
logger = logging.getLogger(__name__)
|
|
@@ -692,14 +692,25 @@ class PhabricatorAPI(object):
|
|
|
692
692
|
assert "id" in diff
|
|
693
693
|
assert "phid" in diff
|
|
694
694
|
assert "baseRevision" in diff
|
|
695
|
+
|
|
696
|
+
# Load diff's revision to get its status
|
|
697
|
+
revision = self.load_revision(rev_phid=diff["revisionPHID"])
|
|
698
|
+
status = revision["fields"]["status"]
|
|
699
|
+
merged = status["closed"] is True and status["value"] == "published"
|
|
700
|
+
|
|
701
|
+
# Load the patch itself (raw format)
|
|
695
702
|
patch = self.load_raw_diff(diff["id"])
|
|
696
703
|
diffs = self.search_diffs(
|
|
697
704
|
diff_phid=diff["phid"], attachments={"commits": True}
|
|
698
705
|
)
|
|
699
706
|
commits = diffs[0]["attachments"]["commits"].get("commits", [])
|
|
700
|
-
logger.info(
|
|
707
|
+
logger.info(
|
|
708
|
+
"Adding patch #{} to stack ({})".format(
|
|
709
|
+
diff["id"], "merged" if merged else "non-merged"
|
|
710
|
+
)
|
|
711
|
+
)
|
|
701
712
|
return PhabricatorPatch(
|
|
702
|
-
diff["id"], diff["phid"], patch, diff["baseRevision"], commits
|
|
713
|
+
diff["id"], diff["phid"], patch, diff["baseRevision"], commits, merged
|
|
703
714
|
)
|
|
704
715
|
|
|
705
716
|
# Load full diff when not provided by user
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
# You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
4
4
|
|
|
5
5
|
import requests
|
|
6
|
+
from requests.exceptions import HTTPError
|
|
6
7
|
|
|
7
8
|
from . import config, utils
|
|
8
9
|
from .wiki_parser import InvalidWiki, WikiParser
|
|
@@ -36,10 +37,17 @@ def get_owners():
|
|
|
36
37
|
if _OWNERS is not None:
|
|
37
38
|
return _OWNERS
|
|
38
39
|
|
|
39
|
-
|
|
40
|
+
resp = requests.get(
|
|
40
41
|
OWNERS_URL,
|
|
41
42
|
headers={"User-Agent": config.get("User-Agent", "name", required=True)},
|
|
42
|
-
)
|
|
43
|
+
)
|
|
44
|
+
try:
|
|
45
|
+
resp.raise_for_status()
|
|
46
|
+
except HTTPError as e:
|
|
47
|
+
raise InvalidWiki("Failed to load wiki data") from e
|
|
48
|
+
|
|
49
|
+
html = resp.text.encode("ascii", errors="ignore")
|
|
50
|
+
|
|
43
51
|
parser = WikiParser(tables=[0])
|
|
44
52
|
try:
|
|
45
53
|
parser.feed(html)
|
libmozdata-0.2.10/VERSION
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
0.2.10
|
|
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
|