-
Notifications
You must be signed in to change notification settings - Fork 241
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
add commands to manage Git refs #296
Conversation
1cf2434
to
c16d041
Compare
This changeset adds methods to manage Git refs: * list of references * create/update/delete a single reference
3dce28f
to
4ba5533
Compare
"""Create a reference. | ||
:param str name: Name of the reference to create (example: heads/my_branch or tags/my_tag). | ||
:param str object_id: id of the object to create the reference from. | ||
:param bool locked: If the reference is locked (default False) |
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.
I tried the command with --locked and still got
{
"customMessage": null,
"isLocked": false,
"name": "refs/heads/NewBranchCreationLocked1",
"newObjectId": "ffb155f085e36281514672fe8d31983e8ec6d640",
"oldObjectId": "0000000000000000000000000000000000000000",
"rejectedBy": null,
"repositoryId": "89c5139b-34e7-4c45-8d40-d23353e22014",
"success": true,
"updateStatus": "succeeded"
}
Will need to check this.
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.
You're right. I think the problem is in the serialization/deserialization of boolean values (which is strange if accurate.)
When retrieving the list of all refs, the isLocked
value is null
:
"isLocked": null,
"isLockedBy": null,
"name": "refs/tags/tag_4",
"objectId": "4f20eea9a98c52b75e8264634ca63b662d6fa55a",
when a boolean value should be true/false.
Suggestion is to remove the --locked
parameter to unblock this PR and open an issue for further investigation.
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.
Go ahead with the suggestion.
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 issue lies somewhere between the vsts-python-api
and the rest endpoint: microsoft/azure-devops-python-api#174
* renamed reposRefTest.py * defined more strict assert statements
|
||
class TestRefMethods(unittest.TestCase): | ||
|
||
_TEST_DEVOPS_ORGANIZATION = 'https://AzureDevOpsCliTest.visualstudio.com' |
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.
Put an invalid url here like.. https://some-invalid-org.visualstudio.com.
This will fail the test since the "client = get_git_client(organization)" call in each of the commands makes a network call. You will need to mock it, in your case to return a GitClient object.
We discovered this recently and I am fixing other tests.
This one is implemented correctly.
https://github.com/Microsoft/azure-devops-cli-extension/blob/master/azure-devops/azext_devops/test/pipelines/test_pipelines_build.py
check - self.get_client = patch('vsts.vss_connection.VssConnection.get_client')
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.
I guess besides the comment on tests rest looks good.
Do you need any help with the remaining changes?
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.
If possible please add examples for the commands
something similar to
#417
Thank you @vbossica for your contribution! 👍 |
This changeset adds methods to manage Git refs: