|
33 | 33 | fromgitdb.utilimportjoin |
34 | 34 | fromgit.compatimport (defenc,force_text,is_win) |
35 | 35 | importlogging |
| 36 | +fromgit.excimportGitCommandError |
36 | 37 |
|
37 | 38 | log=logging.getLogger('git.remote') |
38 | 39 |
|
@@ -494,11 +495,22 @@ def delete_url(self, url, **kwargs): |
494 | 495 |
|
495 | 496 | @property |
496 | 497 | 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] |
502 | 514 |
|
503 | 515 | @property |
504 | 516 | defrefs(self): |
|