libmozdata 0.2.9__tar.gz → 0.2.11__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.
Files changed (39) hide show
  1. {libmozdata-0.2.9/libmozdata.egg-info → libmozdata-0.2.11}/PKG-INFO +1 -1
  2. libmozdata-0.2.11/VERSION +1 -0
  3. {libmozdata-0.2.9 → libmozdata-0.2.11}/libmozdata/config.py +20 -4
  4. {libmozdata-0.2.9 → libmozdata-0.2.11}/libmozdata/lando.py +7 -5
  5. {libmozdata-0.2.9 → libmozdata-0.2.11}/libmozdata/phabricator.py +14 -3
  6. {libmozdata-0.2.9 → libmozdata-0.2.11}/libmozdata/release_owners.py +10 -2
  7. {libmozdata-0.2.9 → libmozdata-0.2.11/libmozdata.egg-info}/PKG-INFO +1 -1
  8. libmozdata-0.2.9/VERSION +0 -1
  9. {libmozdata-0.2.9 → libmozdata-0.2.11}/MANIFEST.in +0 -0
  10. {libmozdata-0.2.9 → libmozdata-0.2.11}/README.md +0 -0
  11. {libmozdata-0.2.9 → libmozdata-0.2.11}/libmozdata/BZInfo.py +0 -0
  12. {libmozdata-0.2.9 → libmozdata-0.2.11}/libmozdata/FXRevision.py +0 -0
  13. {libmozdata-0.2.9 → libmozdata-0.2.11}/libmozdata/FileStats.py +0 -0
  14. {libmozdata-0.2.9 → libmozdata-0.2.11}/libmozdata/HGFileInfo.py +0 -0
  15. {libmozdata-0.2.9 → libmozdata-0.2.11}/libmozdata/__init__.py +0 -0
  16. {libmozdata-0.2.9 → libmozdata-0.2.11}/libmozdata/bugzilla.py +0 -0
  17. {libmozdata-0.2.9 → libmozdata-0.2.11}/libmozdata/buildhub.py +0 -0
  18. {libmozdata-0.2.9 → libmozdata-0.2.11}/libmozdata/clouseau.py +0 -0
  19. {libmozdata-0.2.9 → libmozdata-0.2.11}/libmozdata/connection.py +0 -0
  20. {libmozdata-0.2.9 → libmozdata-0.2.11}/libmozdata/fx_trains.py +0 -0
  21. {libmozdata-0.2.9 → libmozdata-0.2.11}/libmozdata/handler.py +0 -0
  22. {libmozdata-0.2.9 → libmozdata-0.2.11}/libmozdata/hgmozilla.py +0 -0
  23. {libmozdata-0.2.9 → libmozdata-0.2.11}/libmozdata/modules.json +0 -0
  24. {libmozdata-0.2.9 → libmozdata-0.2.11}/libmozdata/modules.py +0 -0
  25. {libmozdata-0.2.9 → libmozdata-0.2.11}/libmozdata/patchanalysis.py +0 -0
  26. {libmozdata-0.2.9 → libmozdata-0.2.11}/libmozdata/redash.py +0 -0
  27. {libmozdata-0.2.9 → libmozdata-0.2.11}/libmozdata/socorro.py +0 -0
  28. {libmozdata-0.2.9 → libmozdata-0.2.11}/libmozdata/utils.py +0 -0
  29. {libmozdata-0.2.9 → libmozdata-0.2.11}/libmozdata/vcs_map.py +0 -0
  30. {libmozdata-0.2.9 → libmozdata-0.2.11}/libmozdata/versions.py +0 -0
  31. {libmozdata-0.2.9 → libmozdata-0.2.11}/libmozdata/wiki_parser.py +0 -0
  32. {libmozdata-0.2.9 → libmozdata-0.2.11}/libmozdata.egg-info/SOURCES.txt +0 -0
  33. {libmozdata-0.2.9 → libmozdata-0.2.11}/libmozdata.egg-info/dependency_links.txt +0 -0
  34. {libmozdata-0.2.9 → libmozdata-0.2.11}/libmozdata.egg-info/not-zip-safe +0 -0
  35. {libmozdata-0.2.9 → libmozdata-0.2.11}/libmozdata.egg-info/requires.txt +0 -0
  36. {libmozdata-0.2.9 → libmozdata-0.2.11}/libmozdata.egg-info/top_level.txt +0 -0
  37. {libmozdata-0.2.9 → libmozdata-0.2.11}/requirements.txt +0 -0
  38. {libmozdata-0.2.9 → libmozdata-0.2.11}/setup.cfg +0 -0
  39. {libmozdata-0.2.9 → libmozdata-0.2.11}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.1
2
2
  Name: libmozdata
3
- Version: 0.2.9
3
+ Version: 0.2.11
4
4
  Summary: Library to access and aggregate several Mozilla data sources.
5
5
  Home-page: https://github.com/mozilla/libmozdata
6
6
  Author: Mozilla Release Management
