##// END OF EJS Templates
fix(LFS): added git lfs push --all <GIT-URL> option into sync_push. Fixes: RCCE-9
ilin.s -
r1195:a578d58d default
parent child Browse files
Show More
@@ -461,10 +461,18 b' class GitRemote(RemoteBase):'
461 url_obj = url_parser(safe_bytes(url))
461 url_obj = url_parser(safe_bytes(url))
462 authinfo = url_obj.authinfo()[1]
462 authinfo = url_obj.authinfo()[1]
463
463
464 def _convert_to_strings(data):
465 if isinstance(data, bytes):
466 return safe_str(data)
467 elif isinstance(data, tuple):
468 return tuple(_convert_to_strings(item) for item in data)
469 else:
470 return data
471
464 if authinfo:
472 if authinfo:
465 # create a password manager
473 # create a password manager
466 passmgr = urllib.request.HTTPPasswordMgrWithDefaultRealm()
474 passmgr = urllib.request.HTTPPasswordMgrWithDefaultRealm()
467 passmgr.add_password(*authinfo)
475 passmgr.add_password(*_convert_to_strings(authinfo))
468
476
469 handlers.extend((httpbasicauthhandler(passmgr),
477 handlers.extend((httpbasicauthhandler(passmgr),
470 httpdigestauthhandler(passmgr)))
478 httpdigestauthhandler(passmgr)))
@@ -483,7 +491,7 b' class GitRemote(RemoteBase):'
483 if not test_uri.endswith('info/refs'):
491 if not test_uri.endswith('info/refs'):
484 test_uri = test_uri.rstrip('/') + '/info/refs'
492 test_uri = test_uri.rstrip('/') + '/info/refs'
485
493
486 o = self._build_opener(test_uri)
494 o = self._build_opener(url=url)
487 o.addheaders = [('User-Agent', 'git/1.7.8.0')] # fake some git
495 o.addheaders = [('User-Agent', 'git/1.7.8.0')] # fake some git
488
496
489 q = {"service": 'git-upload-pack'}
497 q = {"service": 'git-upload-pack'}
@@ -821,7 +829,7 b' class GitRemote(RemoteBase):'
821 return remote_refs
829 return remote_refs
822
830
823 @reraise_safe_exceptions
831 @reraise_safe_exceptions
824 def sync_push(self, wire, url, refs=None):
832 def sync_push(self, wire, url, refs=None, **kwargs):
825 if not self.check_url(url, wire):
833 if not self.check_url(url, wire):
826 return
834 return
827 config = self._wire_to_config(wire)
835 config = self._wire_to_config(wire)
@@ -830,6 +838,12 b' class GitRemote(RemoteBase):'
830 wire, ['push', url, '--mirror'], fail_on_stderr=False,
838 wire, ['push', url, '--mirror'], fail_on_stderr=False,
831 _copts=self._remote_conf(config),
839 _copts=self._remote_conf(config),
832 extra_env={'GIT_TERMINAL_PROMPT': '0'})
840 extra_env={'GIT_TERMINAL_PROMPT': '0'})
841 if kwargs.get('sync_large_objects'):
842 self.run_git_command(
843 wire, ['lfs', 'push', url, '--all'],
844 fail_on_stderr=False,
845 _copts=self._remote_conf(config),
846 )
833
847
834 @reraise_safe_exceptions
848 @reraise_safe_exceptions
835 def get_remote_refs(self, wire, url):
849 def get_remote_refs(self, wire, url):
General Comments 0
You need to be logged in to leave comments. Login now