syncs the src code to the remote box
435622
def rsync():
    
    log_green('syncing code to remote box...')
    data = load_state_from_disk()
    if 'SOURCE_PATH' in os.environ:
        with lcd(os.environ['SOURCE_PATH']):
            local("rsync  -a "
                  "--info=progress2 "
                  "--exclude .git "
                  "--exclude .tox "
                  "--exclude .vagrant "
                  "--exclude venv "
                  ". "
                  "-e 'ssh -C -i " + env.ec2_key_filename + "' "
                  "%s@%s:" % (env.user, data['ip_address']))
    else:
        print('please export SOURCE_PATH before running rsync')
        exit(1)
183754
def sync_remote_to_local(force="no"):
    

    assert "local_wp_dir" in env, "Missing local_wp_dir in env"

    if force != "yes":
        message = "This will replace your local database with your "\
            "remote, are you sure [y/n]"
        answer = prompt(message, "y")

        if answer != "y":
            logger.info("Sync stopped")
            return

    init_tasks()  # Bootstrap fabrik

    remote_file = "sync_%s.sql" % int(time.time()*1000)
    remote_path = "/tmp/%s" % remote_file

    with env.cd(paths.get_current_path()):
        env.run("wp db export %s" % remote_path)

    local_wp_dir = env.local_wp_dir
    local_path = "/tmp/%s" % remote_file

    # Download sync file
    get(remote_path, local_path)

    with lcd(local_wp_dir):
        elocal("wp db import %s" % local_path)

    # Cleanup
    env.run("rm %s" % remote_path)
    elocal("rm %s" % local_path)
1355369
def do_remote(self):
        
        if self.verify_ssl:
            args = {"verify": self.verify_ssl}
        else:
            args = {}

        try:
            logging.debug('KeyBundle fetch keys from: {}'.format(self.source))
            r = self.httpc('GET', self.source, **args)
        except Exception as err:
            logger.error(err)
            raise UpdateFailed(
                REMOTE_FAILED.format(self.source, str(err)))

        if r.status_code == 200:  # New content
            self.time_out = time.time() + self.cache_time

            self.imp_jwks = self._parse_remote_response(r)
            if not isinstance(self.imp_jwks,
                              dict) or "keys" not in self.imp_jwks:
                raise UpdateFailed(MALFORMED.format(self.source))

            logger.debug("Loaded JWKS: %s from %s" % (r.text, self.source))
            try:
                self.do_keys(self.imp_jwks["keys"])
            except KeyError:
                logger.error("No 'keys' keyword in JWKS")
                raise UpdateFailed(MALFORMED.format(self.source))

        else:
            raise UpdateFailed(
                REMOTE_FAILED.format(self.source, r.status_code))
        self.last_updated = time.time()
        return True
1333602
function (source, target, callback) {
    source = fss.slashify(source);
    target = fss.slashify(target);

    if (!shell.which('rsync')) {
        log('sync error', 'no rsync command found');
        callback();
    } else {
        log('rsync', fss.baseRelative(source));
        log('remote', target);
        var cmd = [config.rsync, source, target].join(' ');
        var opt = { maxBuffer: 5000*1024 };
        exec(cmd, opt, rsync_end(callback));
    }
}
1046091
def cat(src_filename, dst_file):
    """"""
    (dev, dev_filename) = get_dev_and_path(src_filename)
    if dev is None:
        with open(dev_filename, 'rb') as txtfile:
            for line in txtfile:
                dst_file.write(line)
    else:
        filesize = dev.remote_eval(get_filesize, dev_filename)
        return dev.remote(send_file_to_host, dev_filename, dst_file, filesize,
                          xfer_func=recv_file_from_remote)
46856
def sync_out(self, release):
        """"""
        if release.get('rsync_out_objs'):
            tree = release['canonical_dir']
            if not os.path.isdir(tree):
                self.log.info('Creating %s', tree)
                os.makedirs(tree)
            self.call(release['rsync_out_objs'])
            self.call(release['rsync_out_rest'])
1116970
@Override
    @InterfaceAudience.Private
    protected void processInbox(final RevisionList changes) {

        Log.v(TAG, "processInbox() changes=" + changes.size());

        // Generate a set of doc/rev IDs in the JSON format that _revs_diff wants:
        // <http://wiki.apache.org/couchdb/HttpPostRevsDiff>
        Map<String, List<String>> diffs = new HashMap<String, List<String>>();
        for (RevisionInternal rev : changes) {
            String docID = rev.getDocID();
            List<String> revs = diffs.get(docID);
            if (revs == null) {
                revs = new ArrayList<String>();
                diffs.put(docID, revs);
            }
            revs.add(rev.getRevID());
            addPending(rev);
        }

        // Call _revs_diff on the target db:
        Log.v(TAG, "%s: posting to /_revs_diff", this);

        CustomFuture future = sendAsyncRequest("POST", "_revs_diff", diffs, new RemoteRequestCompletion() {

            @Override
            public void onCompletion(RemoteRequest remoteRequest, Response httpResponse, Object response, Throwable e) {

                Log.v(TAG, "%s: got /_revs_diff response", this);
                Map<String, Object> results = (Map<String, Object>) response;
                if (e != null) {
                    setError(e);
                } else {
                    if (results.size() != 0) {
                        // Go through the list of local changes again, selecting the ones the destination server
                        // said were missing and mapping them to a JSON dictionary in the form _bulk_docs wants:
                        List<Object> docsToSend = new ArrayList<Object>();
                        RevisionList revsToSend = new RevisionList();
                        long bufferedSize = 0;
                        for (RevisionInternal rev : changes) {
                            // Is this revision in the server's 'missing' list?
                            Map<String, Object> properties = null;
                            Map<String, Object> revResults = (Map<String, Object>) results.get(rev.getDocID());
                            if (revResults == null) {
                                removePending(rev);
                                continue;
                            }
                            List<String> revs = (List<String>) revResults.get("missing");
                            if (revs == null || !revs.contains(rev.getRevID())) {
                                removePending(rev);
                                continue;
                            }

                            // NOTE: force to load body by Database.loadRevisionBody()
                            // In SQLiteStore.loadRevisionBody() does not load data from database
                            // if sequence != 0 && body != null
                            rev.setSequence(0);
                            rev.setBody(null);

                            RevisionInternal loadedRev;
                            try {
                                loadedRev = db.loadRevisionBody(rev);
                            } catch (CouchbaseLiteException e1) {
                                Log.w(TAG, "%s Couldn't get local contents of %s", rev, PusherInternal.this);
                                continue;
                            }

                            if (loadedRev.getPropertyForKey("_removed") != null &&
                                    ((Boolean) loadedRev.getPropertyForKey("_removed")).booleanValue()) {
                                // Filter out _removed revision:
                                removePending(rev);
                                continue;
                            }

                            RevisionInternal populatedRev = transformRevision(loadedRev);

                            List<String> possibleAncestors = (List<String>) revResults.get("possible_ancestors");

                            properties = new HashMap<String, Object>(populatedRev.getProperties());
                            Map<String, Object> revisions = db.getRevisionHistoryDictStartingFromAnyAncestor(populatedRev, possibleAncestors);
                            properties.put("_revisions", revisions);
                            populatedRev.setProperties(properties);

                            // Strip any attachments already known to the target db:
                            if (properties.containsKey("_attachments")) {
                                // Look for the latest common ancestor and stub out older attachments:
                                int minRevPos = findCommonAncestor(populatedRev, possibleAncestors);

                                Status status = new Status(Status.OK);
                                if (!db.expandAttachments(populatedRev, minRevPos + 1, !dontSendMultipart, false, status)) {
                                    Log.w(TAG, "%s: Couldn't expand attachments of %s", this, populatedRev);
                                    continue;
                                }

                                properties = populatedRev.getProperties();
                                if (!dontSendMultipart && uploadMultipartRevision(populatedRev)) {
                                    continue;
                                }
                            }

                            if (properties == null || !properties.containsKey("_id")) {
                                throw new IllegalStateException("properties must contain a document _id");
                            }

                            revsToSend.add(rev);
                            docsToSend.add(properties);

                            bufferedSize += JSONUtils.estimate(properties);
                            if (bufferedSize > kMaxBulkDocsObjectSize) {
                                uploadBulkDocs(docsToSend, revsToSend);
                                docsToSend = new ArrayList<Object>();
                                revsToSend = new RevisionList();
                                bufferedSize = 0;
                            }
                        }

                        // Post the revisions to the destination:
                        uploadBulkDocs(docsToSend, revsToSend);

                    } else {
                        // None of the revisions are new to the remote
                        for (RevisionInternal revisionInternal : changes) {
                            removePending(revisionInternal);
                        }
                    }
                }
            }

        });
        future.setQueue(pendingFutures);
        pendingFutures.add(future);
        pauseOrResume();
    }
1126908
public function token_callback_checkbox_remote( $args ) {
		$checked = isset( self::$options_remote[ $args['id'] ] ) ? self::$options_remote[ $args['id'] ] : null;
		?>
		<label for="<?php esc_attr_e( $args['id'] ); ?>">
			<input type="checkbox" id="<?php esc_attr_e( $args['id'] ); ?>" name="github_updater_remote_management[<?php esc_attr_e( $args['id'] ); ?>]" value="1" <?php checked( '1', $checked ); ?> >
			<?php echo $args['title']; ?>
		</label>
		<?php
	}
1108869
function(src, regex, substr, options, index, actionName) {
    //takes the src content and changes the content
    var regExp = null,
        updatedSrc;
    if (typeof regex ===  'string') {
      regExp = new RegExp(regex , options); //regex => string
    } else {
      regExp = regex; //regex => RegExp object
    }
    updatedSrc = String(src).replace(regExp, substr); //note: substr can be a function
    index = typeof index === 'undefined' ? '' : index;
    if (!actionName) {
      grunt.log.verbose.ok(index + 1 + ' action(s) completed.');
    } else {
      grunt.log.verbose.ok(actionName + ' action completed.');
    }
    return updatedSrc;
  }
14401
function remoteAsync() {
  var generator = this.generator;
  
  var username;
  var repo;
  var branch;
  var refresh;
  var url;

  // With URL and refresh
  if (arguments.length <= 2) {
    url = arguments[0];
    refresh = arguments[1];
  } else {
    username = arguments[0];
    repo = arguments[1];
    branch = arguments[2];
    refresh = arguments[3];
    url = 'https://github.com/' + [username, repo, 'archive', branch].join('/') + '.tar.gz';
  }
  
  return new Promise(function(resolve, reject) {
    parent.remote.call(parent, url, function(err, remote) {
      if (err) {
        reject(err);
      }
      else {
        resolve(remote);
      }
    }, refresh);
  });
}
721198
function(src, dest){
      if(fs.existsSync(dest)){
        this.waitForResponse(src, dest); 
      }else{
        this.copy(src, dest); 
        this.triggerNext(); 
      }
    }
1248266
def sync(self):
        """"""
        self.elk.send(ka_encode())
        self.get_descriptions(TextDescriptions.KEYPAD.value)
834667
def update
      config.update(:remotes) do |rmts|
        yield(rmts || {}).tap do |new_rmts|
          raise_invalid unless validate(new_rmts)
        end
      end
    end
703061
function sync() {
    syncDom.setAttribute('data-sync-state', 'syncing');
    var opts = {continuous: true, complete: syncError};
    db.replicate.to(remoteCouch, opts);
    db.replicate.from(remoteCouch, opts);
  }
1172458
def write_to_remote(self, filepath_from, filepath_to, mtime_dt=None):
        """"""

        self.__log.debug("Writing L[%s] -> R[%s]." % (filepath_from, 
                                                      filepath_to))

        with open(filepath_from, 'rb') as file_from:
            with SftpFile(self, filepath_to, 'w') as sf_to:
                while 1:
                    part = file_from.read(MAX_MIRROR_WRITE_CHUNK_SIZE)
                    sf_to.write(part)

                    if len(part) < MAX_MIRROR_WRITE_CHUNK_SIZE:
                        break

        if mtime_dt is None:
            mtime_dt = datetime.now()

        self.utimes_dt(filepath_to, mtime_dt, mtime_dt)
812402
def send_to_remote(self, b, no_partitions=False):
        

        raise DeprecationWarning("Don't use any more?")

        from ambry.bundle.process import call_interval

        remote_name = self.resolve_remote(b)

        remote = self.remote(remote_name)

        db_path = b.package()

        with b.progress.start('checkin', 0, message='Check in bundle') as ps:

            ps.add(message='Checking in bundle {} to {}'.format(b.identity.vname, remote))

            db_ck = b.identity.cache_key + '.db'

            ps.add(message='Upload bundle file', item_type='bytes', item_count=0)
            total = [0]

            @call_interval(5)
            def upload_cb(n):
                total[0] += n
                ps.update(message='Upload bundle file', item_count=total[0])

            with open(db_path) as f:
                remote.makedir(os.path.dirname(db_ck), recursive=True, allow_recreate=True)
                self.logger.info('Send bundle file {} '.format(db_path))
                e = remote.setcontents_async(db_ck, f, progress_callback=upload_cb)
                e.wait()

            ps.update(state='done')

            if not no_partitions:
                for p in b.partitions:

                    ps.add(message='Upload partition', item_type='bytes', item_count=0, p_vid=p.vid)

                    with p.datafile.open(mode='rb') as fin:

                        total = [0]

                        @call_interval(5)
                        def progress(bytes):
                            total[0] += bytes
                            ps.update(
                                message='Upload partition'.format(p.identity.vname),
                                item_count=total[0])

                        remote.makedir(os.path.dirname(p.datafile.path), recursive=True, allow_recreate=True)
                        event = remote.setcontents_async(p.datafile.path, fin, progress_callback=progress)
                        event.wait()

                        ps.update(state='done')

            ps.add(message='Setting metadata')
            ident = json.dumps(b.identity.dict)
            remote.setcontents(os.path.join('_meta', 'vid', b.identity.vid), ident)
            remote.setcontents(os.path.join('_meta', 'id', b.identity.id_), ident)
            remote.setcontents(os.path.join('_meta', 'vname', text_type(b.identity.vname)), ident)
            remote.setcontents(os.path.join('_meta', 'name', text_type(b.identity.name)), ident)
            ps.update(state='done')

            b.dataset.commit()

            return remote_name, db_ck
66530
def sync(self, src, dst):
        
        return dst.patch(src.delta(dst.signature(block_size=self.block_size)))