Set remote id based on remote_folder and check children against this folder's children.
        :param remote_folder: RemoteFolder to compare against
331407
def update_remote_ids(self, remote_folder):
        
        self.remote_id = remote_folder.id
        _update_remote_children(remote_folder, self.children)
482541
def visit_folder(self, item, parent):
        
        if item.sent_to_remote:
            self._add_report_item(item.path, item.remote_id)
813789
def visit_file(self, item, parent):
        
        if item.sent_to_remote:
            self._add_report_item(item.path, item.remote_id, item.size, item.get_hash_value())
1342222
protected function prepareRemoteDirectory($remote_host, $remote_dir)
	{
		$this->log('Initialize remote directory: '. $remote_host .':'. $remote_dir, LOG_INFO, true);

		$output = array();
		$return = null;
		$this->sshExec($remote_host, "mkdir -p $remote_dir", $output, $return, '', '', LOG_DEBUG);

		if (empty($this->data_dirs))
            return;

        $data_dirs = count($this->data_dirs) > 1 ? '{'. implode(',', $this->data_dirs) .'}' : implode(',', $this->data_dirs);

        $cmd = "mkdir -v -m 0775 -p $remote_dir/{$this->data_dir_prefix}/$data_dirs";

        $output = array();
        $return = null;
        $this->sshExec($remote_host, $cmd, $output, $return, '', '', LOG_DEBUG);
	}
1101247
def _remote_file_exists(self, path):
        
        LOG.debug('_remote_file_exists(%r)', path)
        return self._connection.get_chain().call(
            ansible_mitogen.target.file_exists,
            mitogen.utils.cast(path)
        )
315679
def remote_file_exists(self, url):
        
        status = requests.head(url).status_code

        if status != 200:
            raise RemoteFileDoesntExist
1357749
def apply(self, folder):
        
        logger.info("Apply Patch %s@%s (commit %s)", self.url, self.branch, self.commit)
        remote_name = 'patch'
        commands = [
            "git remote add {} {}".format(remote_name, self.url),
            "git fetch {} {}".format(remote_name, self.branch),
            'git merge {} -m "patch"'.format(self.commit),
            "git remote remove {}".format(remote_name),
        ]
        for command in commands:
            return_code, stream_data = _run_command_inside_folder(command, folder)
            if return_code:
                msg = "Could not apply patch from {}@{}: {}. Error: {}".format(
                    self.url, self.branch, command, stream_data)
                logger.error(msg)
                raise RuntimeError(msg)
37897
protected function prepareLinkDest($remote_dir)
	{
		$this->log('prepareLinkDest', LOG_DEBUG);

		if ($remote_dir === null)
			$remote_dir = $this->remote_dir;

		$linkdest = '';

		if ($this->last_remote_target_dir)
		{
			$linkdest = "--copy-dest=$remote_dir/{$this->last_remote_target_dir}";
		}

		return $linkdest;
	}
271900
def create_child_folder(self, folder_name):
        
        headers = self.headers
        endpoint = 'https://outlook.office.com/api/v2.0/me/MailFolders/' + self.id + '/childfolders'
        payload = '{ "DisplayName": "' + folder_name + '"}'

        r = requests.post(endpoint, headers=headers, data=payload)

        if check_response(r):
            return_folder = r.json()
            return self._json_to_folder(self.account, return_folder)
799044
def perform_remote_action(i):
    

    # Import modules compatible with Python 2.x and 3.x
    import urllib

    try:    import urllib.request as urllib2
    except: import urllib2 # pragma: no cover

    try:    from urllib.parse import urlencode
    except: from urllib import urlencode # pragma: no cover

    rr={'return':0}

    # Get action
    act=i.get('action','')

    # Check output
    o=i.get('out','')

    if o=='con':
#       out('Initiating remote access ...')
#       out('')
       i['out']='con'
       i['quiet']='yes'
       if act=='pull':
          i['out']='json'
    else:
       i['out']='json'

#    # Clean up input
#    if o!='json_file': 
#       rr['out']='json' # Decided to return json to show that it's remote ...

    if 'cid' in i: 
       del(i['cid']) # already processed

    # Get URL
    url=i.get('remote_server_url','')

    # Process i
    if 'remote_server_url' in i: del(i['remote_server_url'])

    # Pre process if push file ...
    if act=='push':
       # Check file
       fn=i.get('filename','')
       if fn=='':
          x=i.get('cids',[])
          if len(x)>0:
             fn=x[0]

       if fn=='':
          return {'return':1, 'error':'filename is empty'}

       if not os.path.isfile(fn):
          return {'return':1, 'error':'file '+fn+' not found'}

       rx=convert_file_to_upload_string({'filename':fn})
       if rx['return']>0: return rx

       i['file_content_base64']=rx['file_content_base64']

       # Leave only filename without path
       i['filename']=os.path.basename(fn)

    # Prepare post variables
    r=dumps_json({'dict':i, 'skip_indent':'yes'})
    if r['return']>0: return r
    s=r['string'].encode('utf8')

    post=urlencode({'ck_json':s})
    if sys.version_info[0]>2: post=post.encode('utf8')

    # If auth
    au=i.get('remote_server_user','')
    if au!='': 
       del(i['remote_server_user'])

       ap=i.get('remote_server_pass','')
       if ap!='': 
          del(i['remote_server_pass'])

       auth = urllib2.HTTPPasswordMgrWithDefaultRealm()
       auth.add_password(None, url, au, ap)
       urllib2.install_opener(urllib2.build_opener(urllib2.HTTPBasicAuthHandler(auth)))

    # Prepare request
    request = urllib2.Request(url, post)

    # Connect
    try:
       f=urllib2.urlopen(request)
    except Exception as e:
       return {'return':1, 'error':'Access to remote CK repository failed ('+format(e)+')'}

    # Read from Internet
    try:
       s=f.read()
       f.close()
    except Exception as e:
       return {'return':1, 'error':'Failed reading stream from remote CK web service ('+format(e)+')'}

    # Check output
    try: s=s.decode('utf8')
    except Exception as e: pass
    if o=='con' and act!='pull':
       out(s.rstrip())
    else:
       # Try to convert output to dictionary
       r=convert_json_str_to_dict({'str':s, 'skip_quote_replacement':'yes'})
       if r['return']>0: 
          return {'return':1, 'error':'can\'t parse output from remote CK server ('+r['error']+'):\n'+s[:256]+'\n\n...)'}

       d=r['dict']

       if 'return' in d: d['return']=int(d['return']) # Fix for some strange behavior when 'return' is not integer - should check why ...

       if d.get('return',0)>0:
          return d

       # Post process if pull file ...
       if act=='pull':
          if o!='json' and o!='json_file':
             # Convert encoded file to real file ...
             x=d.get('file_content_base64','')

             fn=d.get('filename','')
             if fn=='': fn=cfg['default_archive_name']

             r=convert_upload_string_to_file({'file_content_base64':x, 'filename':fn})
             if r['return']>0: return r

             if 'file_content_base64' in d: del(d['file_content_base64'])

       rr.update(d)

    # Restore original output
    i['out']=o

    return rr
718706
public boolean remoteExists(URI uri) throws IOException {
    try {
      FileSystems.matchSingleFileSpec(uri.toString());
      return true;
    } catch (FileNotFoundException e) {
      return false;
    }
  }
657964
def has_child(self, child):
        
        if u'children' not in self:
            return False

        if not isinstance(child, basestring):
            child = child.get_id()

        return child in self.children
996907
def delete_file(self, project_name, remote_path):
        
        project = self._get_or_create_project(project_name)
        remote_file = project.get_child_for_path(remote_path)
        remote_file.delete()
1154601
def scp(local_path, remote_path)
      resources.active.each do |resource|
        resource.put(local_path, remote_path)
      end
      return
    end
652702
protected function checkFiles($remote_host, $remote_dir, $target_dir)
	{
		$this->log('checkFiles', LOG_DEBUG);
		if ($target_dir) {
			$this->log('Changed directories and files:', LOG_INFO, true);

			$this->rsyncExec($this->rsync_path .' --rsh="ssh -p '. $this->remote_port .'" -azcO --force --dry-run --delete --progress '. $this->prepareExcludes() .' ./ '. $this->remote_user .'@'. $remote_host .':'. $remote_dir .'/'. $this->last_remote_target_dir, 'Rsync check is mislukt');
		} else {
			$this->log('No deployment history found');
		}
	}
17740
def send_dir(self, local_path, remote_path, user='root'):
        
        self.enable_user(user)
        return self.ssh_pool.send_dir(user, local_path, remote_path)
586447
protected function updateFiles($remote_host, $remote_dir, $target_dir)
	{
		$this->log('updateFiles', LOG_DEBUG);

		$this->rsyncExec($this->rsync_path .' --rsh="ssh -p '. $this->remote_port .'" -azcO --force --delete --progress '. $this->prepareExcludes() .' '. $this->prepareLinkDest($remote_dir) .' ./ '. $this->remote_user .'@'. $remote_host .':'. $remote_dir .'/'. $target_dir);

		$this->fixDatadirSymlinks($remote_host, $remote_dir, $target_dir);

		$this->renameTargetFiles($remote_host, $remote_dir);
	}