Checks if the given pull_request was merged to the default branch
        between self.start_date and self.end_date
335990
def _include_pull_request(self, pull_request):
        

        merged_date = pull_request.merged_at
        if not merged_date:
            return False
        if self.last_tag:
            last_tag_sha = self.last_tag_info["commit"].sha
            if pull_request.merge_commit_sha == last_tag_sha:
                # Github commit dates can be different from the merged_at date
                return False

        current_tag_sha = self.current_tag_info["commit"].sha
        if pull_request.merge_commit_sha == current_tag_sha:
            return True

        # include PRs before current tag
        if merged_date <= self.start_date:
            if self.end_date:
                # include PRs after last tag
                if (
                    merged_date > self.end_date
                    and pull_request.merge_commit_sha != last_tag_sha
                ):
                    return True
            else:
                # no last tag, include all PRs before current tag
                return True

        return False
984855
def expired? connection
    return true  if     @max_requests && connection.requests >= @max_requests
    return false unless @idle_timeout
    return true  if     @idle_timeout.zero?

    Time.now - connection.last_use > @idle_timeout
  end
402090
def _is_finished(self, as_of):
        
        if self.is_one_off():
            last_billing_cycle = self.get_billing_cycles()[self.total_billing_cycles - 1]
            return last_billing_cycle.date_range.upper <= as_of
        else:
            return False
474948
def on_ok(self):
        
        self.parentApp.repo_value['versions'] = {}
        self.parentApp.repo_value['build'] = {}
        for branch in self.branch_cb:
            if self.branch_cb[branch].value:
                # process checkboxes
                self.parentApp.repo_value['versions'][branch] = self.commit_tc[branch].values[self.commit_tc[branch].value]
                self.parentApp.repo_value['build'][branch] = True
        if self.error:
            self.quit()
        self.parentApp.addForm('CHOOSETOOLS',
                               ChooseToolsForm,
                               name='Choose tools to add for new plugin'
                               '\t\t\t\t\t\t^Q to quit',
                               color='CONTROL')
        self.parentApp.change_form('CHOOSETOOLS')
414066
def is_changed():
    
    executed, changed_lines = execute_git('status --porcelain', output=False)
    merge_not_finished = mod_path.exists('.git/MERGE_HEAD')
    return changed_lines.strip() or merge_not_finished
249109
def _check_inv_operation_for_date(self, item, timestamp, data_dict, data_index_dict):
        

        if item in data_index_dict:
            for item in data_index_dict[item]:

                # startdate < timestamp
                if const.START in data_dict[item] and not const.END in data_dict[item]:
                    if data_dict[item][const.START] < timestamp:
                        return True

                # enddate > timestamp
                elif not const.START in data_dict[item] and const.END in data_dict[item]:
                    if data_dict[item][const.END] > timestamp:
                        return True

                # startdate > timestamp > enddate
                elif const.START in data_dict[item] and const.END in data_dict[item]:
                    if data_dict[item][const.START] < timestamp \
                            and data_dict[item][const.END] > timestamp:
                        return True

                # no startdate or enddate available
                elif not const.START in data_dict[item] and not const.END in data_dict[item]:
                    return True

        raise KeyError
76257
def get_default_branch(repo):
    """"""
    url = "{}/repos/{}".format(GITHUB_API_BASE, repo)
    response = requests.get(url)
    if response.status_code == 200:
        api_response = json.loads(response.text)
        return api_response['default_branch']
    else:
        return 'master'
997353
def merge(base, opts= {})
      logger.info { "Merging #{branches.current.name} with #{base}" }
      args = []
      args << '-s' << opts[:merge_strategy] if opts[:merge_strategy]
      args << base
      return command(:merge, args)
    end
1017127
def _perform_merge(self, other):
        
        if len(other.value) > len(self.value):
            self.value = other.value[:]
        return True
344465
function isCurrentBranch( branch ) {
      return function() {
        var deferred = Q.defer();

        Q.fcall(command('git symbolic-ref --short -q HEAD', 'Get current branch'))
          .then(function( data ) {
            //console.log('data=',data);
            if ( data && data.trim() === branch ) {
              deferred.resolve(true);
            }
            else {
              throw new Error(format('Error. Branch [%s] is not the current branch. Output:[%s]', branch, data.trim()));
            }
          })
          .catch(function( err ) {
            console.log('err=',err);
            deferred.reject(err);
          });
        return deferred.promise;
      };
    }
568433
public function isPullRequestMerged($owner, $repo, $number)
	{
		$merged = false;

		try
		{
			$data = array();
			$this->client->request("/repos/$owner/$repo/pulls/$number/merge", 'GET', $data, 204, '');
			$merged = true;
		}
		catch ( GitHubClientException $e )
		{
		}

		return $merged;
	}
513543
def _has_old_request_ended(self, shard_state):
    
    assert shard_state.slice_start_time is not None
    assert shard_state.slice_request_id is not None
    request_ids = [shard_state.slice_request_id]
    logs = None
    try:
      logs = list(logservice.fetch(request_ids=request_ids))
    except (apiproxy_errors.FeatureNotEnabledError,
        apiproxy_errors.CapabilityDisabledError) as e:
      # Managed VMs do not have access to the logservice API
      # See https://groups.google.com/forum/#!topic/app-engine-managed-vms/r8i65uiFW0w
      logging.warning("Ignoring exception: %s", e)

    if not logs or not logs[0].finished:
      return False
    return True
1293648
function mergeNewAndOldMeta(old, updated) {
  const merged = {
    firstPublishTime: old.firstPublishTime || updated.publishTime
  };

  if (!Object.keys(old).length) {
    return updated;
  }

  if (old.history && updated.history) {
    merged.history = old.history.concat(updated.history);
  }

  return Object.assign(old, updated, merged);
}
413667
protected function getIsMerge($request)
    {
        $merge = $request->getVar('merge');

        // Default to true if not given
        if (!isset($merge)) {
            return true;
        }

        // merge=0 or merge=false will disable merge
        return !in_array($merge, array('0', 'false'));
    }
583180
public static boolean isExpired(Date startDate, DateField dateField, int timeLength, Date checkedDate) {
		final Date endDate = offset(startDate, dateField, timeLength);
		return endDate.after(checkedDate);
	}
228318
async def is_try_or_pull_request(self):
        
        tasks = [asyncio.ensure_future(link.is_try_or_pull_request()) for link in self.links]
        tasks.insert(0, asyncio.ensure_future(is_try_or_pull_request(self.context, self.task)))

        conditions = await raise_future_exceptions(tasks)
        return any(conditions)
417410
def auto_delete_pr_branch(pr: PullRequestDetails) -> bool:
    

    open_pulls = list_open_pull_requests(pr.repo, base_branch=pr.branch_name)
    if any(open_pulls):
        log('Not deleting branch {!r}. It is used elsewhere.'.format(
            pr.branch_name))
        return False

    remote = pr.remote_repo
    if pr.is_on_fork():
        log('Not deleting branch {!r}. It belongs to a fork ({}/{}).'.format(
            pr.branch_name,
            pr.remote_repo.organization,
            pr.remote_repo.name))
        return False

    url = ("https://api.github.com/repos/{}/{}/git/refs/heads/{}"
           "?access_token={}".format(remote.organization,
                                     remote.name,
                                     pr.branch_name,
                                     remote.access_token))
    response = requests.delete(url)

    if response.status_code == 204:
        # Delete succeeded.
        log('Deleted branch {!r}.'.format(pr.branch_name))
        return True

    log('Delete failed. Code: {}. Content: {}.'.format(
        response.status_code, response.content))
    return False