-
Notifications
You must be signed in to change notification settings - Fork 1.3k
exp pull/push: add multi exp name arg support
#7206
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
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
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 |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| from typing import Iterable, List | ||
|
|
||
| from dvc.exceptions import InvalidArgumentError | ||
|
|
||
| from .base import ExpRefInfo | ||
|
|
||
|
|
||
| class AmbiguousExpRefInfo(InvalidArgumentError): | ||
| def __init__( | ||
| self, | ||
| exp_name: str, | ||
| exp_ref_list: Iterable[ExpRefInfo], | ||
| ): | ||
| msg = [ | ||
| ( | ||
| f"Ambiguous name '{exp_name}' refers to multiple experiments." | ||
| " Use one of the following full refnames instead:" | ||
| ), | ||
| "", | ||
| ] | ||
| msg.extend([f"\t{info}" for info in exp_ref_list]) | ||
| super().__init__("\n".join(msg)) | ||
|
|
||
|
|
||
| class UnresolvedExpNamesError(InvalidArgumentError): | ||
| def __init__( | ||
| self, unresolved_list: List[str], *args, git_remote: str = None | ||
| ): | ||
| unresolved_names = ";".join(unresolved_list) | ||
| if not git_remote: | ||
| if len(unresolved_names) > 1: | ||
| super().__init__( | ||
| f"'{unresolved_names}' are not valid experiment names" | ||
| ) | ||
| else: | ||
| super().__init__( | ||
| f"'{unresolved_names}' is not a valid experiment name" | ||
| ) | ||
| else: | ||
| super().__init__( | ||
| f"Experiment '{unresolved_names}' does not exist " | ||
| f"in '{git_remote}'" | ||
| ) |
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
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
Oops, something went wrong.
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.
Question. Is it normal that the help output now uses
<metavars>? I.e. is it necessary here?Most argument lists don't use
<>last time I checked.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.
Also, both the arg and metavar are in singular ("experiment") but the help text uses plural ("Experiments").
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.
Cc @dberenbaum rel. treeverse/dvc.org#3192 (comment)
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.
@jorgeorpinel , I tried to removed line
metavar="<experiment>",the output will beBy comparison the current version is:
Similiar for the
exp pushThere 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.
Up to you guys, I was just pointing it out as it seems a little inconsistent with other commands' help output.