Request the Github API to check for branch/tag
in `refs/heads` and `refs/tags` endpoints.

@param  {String}   `refs`
@param  {String}   `opts`
@param  {Function} `callback`
@api private
425182
function request(refs, opts, callback) {
  var url = fmt(format, endpoint, cache.user, cache.repo, refs);

  got.get(url, opts, function(err, res) {
    res = res ? JSON.parse(res) : {};
    if (res.ref === refs) {
      callback(null, true);
      return;
    }

    callback(null, false);
  });
}
583797
function mergeForVersions(versions, opts) {
    opts = _.defaults(opts || {}, {
        includeTag: true
    });

    return _.chain(versions)
        .reduce(function(prev, version) {
            if (!version.notes) return prev;

            // Include tag as title
            if (opts.includeTag) {
                prev = prev + '## ' + version.tag + '\n';
            }

            // Include notes
            prev = prev + version.notes + '\n';

            // New lines
            if (opts.includeTag) {
                prev = prev + '\n';
            }

            return prev;
        }, '')
        .value();
}
576866
function (opt, handler) {

			var recquire_t = require('aureooms-node-recursive-require');
			var extend = require('node.extend');

			var dflt = {
				name: undefined,
				src: undefined,
				exports: undefined,
				base: 0,
				index: 'index.js',
				intro: 'intro.js',
				outro: 'outro.js',
				rec: false,
				flat: true,
				debug: false
			};

			opt = extend({}, dflt, opt);

			if (opt.name) opt.name = opt.name.replace(/-/g, '');

			var recquire = recquire_t(opt);

			recquire(opt.src, opt.exports, -opt.base, handler);
		}
147346
function IndexService(opts) {
  util.applyProperties(this, opts);
  if (this.project) {
    this.metadataHelper = new MetadataHelper({ sfdcClient : this.project.sfdcClient });
    this.sfdcClient = this.project.sfdcClient;
  } else if (this.sfdcClient) {
    this.metadataHelper = new MetadataHelper({ sfdcClient : this.sfdcClient });
  }
}
1102848
function parseArguments(opts, callback) {
  if ('function' === typeof opts) {
    callback = opts
    opts = {}
  }

  opts = opts || {}
  opts.callback = callback

  return opts
}
125545
function GitHub(ready, user, pass, useSsh) {

  var opts = {
    version: '3.0.0',
    timeout: 30000
  };

  var proxy = bag.proxy();
  if (proxy) {
    proxy = url.parse(proxy);
    opts.proxy = {
      host: proxy.hostname,
      port: proxy.port
    };
  }

  this.gh = new github(opts);
  this.useSsh = useSsh;

  var self = this;
  if (user && pass) {
    // if credentials are provided, use those to authenticate
    self.gh.authenticate({
      type: 'basic',
      username: user,
      password: pass
    });
    // the other branches (oauth and no authentication only call the ready()
    // callback after another callback has resolved, which guarantees that this
    // (constructor) function has returned before the ready callback has been
    // called. This, in turn, ensures that the code calling this constructor has received a constructed object. To ensure this also for the basic auth case, we need to make this asynchronous as well.
    process.nextTick(ready);
  } else {
    var gitHubAuth = new GithubAuth();
    gitHubAuth
      .readAuthToken()
      .then(function success(token) {
        self.gh.authenticate({
          type : 'oauth',
          token : token
        });
        ready();
      }, function error() {
        // no auth token, user did not execute repoman --signin
        // continue without authentication
        ready();
    });
  }
}
435345
function (opts) {
            opts.meta.classes = [];
            Y.each(this.data.classes, function (v) {
                if (v.external) {
                    return;
                }
                opts.meta.classes.push({
                    displayName: v.name,
                    name: v.name,
                    namespace: v.namespace,
                    module: v.module,
                    description: v.description,
                    access: v.access || 'public'
                });
            });
            opts.meta.classes.sort(this.nameSort);
            return opts;
        }
589369
function (opts) {
            var self = this;
            opts.meta.modules = [];
            opts.meta.allModules = [];
            Y.each(this.data.modules, function (v) {
                if (v.external) {
                    return;
                }
                opts.meta.allModules.push({
                    displayName: v.displayName || v.name,
                    name: self.filterFileName(v.name),
                    description: v.description
                });
                if (!v.is_submodule) {
                    var o = {
                        displayName: v.displayName || v.name,
                        name: self.filterFileName(v.name)
                    };
                    if (v.submodules) {
                        o.submodules = [];
                        Y.each(v.submodules, function (i, k) {
                            var moddef = self.data.modules[k];
                            if (moddef) {
                                o.submodules.push({
                                    displayName: k,
                                    description: moddef.description
                                });
                                // } else {
                                //     Y.log('Submodule data missing: ' + k + ' for ' + v.name, 'warn', 'builder');
                            }
                        });
                        o.submodules.sort(self.nameSort);
                    }
                    opts.meta.modules.push(o);
                }
            });
            opts.meta.modules.sort(this.nameSort);
            opts.meta.allModules.sort(this.nameSort);
            return opts;
        }
1055290
def _bse_cli_get_refs(args):
    ''''''
    return api.get_references(
        basis_name=args.basis, elements=args.elements, version=args.version, fmt=args.reffmt, data_dir=args.data_dir)
180059
function parsers(snapdragon, options) {
  var reflinks = snapdragon.reflinks = {unresolved: [], resolved: {}};
  if (options && options.reflinks) {
    reflinks.resolved = extend({}, options.reflinks);
  }

  snapdragon.parser.sets.reflink = snapdragon.parser.sets.reflink || [];
  snapdragon.parser

    /**
     * Newlins
     */

    .capture('newline', /^\n/)

    /**
     * Text parser
     */

    .capture('text', function() {
      if (this.isInside('reflink')) return;
      var pos = this.position();
      var m = this.match(not);
      if (!m || !m[0]) return;

      return pos({
        type: 'text',
        val: m[0]
      });
    })

    /**
     * Bracket (noop)
     */

    .capture('reflink', function() {})

    /**
     * Open: '['
     */

    .capture('reflink.open', function() {
      var parsed = this.parsed;
      var pos = this.position();
      var m = this.match(/^\[(?=.*\])/);
      if (!m) return;

      var prev = this.prev();
      var last = utils.last(prev.nodes);

      var open = pos({
        type: 'reflink.open',
        val: m[0]
      });

      var node = pos({
        type: 'reflink',
        label: '',
        nodes: [open]
      });

      define(node, 'parsed', parsed);
      define(node, 'parent', prev);
      define(open, 'parent', node);
      this.push('reflink', node);
      prev.nodes.push(node);
    })

    /**
     * Bracket text
     */

    .capture('reflink.inner', function() {
      if (!this.isInside('reflink')) return;
      var pos = this.position();
      var m = this.match(not);
      if (!m || !m[0]) return;

      var prev = this.prev();
      var node = pos({
        type: 'reflink.inner',
        val: m[0]
      });

      if (prev.type !== 'reflink') {
        node.type = 'text';
      }

      prev.nodes.push(node);
      define(node, 'parent', prev);
      prev.label = node.val;
    })

    /**
     * Close: ']'
     */

    .capture('reflink.close', function() {
      var parsed = this.parsed;
      var pos = this.position();
      var m = this.match(/^(\])(:?)([^\n]+)?/);
      if (!m) return;

      var prev = this.prev();
      var last = utils.last(prev.nodes);

      var node = pos({
        type: 'reflink.close',
        val: m[1] + (m[2] ? (m[2] + ' ') : '')
      });

      define(node, 'rest', this.input);

      if (last.type === 'reflink.open') {
        node.type = 'reflink.inner';
        node.escaped = true;
        return node;
      }

      var parent = this.pop('reflink');
      if (!this.isType(parent, 'reflink')) {
        if (this.options.strict) {
          throw new Error('missing opening "["');
        }
        node.type = 'reflink.inner';
        node.escaped = true;
        return node;
      }

      parent.nodes.push(node);
      define(node, 'parent', parent);

      if (m[3] && !m[2]) {
        node.val += m[3];
        return;
      }

      if (m[2] && m[3]) {
        var tok = pos({type: 'reflink.link'});
        parseLink(m[3], tok, parent);
        parent.nodes.push(tok);
        define(tok, 'parent', parent);

        var key = parent.label;
        tok.label = key;

        if (tok.resolved) {
          reflinks.resolved[key] = tok;
        } else {
          reflinks.unresolved.push(tok);
        }
      }
    });
}
43755
function (opts) {
        this.isAppError = true;
        this.code = opts.code;
        this.message = this.msg = opts.msg;
        this.type = opts.type;
        this.err = opts.err;
        this.stack = (new Error(opts.msg)).stack;
    }
