Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitba01785

Browse files
committed
Adding set_url and list_urls methods to Remote
Both commands enable handling of a little known featureof 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'sa nice method to do it, using the configuration.Signed-off-by: Guyzmo <guyzmo+github@m0g.net>
1 parent902679c commitba01785

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

‎git/remote.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,21 @@ def iter_items(cls, repo):
434434
yieldRemote(repo,section[lbound+1:rbound])
435435
# END for each configuration section
436436

437+
defset_url(self,url,**kwargs):
438+
'''Configure a new url on current remote (cf command git remote set_url'''
439+
scmd='set-url'
440+
kwargs['insert_kwargs_after']=scmd
441+
self.repo.git.remote(scmd,self.name,url,**kwargs)
442+
returnself
443+
444+
@property
445+
deflist_urls(self):
446+
'''Return the list of all configured URL targets'''
447+
remote_details=self.repo.git.remote("show",self.name)
448+
forlineinremote_details.split('\n'):
449+
if' Push URL:'inline:
450+
yieldline.split(': ')[-1]
451+
437452
@property
438453
defrefs(self):
439454
"""

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp