Show More
@@ -14,7 +14,7 b'' | |||||
14 | # You should have received a copy of the GNU General Public License |
|
14 | # You should have received a copy of the GNU General Public License | |
15 | # along with this program; if not, write to the Free Software Foundation, |
|
15 | # along with this program; if not, write to the Free Software Foundation, | |
16 | # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
16 | # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
17 |
|
17 | import collections | ||
18 | import logging |
|
18 | import logging | |
19 | import os |
|
19 | import os | |
20 | import posixpath as vcspath |
|
20 | import posixpath as vcspath | |
@@ -448,8 +448,44 b' class GitRemote(object):' | |||||
448 | return remote_refs |
|
448 | return remote_refs | |
449 |
|
449 | |||
450 | @reraise_safe_exceptions |
|
450 | @reraise_safe_exceptions | |
|
451 | def sync_fetch(self, wire, url, refs=None): | |||
|
452 | repo = self._factory.repo(wire) | |||
|
453 | if refs and not isinstance(refs, (list, tuple)): | |||
|
454 | refs = [refs] | |||
|
455 | ||||
|
456 | # get remote heads | |||
|
457 | output, __ = self.run_git_command( | |||
|
458 | wire, ['ls-remote', url], fail_on_stderr=False, | |||
|
459 | _copts=['-c', 'core.askpass=""'], | |||
|
460 | extra_env={'GIT_TERMINAL_PROMPT': '0'}) | |||
|
461 | ||||
|
462 | remote_refs = collections.OrderedDict() | |||
|
463 | fetch_refs = [] | |||
|
464 | for ref_line in output.splitlines(): | |||
|
465 | sha, ref = ref_line.split('\t') | |||
|
466 | sha = sha.strip() | |||
|
467 | remote_refs[ref] = sha | |||
|
468 | ||||
|
469 | if refs and sha in refs: | |||
|
470 | # we filter fetch using our specified refs | |||
|
471 | fetch_refs.append('{}:{}'.format(ref, ref)) | |||
|
472 | elif not refs: | |||
|
473 | fetch_refs.append('{}:{}'.format(ref, ref)) | |||
|
474 | ||||
|
475 | fetch_refs.append('{}:{}'.format(ref, ref)) | |||
|
476 | ||||
|
477 | _out, _err = self.run_git_command( | |||
|
478 | wire, ['fetch', url, '--'] + fetch_refs, fail_on_stderr=False, | |||
|
479 | _copts=['-c', 'core.askpass=""'], | |||
|
480 | extra_env={'GIT_TERMINAL_PROMPT': '0'}) | |||
|
481 | ||||
|
482 | return remote_refs | |||
|
483 | ||||
|
484 | @reraise_safe_exceptions | |||
451 | def sync_push(self, wire, url, refs=None): |
|
485 | def sync_push(self, wire, url, refs=None): | |
452 | if self.check_url(url, wire): |
|
486 | if not self.check_url(url, wire): | |
|
487 | return | |||
|
488 | ||||
453 |
|
|
489 | repo = self._factory.repo(wire) | |
454 |
|
|
490 | self.run_git_command( | |
455 |
|
|
491 | wire, ['push', url, '--mirror'], fail_on_stderr=False, |
@@ -585,7 +585,9 b' class HgRemote(object):' | |||||
585 |
|
585 | |||
586 | @reraise_safe_exceptions |
|
586 | @reraise_safe_exceptions | |
587 | def sync_push(self, wire, url): |
|
587 | def sync_push(self, wire, url): | |
588 | if self.check_url(url, wire['config']): |
|
588 | if not self.check_url(url, wire['config']): | |
|
589 | return | |||
|
590 | ||||
589 |
|
|
591 | repo = self._factory.repo(wire) | |
590 |
|
592 | |||
591 |
|
|
593 | # Disable any prompts for this repo |
General Comments 0
You need to be logged in to leave comments.
Login now