GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Adding support for git remote set-url/get-url API to Remote by guyzmo · Pull Request #446 · gitpython-developers/GitPython

Conversation

@guyzmo

@guyzmo guyzmo commented May 26, 2016

Copy link
Copy Markdown
Contributor

Both commands enable handling of a little known feature
of git, which is to support multiple URL for one remote.
You can add multiple url using the set_url subcommand of
git remote. Though listing them is also handy, so there's
a nice method to do it, using the configuration.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@guyzmo

guyzmo commented May 26, 2016

Copy link
Copy Markdown
Contributor Author

might need to write some tests for those?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@guyzmo
guyzmo force-pushed the updating_remote_url_handling branch from 546dfeb to ba01785 Compare May 26, 2016 19:12
@Byron

Byron commented May 27, 2016

Copy link
Copy Markdown
Member

Oh yes please ! It should be relatively straightforward to deduce how to write tests for this by looking at the existing ones. Usually there are helper functions to setup even more complex fixtures.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Byron

Byron commented May 27, 2016 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Before I forget, could you also look at how existing methods are documented and match the documentation style ? This would include documenting all parameters, for example.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@guyzmo

guyzmo commented May 27, 2016

Copy link
Copy Markdown
Contributor Author

I might, but sadly I'm now in the train, going away for four days, during which I'm on a crappy tablet on which I cannot work. Though, I very much would like to see this new methods included in the next patchset so I can remove the monkey patching from my own codebase as well :-)

cf https://github.com/guyzmo/git-repo/blob/master/git_repo/services/service.py#L25-43

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Byron Byron self-assigned this May 28, 2016
@Byron Byron added this to the v2.0.4 - Bugfixes milestone May 28, 2016
@nvie nvie modified the milestones: v2.0.4 - Bugfixes, v2.0.5, v2.0.5 - Bugfixes, v2.0.6 - Bugfixes May 30, 2016
@guyzmo guyzmo mentioned this pull request Jun 7, 2016
Wait on new release of gitpython guyzmo/git-repo#30
Closed
@guyzmo
Adding support for git remote set-url/get-url API to Remote
b366d3f
Both commands enable handling of a little known feature
of git, which is to support multiple URL for one remote.
You can add multiple url using the `set_url` subcommand of
`git remote`. As listing them is also handy, there's a
nice method to do it, using `get_url`.

* adding set_url method that maps to the git remote set-url command¶
 * can be used to set an URL, or replace an URL with optional positional arg¶
 * can be used to add, delete URL with kwargs (matching set-url options)¶
* adding add_url, delete_url methods that wraps around set_url for conveniency¶
* adding urls property that yields an iterator over the setup urls for a remote¶
* adding a test suite that checks all use case scenarii of this added API.¶

Signed-off-by: Guyzmo <[email protected]>
@guyzmo
guyzmo force-pushed the updating_remote_url_handling branch from ba01785 to b366d3f Compare June 8, 2016 17:35
@guyzmo guyzmo changed the title Adding set_url and list_urls methods to Remote Adding support for git remote set-url/get-url API to Remote Jun 8, 2016
@guyzmo

guyzmo commented Jun 8, 2016

Copy link
Copy Markdown
Contributor Author

So, I've squashed my commit with a new one, featuring a few changes:

  • The set_url method is a direct wrapper for git remote set-url ;
  • the urls property is providing an iterator over the remote's URLs (I followed how you named refs)

Then I've added a couple of convenience methods, to avoid adding awkward arguments to control set_url:

  • the add_url method is there so you can add an URL to a remote
  • and delete_url method is to delete one.

Finally, I've added a test covering all the new code, with a couple of edge cases, and wrote pydoc for those functions. I hope it's how you like it, mates!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@guyzmo
Switching the urls property to use git remote show instead of `gi…
3f4b410
…t remote get-url`

`get-url` is a new API that is not widely available yet (introduced in git 2.7.0), and
provokes failure on travis.

Signed-off-by: Guyzmo <[email protected]>
@guyzmo
guyzmo force-pushed the updating_remote_url_handling branch from c780aff to 3f4b410 Compare June 8, 2016 17:48
@guyzmo

guyzmo commented Jun 8, 2016

Copy link
Copy Markdown
Contributor Author

I rolled back the urls property, because that was failing on Travis, which isn't using latest git.

The git remote get-url API has been introduced in git 2.7.0, and wasn't available before.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@guyzmo

guyzmo commented Jun 8, 2016

Copy link
Copy Markdown
Contributor Author

can you ping me when you think you'll be able to merge, and publish on pypi¸ and what version that will be? So I can update my setup.py accordingly ☺

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Byron Byron added the acknowledged label Jun 14, 2016
@Byron
Byron merged commit 9bebaca into gitpython-developers:master Jun 14, 2016
Byron added a commit that referenced this pull request Jun 14, 2016
@Byron
doc(changes): inform about new API
5c8ff21
Relates to #446
@Byron

Byron commented Jun 14, 2016

Copy link
Copy Markdown
Member

If @nvie doesn't beat me to it, I will get the new release on the way on my next maintenance slot. Maybe tomorrow ... .

guyzmo reacted with thumbs up emoji guyzmo reacted with hooray emoji guyzmo reacted with heart emoji
All reactions
  • 👍 1 reaction
  • 🎉 1 reaction
  • ❤️ 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@guyzmo

guyzmo commented Jun 14, 2016

Copy link
Copy Markdown
Contributor Author

thank you ;-)

preparing my own code to be ready to point to the right version! :-)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@nvie

nvie commented Jun 14, 2016

Copy link
Copy Markdown
Contributor

I'll add 2 more bug fixes tonight to this release. After I'm done with those, I'll roll a new release :)

guyzmo reacted with thumbs up emoji guyzmo reacted with laugh emoji
All reactions
  • 👍 1 reaction
  • 😄 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@Byron Byron

Labels

acknowledged

Milestone

v2.0.6 - Bugfixes

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@guyzmo @Byron @nvie
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.