Pull a remote maildir to the local one.
330050
def sshpull(host, maildir, localmaildir, noop=False, verbose=False, filterfile=None):
    
    store = _SSHStore(host, maildir)
    _pull(store, localmaildir, noop, verbose, filterfile)
589707
def upload(self, local_fn: str, remote_fn: str = '',
             dont_overwrite: bool = False) -> None:
    """"""

    # support wildcard through glob
    if '*' in local_fn:
      for local_subfn in glob.glob(local_fn):
        self.upload(local_subfn)
      return

    if '#' in local_fn:  # hashes also give problems from shell commands
      self.log("skipping backup file {local_fn}")
      return

    if not self.sftp:
      self.sftp = u.call_with_retries(self.ssh_client.open_sftp,
                                      'self.ssh_client.open_sftp')

    def maybe_fix_mode(local_fn_, remote_fn_):
      """Makes remote file execute for locally executable files"""
      mode = oct(os.stat(local_fn_)[stat.ST_MODE])[-3:]
      if '7' in mode:
        self.log(f"Making {remote_fn_} executable with mode {mode}")
        # use raw run, in case tmux is unavailable
        self._run_raw(f"chmod {mode} {remote_fn_}")

    # augmented SFTP client that can transfer directories, from
    # https://stackoverflow.com/a/19974994/419116
    def _put_dir(source, target):
      """ Uploads the contents of the source directory to the target path."""

      def _safe_mkdir(path, mode=511, ignore_existing=True):
        """ Augments mkdir by adding an option to not fail if the folder exists  asdf asdf asdf as"""
        try:
          self.sftp.mkdir(path, mode)
        except IOError:
          if ignore_existing:
            pass
          else:
            raise

      assert os.path.isdir(source)
      _safe_mkdir(target)

      for item in os.listdir(source):
        if os.path.isfile(os.path.join(source, item)):
          self.sftp.put(os.path.join(source, item), os.path.join(target, item))
          maybe_fix_mode(os.path.join(source, item), os.path.join(target, item))
        else:
          _safe_mkdir(f'{target}/{item}')
          _put_dir(f'{source}/{item}', f'{target}/{item}')

    if not remote_fn:
      remote_fn = os.path.basename(local_fn)

    self.log('uploading ' + local_fn + ' to ' + remote_fn)
    remote_fn = remote_fn.replace('~', self.homedir)

    if '/' in remote_fn:
      remote_dir = os.path.dirname(remote_fn)
      assert self.exists(
        remote_dir), f"Remote dir {remote_dir} doesn't exist"
    if dont_overwrite and self.exists(remote_fn):
      self.log("Remote file %s exists, skipping" % (remote_fn,))
      return

    assert os.path.exists(local_fn), f"{local_fn} not found"
    if os.path.isdir(local_fn):
      _put_dir(local_fn, remote_fn)
    else:
      assert os.path.isfile(local_fn), "%s is not a file" % (local_fn,)
      # this crashes with IOError when upload failed
      if self.exists(remote_fn) and self.isdir(remote_fn):
        remote_fn = remote_fn + '/' + os.path.basename(local_fn)
      self.sftp.put(localpath=local_fn, remotepath=remote_fn)
      maybe_fix_mode(local_fn, remote_fn)
595771
def re_clone(self, repo_dir):
        """"""
        self.git('clone', self.remote_url, repo_dir)
        return GitRepo(repo_dir)
1114053
def pull(self):
        """"""
        repo_root = settings.REPO_ROOT
        pull_from_origin(join(repo_root, self.name))
295
def load_remote_system(url, format=None):
    '''
    '''
    filename, headers = urlretrieve(url)
    return load_system(filename, format=format)
