-
Notifications
You must be signed in to change notification settings - Fork 3
Support for larger phabricator instances where more than 100 projects exist #110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
D0wn10ad
wants to merge
9
commits into
dynamist:master
Choose a base branch
from
D0wn10ad:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 7 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
9520289
Update README.md
D0wn10ad 282e05d
Update maniphest.py
D0wn10ad 1da8040
Merge pull request #2 from D0wn10ad/bug/more_than_100_projects
D0wn10ad 04401a1
Update maniphest.py
D0wn10ad cf64034
Update maniphest.py
D0wn10ad 9d262cf
Update maniphest.py
D0wn10ad 9b89682
Merge pull request #3 from D0wn10ad/bug/more_than_100_users_projects
D0wn10ad be7f48a
Merge branch 'master' into master
D0wn10ad 260dcc3
Remove outdated comments on user and project fetching
D0wn10ad File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -131,7 +131,15 @@ def create_from_config(self, config_file, dry_run=False): | |
| root_data = yaml.load(stream, Loader=yaml.Loader) # nosec-B506 | ||
|
|
||
| # Fetch all users in phabricator, used by subscribers mapping later | ||
| users_query = self.phab.user.search() | ||
| # Extended support for phabricator instances with more than 100 (i.e. deftault query limit) users | ||
| # BUT with limieted exception handling e.g. retries needed when phabricator instance is not responding to API calls | ||
| users_query = raw_data = self.phab.user.search() | ||
|
|
||
| while (len(raw_data.data) >= 100 and not raw_data.cursor["after"] is None): | ||
| raw_data = self.phab.user.search(after=raw_data.cursor["after"]) | ||
| users_query.data.extend(raw_data.data) | ||
| log.debug(users_query) | ||
|
|
||
| username_to_id_mapping = { | ||
| user["fields"]["username"]: user["phid"] | ||
| for user in users_query["data"] | ||
|
|
@@ -140,7 +148,15 @@ def create_from_config(self, config_file, dry_run=False): | |
| log.debug(username_to_id_mapping) | ||
|
|
||
| # Fetch all projects in phabricator, used to map ticket -> projects later | ||
| projects_query = self.phab.project.search(constraints={"name": ""}) | ||
| # Extended support for phabricator instances with more than 100 (i.e. deftault query limit) projects | ||
| # BUT with limieted exception handling, e.g. retries needed when phabricator instance is not responding to API calls | ||
|
||
| projects_query = raw_data = self.phab.project.search(constraints={"name": ""}) | ||
|
|
||
| while (len(raw_data.data) >= 100 and not raw_data.cursor["after"] is None): | ||
| raw_data = self.phab.project.search(constraints={"name": ""},after=raw_data.cursor["after"]) | ||
| projects_query.data.extend(raw_data.data) | ||
| log.debug(projects_query) | ||
|
|
||
| project_name_to_id_map = { | ||
| project["fields"]["name"]: project["phid"] | ||
| for project in projects_query["data"] | ||
|
|
@@ -383,4 +399,4 @@ def format_timestamp(timestamp): | |
| Convert UNIX timestamp to ISO 8601 string (readable time format). | ||
| """ | ||
| dt = datetime.datetime.fromtimestamp(timestamp) | ||
| return dt.strftime('%Y-%m-%dT%H:%M:%S') | ||
| return dt.strftime('%Y-%m-%dT%H:%M:%S') | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These comments could be removed. They only serve a purpose for the reviewer of this PR