-
-
Notifications
You must be signed in to change notification settings - Fork 395
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
Change refspec api #290
Change refspec api #290
Conversation
PyList_SET_ITEM( | ||
new_list, | ||
index, | ||
PyString_FromString(strarray->strings[index])); |
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.
We have to_unicode
for this which works across verisions.
I think the API will be more intuitive if using a getset instead of a method, so:
Please update the documentation: Thanks! |
I fixed most of the issues here, except probably the most important, the API. I see one problem with your proposal, while this would work: remote.fetch_refspecs = ['xxx:xxxx','yyyy:zzzz'] This would not produce the expected result: remote.fetch_refspecs[0] = 'xxxx:xxxx' which a user of the library might use, as this is correct: print remote.fetch_refspecs[0]
>>> 'xxxx:xxxx' IMHO a list where you could do remote.fetch_refspecs[0] = 'xxxx:xxx'
# or even
remote.fetch_refspec.append('xxxx:xxxx')
remove.fetch_refspec.remove('yyyy:yyyy') would be nicer, though I would leave it for a future PR (comments on this are welcome) BTW I don't know if the attribute |
Then it should be |
I think that fixes all the comments, adding better error treatment and making the API symmetric. |
After merging I get this error:
|
Upssss. Sorry about it. |
Thanks a lot for your patience :-D |
Thank you for contributing. Note I have fixed error handling. The Python functions already set an exception whenever there is an error, so you only need to set the exception for anything else. |
I see the changes, thanks a lot. Still learning how to do proper python exceptions :-) |
New attempt to provide refspec API with pygit, now using the new functions in libgit 0.20
It will expose:
the attributes
returning a list of strings with the refspecs
the methods
setting a list of strings a new refspecs