1151382
def call_remote(method, args)

      urn, soap_url = block_given? ? yield : ["urn:partner.soap.sforce.com", @url.path]

      # Create XML text from the arguments.
      expanded = ''
      @builder = Builder::XmlMarkup.new(:target => expanded)
      expand(@builder, {method => args}, urn)

      extra_headers = ""
      extra_headers << (AssignmentRuleHeaderUsingRuleId % assignment_rule_id) if assignment_rule_id
      extra_headers << AssignmentRuleHeaderUsingDefaultRule if use_default_rule
      extra_headers << MruHeader if update_mru
      extra_headers << (ClientIdHeader % client_id) if client_id

      if trigger_user_email or trigger_other_email or trigger_auto_response_email
        extra_headers << '<partner:EmailHeader soap:mustUnderstand="1">'

        extra_headers << '<partner:triggerUserEmail>true</partner:triggerUserEmail>' if trigger_user_email
        extra_headers << '<partner:triggerOtherEmail>true</partner:triggerOtherEmail>' if trigger_other_email
        extra_headers << '<partner:triggerAutoResponseEmail>true</partner:triggerAutoResponseEmail>' if trigger_auto_response_email

        extra_headers << '</partner:EmailHeader>'
      end

      # Fill in the blanks of the SOAP envelope with our
      # session ID and the expanded XML of our request.
      request = (Envelope % [@session_id, @batch_size, extra_headers, expanded])

      # reset the batch size for the next request
      @batch_size = DEFAULT_BATCH_SIZE

      # gzip request
      request = encode(request)

      headers = {
        'Connection' => 'Keep-Alive',
        'Content-Type' => 'text/xml',
        'SOAPAction' => '""',
        'User-Agent' => 'activesalesforce rforce/1.0'
      }

      unless show_debug
        headers['Accept-Encoding'] = 'gzip'
        headers['Content-Encoding'] = 'gzip'
      end

      # Send the request to the server and read the response.
      response = @server.post2(soap_url, request.lstrip, headers)

      # decode if we have encoding
      content = decode(response)

      # Check to see if INVALID_SESSION_ID was raised and try to relogin in
      if method != :login and @session_id and content =~ /sf:INVALID_SESSION_ID/
        login(@user, @password)

        # repackage and rencode request with the new session id
        request = (Envelope % [@session_id, @batch_size, extra_headers, expanded])
        request = encode(request)

        # Send the request to the server and read the response.
        response = @server.post2(soap_url, request.lstrip, headers)

        content = decode(response)
      end

      SoapResponse.new(content).parse
    end
101033
def clone(url, tmpdir=None):
    ''''''
    if tmpdir is None:
        tmpdir = tempfile.mkdtemp()
    name = os.path.basename(url).replace('.git', '')
    dest = '%s/%s' %(tmpdir,name)
    return_code = os.system('git clone %s %s' %(url,dest))
    if return_code == 0:
        return dest
    bot.error('Error cloning repo.')
    sys.exit(return_code)
1056306
def pull(self):
        
        git.Repo(self.path).remote().pull(self.branch)
482541
def visit_folder(self, item, parent):
        
        if item.sent_to_remote:
            self._add_report_item(item.path, item.remote_id)
735536
def get_pull_command(self, remote=None, revision=None):
        """"""
        command = ['hg', 'pull']
        if remote:
            command.append(remote)
        if revision:
            command.append('--rev=%s' % revision)
        return command
1033861
def get_remote(self, remote='origin'):
        """"""
        repo = self.get_repo()
        if repo is not None:
            remotes = {r.name: r for r in repo.remotes}
            r = repo.remotes[0] if remote not in remotes else remotes[remote]
        else:
            r = None
        return r
1150966
def pull(self):
        
        if not os.path.exists(self.repo_dir):
            yield from self.initialize_repo()
        else:
            yield from self.update()
659693
function local(rootFolder) {
    // Construct name to remote id map
    const remote = path.join(rootFolder, constants.META_DIR, constants.META_REMOTE);
    const remoteSource = fs.readJsonSync(remote, 'utf8');
    const destination = constants.META_LOCAL;
    return pack(rootFolder, destination);
}
709965
def _file_local_or_remote(f, get_retriever):
    
    if os.path.exists(f):
        return f
    integration, config = get_retriever.integration_and_config(f)
    if integration:
        return integration.file_exists(f, config)
835283
def grab(branch, path = Dir.pwd, remote = 'origin')
      exit_status = 1
      error "no branch provided" if branch.nil?
      #remotes  = FalkorLib::Git.remotes(path)
      branches = FalkorLib::Git.list_branch(path)
      if branches.include? "remotes/#{remote}/#{branch}"
        info "Grab the branch '#{remote}/#{branch}'"
        exit_status = execute_in_dir(FalkorLib::Git.rootdir( path ), "git branch --track #{branch} #{remote}/#{branch}")
      else
        warning "the remote branch '#{remote}/#{branch}' cannot be found"
      end
      exit_status
    end
156587
def share_dir(email,path,perm="r",repo=self.repo,s_type="d")
      post_share_dir(repo,{"email"=> email, "path"=> path,"s_type"=> s_type,"perm"=> perm})
    end
1188379
def download(self, local, remote):
        
        self.sync(RemoteFile(remote, self.api), LocalFile(local))