1348860
def check_rev_options(self, rev, dest, rev_options):
        
        revisions = self.get_tag_revs(dest)
        revisions.update(self.get_branch_revs(dest))

        origin_rev = 'origin/%s' % rev
        if origin_rev in revisions:
            # remote branch
            return [revisions[origin_rev]]
        elif rev in revisions:
            # a local tag or branch name
            return [revisions[rev]]
        else:
            logger.warn("Could not find a tag or branch '%s', assuming commit." % rev)
            return rev_options
831097
def get_git_refs(repopath):
    
    tags = []
    branches = []
    branch = ''
    files_modifed = []

    if os.path.isfile(repopath):
        repopath = os.path.dirname(repopath)

    try:

        git = programs.find_program('git')

        # Files modified
        out, err = programs.run_program(
            git, ['status', '-s'],
            cwd=repopath,
        ).communicate()

        if PY3:
            out = out.decode(sys.getdefaultencoding())
        files_modifed = [line.strip() for line in out.split('\n') if line]

        # Tags
        out, err = programs.run_program(
            git, ['tag'],
            cwd=repopath,
        ).communicate()

        if PY3:
            out = out.decode(sys.getdefaultencoding())
        tags = [line.strip() for line in out.split('\n') if line]

        # Branches
        out, err = programs.run_program(
            git, ['branch', '-a'],
            cwd=repopath,
        ).communicate()

        if PY3:
            out = out.decode(sys.getdefaultencoding())

        lines = [line.strip() for line in out.split('\n') if line]
        for line in lines:
            if line.startswith('*'):
                line = line.replace('*', '').strip()
                branch = line

            branches.append(line)

    except (subprocess.CalledProcessError, AttributeError, OSError):
        pass

    return branches + tags, branch, files_modifed
313188
def get_git_refs(self):
        
        return github.PaginatedList.PaginatedList(
            github.GitRef.GitRef,
            self._requester,
            self.url + "/git/refs",
            None
        )
329302
function CallFunc (opts) {
    CallFunc.superclass.constructor.call(this, opts)

    // Save target & method so that copy() can recreate callback
    this.target = opts.target
    this.method = (typeof opts.method == 'function') ? opts.method : this.target[opts.method]
    this.callback = this.method.bind(this.target)
}
1198987
function dependencyMatch (expected, actual) {
  // expand github:user/repo#hash to git://github.com/...
  if (expected.indexOf('github:') === 0) {
    expected = expected.replace(/^github:/, 'git://github.com/')
    var parsed = url.parse(expected)
    parsed.pathname += '.git'
    expected = url.format(parsed)
  }

    // normalize git+https prefix
  actual = actual.replace(/^git\+https/, 'git')
  expected = expected.replace(/^git\+https/, 'git')

  expected = ngu(expected)
  actual = ngu(actual)

  expected.url = expected.url.replace('https://', 'git://')
  actual.url = actual.url.replace('https://', 'git://')

  if (expected.url !== actual.url) {
    return false
  }

  if (actual.branch && actual.branch.indexOf(expected.branch) !== 0) {
    return false
  }

  return true
}
580827
function (token, references) {
    if (!references || !references.length) {
      return Promise.resolve(false);
    }

    const endpoints = {};

    references.forEach(reference => {
      endpoints[reference.endpoint] = endpoints[reference.endpoint] || [];
      endpoints[reference.endpoint].push(reference.me);
    });

    return Promise.all(
      Object.keys(endpoints)
        .map(endpoint => validateToken(token, endpoints[endpoint], endpoint))
    )
      .then(result =>
        result.some(valid => valid && !(valid instanceof Error)) ||
        result.find(valid => valid instanceof TokenScopeError) ||
        result[0]
      );
  }