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

Commit4b84602

Browse files
committed
remote,#528: fix prev cmt, Git<2.7 missget-url
1 parenta596e12 commit4b84602

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

‎git/remote.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
fromgitdb.utilimportjoin
3434
fromgit.compatimport (defenc,force_text,is_win)
3535
importlogging
36+
fromgit.excimportGitCommandError
3637

3738
log=logging.getLogger('git.remote')
3839

@@ -494,11 +495,22 @@ def delete_url(self, url, **kwargs):
494495

495496
@property
496497
defurls(self):
497-
""":return: Iterator yielding all configured URL targets on a remote
498-
as strings"""
499-
remote_details=self.repo.git.remote("get-url","--all",self.name)
500-
forlineinremote_details.split('\n'):
501-
yieldline
498+
""":return: Iterator yielding all configured URL targets on a remote as strings"""
499+
try:
500+
remote_details=self.repo.git.remote("get-url","--all",self.name)
501+
forlineinremote_details.split('\n'):
502+
yieldline
503+
exceptGitCommandErrorasex:
504+
## We are on git < 2.7 (i.e TravisCI as of Oct-2016),
505+
# so `get-utl` command does not exist yet!
506+
# see: https://github.com/gitpython-developers/GitPython/pull/528#issuecomment-252976319
507+
# and: http://stackoverflow.com/a/32991784/548792
508+
#
509+
if'Unknown subcommand: get-url'instr(ex):
510+
remote_details=self.repo.git.remote("show",self.name)
511+
forlineinremote_details.split('\n'):
512+
if' Push URL:'inline:
513+
yieldline.split(': ')[-1]
502514

503515
@property
504516
defrefs(self):

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp