-
Couldn't load subscription status.
- Fork 56
Fix pkgs remote #266
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
Fix pkgs remote #266
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -38,7 +38,40 @@ | |||||
| import pkgsdb | ||||||
| from package import PackageOperation, Bridge_SConscript | ||||||
| from vars import Import, Export | ||||||
| from .cmd_package_utils import get_url_from_mirror_server, execute_command, git_pull_repo, user_input, find_bool_macro_in_config | ||||||
| from .cmd_package_utils import ( | ||||||
| get_url_from_mirror_server, | ||||||
| execute_command, | ||||||
| git_pull_repo, | ||||||
| user_input, | ||||||
| find_bool_macro_in_config, | ||||||
| ) | ||||||
|
|
||||||
|
|
||||||
| def _get_git_restore_url(package_obj, ver): | ||||||
| """Return a suitable git URL to restore remote.origin.url. | ||||||
|
|
||||||
| Prefer the per-version URL if it ends with '.git'. Otherwise, fall back to | ||||||
| the 'repository' field (appending '.git' when necessary). Return None when | ||||||
| no suitable git URL can be determined. | ||||||
| """ | ||||||
| try: | ||||||
| url = package_obj.get_url(ver) | ||||||
| except Exception: | ||||||
| url = None | ||||||
|
Comment on lines
+57
to
+60
|
||||||
|
|
||||||
| if url and isinstance(url, str) and url.endswith('.git'): | ||||||
| return url | ||||||
|
|
||||||
| repo = None | ||||||
| try: | ||||||
| repo = package_obj.pkg.get('repository') if package_obj and package_obj.pkg else None | ||||||
| except Exception: | ||||||
|
||||||
| except Exception: | |
| except (AttributeError, TypeError): |
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.
The docstring should specify the parameter types and return type for better clarity. Consider adding Args and Returns sections to document
package_objandverparameters.