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,13 +448,49 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): | |
453 | repo = self._factory.repo(wire) |
|
487 | return | |
454 | self.run_git_command( |
|
488 | ||
455 | wire, ['push', url, '--mirror'], fail_on_stderr=False, |
|
489 | repo = self._factory.repo(wire) | |
456 | _copts=['-c', 'core.askpass=""'], |
|
490 | self.run_git_command( | |
457 | extra_env={'GIT_TERMINAL_PROMPT': '0'}) |
|
491 | wire, ['push', url, '--mirror'], fail_on_stderr=False, | |
|
492 | _copts=['-c', 'core.askpass=""'], | |||
|
493 | extra_env={'GIT_TERMINAL_PROMPT': '0'}) | |||
458 |
|
494 | |||
459 | @reraise_safe_exceptions |
|
495 | @reraise_safe_exceptions | |
460 | def get_remote_refs(self, wire, url): |
|
496 | def get_remote_refs(self, wire, url): |
@@ -585,19 +585,21 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 | repo = self._factory.repo(wire) |
|
589 | return | |
590 |
|
590 | |||
591 | # Disable any prompts for this repo |
|
591 | repo = self._factory.repo(wire) | |
592 | repo.ui.setconfig('ui', 'interactive', 'off', '-y') |
|
592 | ||
|
593 | # Disable any prompts for this repo | |||
|
594 | repo.ui.setconfig('ui', 'interactive', 'off', '-y') | |||
593 |
|
595 | |||
594 |
|
|
596 | bookmarks = dict(repo._bookmarks).keys() | |
595 |
|
|
597 | remote = peer(repo, {}, url) | |
596 |
|
|
598 | # Disable any prompts for this remote | |
597 |
|
|
599 | remote.ui.setconfig('ui', 'interactive', 'off', '-y') | |
598 |
|
600 | |||
599 |
|
|
601 | return exchange.push( | |
600 |
|
|
602 | repo, remote, newbranch=True, bookmarks=bookmarks).cgresult | |
601 |
|
603 | |||
602 | @reraise_safe_exceptions |
|
604 | @reraise_safe_exceptions | |
603 | def revision(self, wire, rev): |
|
605 | def revision(self, wire, rev): |
General Comments 0
You need to be logged in to leave comments.
Login now