@@ -0,0 +1 @@
1
+ 0.2.11
@@ -11,12 +11,19 @@ except ImportError:
11
11
 
12
12
 
13
13
  class Config(object):
14
- def get(section, option, default=None):
15
- raise NotImplementedError
14
+ def __init__(self):
15
+ self.local_config = {}
16
+
17
+ def set_default(self, section, option, value):
18
+ self.local_config[(section, option)] = value
19
+
20
+ def get(self, section, option, default=None):
21
+ return self.local_config.get((section, option), default)
16
22
 
17
23
 
18
24
  class ConfigIni(Config):
19
25
  def __init__(self, path=None):
26
+ super().__init__()
20
27
  self.config = ConfigParser()
21
28
  if path is not None:
22
29
  self.config.read(path)
@@ -32,7 +39,9 @@ class ConfigIni(Config):
32
39
 
33
40
  def get(self, section, option, default=None, type=str):
34
41
  if not self.config.has_option(section, option):
35
- return default
42
+ if default is not None:
43
+ return default
44
+ return super().get(section, option)
36
45
 
37
46
  res = self.config.get(section, option)
38
47
  if type == list or type == set:
@@ -48,7 +57,9 @@ class ConfigEnv(Config):
48
57
  def get(self, section, option, default=None, type=str):
49
58
  env = os.environ.get("LIBMOZDATA_CFG_" + section.upper() + "_" + option.upper())
50
59
  if not env:
51
- return default
60
+ if default is not None:
61
+ return default
62
+ return super().get(section, option)
52
63
 
53
64
  if type == list or type == set:
54
65
  return type([s.strip(" /t") for s in env.split(",")])
@@ -72,3 +83,8 @@ def get(section, option, default=None, type=str, required=False):
72
83
  if required:
73
84
  assert value is not None, f"Option {option} in section {section} is not set"
74
85
  return value
86
+
87
+
88
+ def set_default_value(section, option, value):
89
+ global __config
90
+ __config.set_default(section, option, value)
@@ -14,7 +14,7 @@ class LandoWarnings(object):
14
14
  """
15
15
 
16
16
  def __init__(self, api_url, api_key):
17
- self.api_url = f"{api_url}/diff_warnings"
17
+ self.api_url = f"{api_url}/diff_warnings/"
18
18
  self.api_key = api_key
19
19
  self.USER_AGENT = config.get("User-Agent", "name", required=True)
20
20
 
@@ -26,7 +26,7 @@ class LandoWarnings(object):
26
26
  warning_id = warning["id"]
27
27
 
28
28
  response = requests.delete(
29
- f"{self.api_url}/{warning_id}",
29
+ f"{self.api_url}{warning_id}",
30
30
  headers={
31
31
  "X-Phabricator-API-Key": self.api_key,
32
32
  "User-Agent": self.USER_AGENT,
@@ -34,7 +34,9 @@ class LandoWarnings(object):
34
34
  )
35
35
 
36
36
  if response.status_code != 200:
37
- raise Exception(f"Failed to delete warning with ID {warning_id}!")
37
+ raise Exception(
38
+ f"Failed to delete warning with ID {warning_id} with error {response.status_code}:\n{response.text}"
39
+ )
38
40
 
39
41
  def add_warning(self, warning, revision_id, diff_id):
40
42
  """
@@ -55,7 +57,7 @@ class LandoWarnings(object):
55
57
  )
56
58
  if response.status_code != 201:
57
59
  raise Exception(
58
- f"Failed to add warnings for revision_id {revision_id} and diff_id {diff_id}!"
60
+ f"Failed to add warnings for revision_id {revision_id} and diff_id {diff_id} with error {response.status_code}:\n{response.text}"
59
61
  )
60
62
 
61
63
  def get_warnings(self, revision_id, diff_id):
@@ -76,7 +78,7 @@ class LandoWarnings(object):
76
78
  )
77
79
  if response.status_code != 200:
78
80
  raise Exception(
79
- f"Failed to get warnings for revision_id {revision_id} and diff_id {diff_id}!"
81
+ f"Failed to get warnings for revision_id {revision_id} and diff_id {diff_id} with error {response.status_code}:\n{response.text}"
80
82
  )
81
83
 
82
84
  return response.json()
@@ -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("Adding patch #{} to stack".format(diff["id"]))
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
- html = requests.get(
40
+ resp = requests.get(
40
41
  OWNERS_URL,
41
42
  headers={"User-Agent": config.get("User-Agent", "name", required=True)},
42
- ).text.encode("ascii", errors="ignore")
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)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.1
2
2
  Name: libmozdata
3
- Version: 0.2.9
3
+ Version: 0.2.11
4
4
  Summary: Library to access and aggregate several Mozilla data sources.
5
5
  Home-page: https://github.com/mozilla/libmozdata
6
6
  Author: Mozilla Release Management
libmozdata-0.2.9/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.2.9
File without changes
File without changes
File without changes
File without changes
File without changes