What are the configured options in the git repo.
160544
def configured_options(self):
        """"""
        stdout_lines = self._check_output(['config', '--list']).splitlines()
        return {key: value for key, value in [line.split('=') for line in stdout_lines]}
711647
def checkout(self, revision, options):
        
        rev = revision.key
        self.repo.git.checkout(rev)
498067
def repo_values(self):
        
        branches = []
        commits = {}
        m_helper = Tools()
        status = m_helper.repo_branches(self.parentApp.repo_value['repo'])
        # branches and commits must both be retrieved successfully
        if status[0]:
            branches = status[1]
            status = m_helper.repo_commits(self.parentApp.repo_value['repo'])
            if status[0]:
                r_commits = status[1]
                for commit in r_commits:
                    commits[commit[0]] = commit[1]
            else:
                # if commits failed, return commit errors
                return status
        else:
            # if branch failed, return branch errors
            return status
        # if everything is good, return branches with commits
        return branches, commits
425417
def _get_alternates(self):
        """"""
        alternates_path = osp.join(self.git_dir, 'objects', 'info', 'alternates')

        if osp.exists(alternates_path):
            with open(alternates_path, 'rb') as f:
                alts = f.read().decode(defenc)
            return alts.strip().splitlines()
        else:
            return []
665465
def init():
    '''
    
    '''
    bp_ = os.path.join(__opts__['cachedir'], 'hgfs')
    new_remote = False
    repos = []

    per_remote_defaults = {}
    for param in PER_REMOTE_OVERRIDES:
        per_remote_defaults[param] = \
            six.text_type(__opts__['hgfs_{0}'.format(param)])

    for remote in __opts__['hgfs_remotes']:
        repo_conf = copy.deepcopy(per_remote_defaults)
        if isinstance(remote, dict):
            repo_url = next(iter(remote))
            per_remote_conf = dict(
                [(key, six.text_type(val)) for key, val in
                 six.iteritems(salt.utils.data.repack_dictlist(remote[repo_url]))]
            )
            if not per_remote_conf:
                log.error(
                    'Invalid per-remote configuration for hgfs remote %s. If '
                    'no per-remote parameters are being specified, there may '
                    'be a trailing colon after the URL, which should be '
                    'removed. Check the master configuration file.', repo_url
                )
                _failhard()

            branch_method = \
                per_remote_conf.get('branch_method',
                                    per_remote_defaults['branch_method'])
            if branch_method not in VALID_BRANCH_METHODS:
                log.error(
                    'Invalid branch_method \'%s\' for remote %s. Valid '
                    'branch methods are: %s. This remote will be ignored.',
                    branch_method, repo_url, ', '.join(VALID_BRANCH_METHODS)
                )
                _failhard()

            per_remote_errors = False
            for param in (x for x in per_remote_conf
                          if x not in PER_REMOTE_OVERRIDES):
                log.error(
                    'Invalid configuration parameter \'%s\' for remote %s. '
                    'Valid parameters are: %s. See the documentation for '
                    'further information.',
                    param, repo_url, ', '.join(PER_REMOTE_OVERRIDES)
                )
                per_remote_errors = True
            if per_remote_errors:
                _failhard()

            repo_conf.update(per_remote_conf)
        else:
            repo_url = remote

        if not isinstance(repo_url, six.string_types):
            log.error(
                'Invalid hgfs remote %s. Remotes must be strings, you may '
                'need to enclose the URL in quotes', repo_url
            )
            _failhard()

        try:
            repo_conf['mountpoint'] = salt.utils.url.strip_proto(
                repo_conf['mountpoint']
            )
        except TypeError:
            # mountpoint not specified
            pass

        hash_type = getattr(hashlib, __opts__.get('hash_type', 'md5'))
        repo_hash = hash_type(repo_url).hexdigest()
        rp_ = os.path.join(bp_, repo_hash)
        if not os.path.isdir(rp_):
            os.makedirs(rp_)

        if not os.listdir(rp_):
            # Only init if the directory is empty.
            hglib.init(rp_)
            new_remote = True
        try:
            repo = hglib.open(rp_)
        except hglib.error.ServerError:
            log.error(
                'Cache path %s (corresponding remote: %s) exists but is not '
                'a valid mercurial repository. You will need to manually '
                'delete this directory on the master to continue to use this '
                'hgfs remote.', rp_, repo_url
            )
            _failhard()
        except Exception as exc:
            log.error(
                'Exception \'%s\' encountered while initializing hgfs '
                'remote %s', exc, repo_url
            )
            _failhard()

        try:
            refs = repo.config(names='paths')
        except hglib.error.CommandError:
            refs = None

        # Do NOT put this if statement inside the except block above. Earlier
        # versions of hglib did not raise an exception, so we need to do it
        # this way to support both older and newer hglib.
        if not refs:
            # Write an hgrc defining the remote URL
            hgconfpath = os.path.join(rp_, '.hg', 'hgrc')
            with salt.utils.files.fopen(hgconfpath, 'w+') as hgconfig:
                hgconfig.write('[paths]\n')
                hgconfig.write(
                    salt.utils.stringutils.to_str(
                        'default = {0}\n'.format(repo_url)
                    )
                )

        repo_conf.update({
            'repo': repo,
            'url': repo_url,
            'hash': repo_hash,
            'cachedir': rp_,
            'lockfile': os.path.join(__opts__['cachedir'],
                                     'hgfs',
                                     '{0}.update.lk'.format(repo_hash))
        })
        repos.append(repo_conf)
        repo.close()

    if new_remote:
        remote_map = os.path.join(__opts__['cachedir'], 'hgfs/remote_map.txt')
        try:
            with salt.utils.files.fopen(remote_map, 'w+') as fp_:
                timestamp = datetime.now().strftime('%d %b %Y %H:%M:%S.%f')
                fp_.write('# hgfs_remote map as of {0}\n'.format(timestamp))
                for repo in repos:
                    fp_.write(
                        salt.utils.stringutils.to_str(
                            '{0} = {1}\n'.format(repo['hash'], repo['url'])
                        )
                    )
        except OSError:
            pass
        else:
            log.info('Wrote new hgfs_remote map to %s', remote_map)

    return repos
747984
def add_general_options!(opt)
        opt.separator 'General Options:'

        opt.on('-h', '--help', 'Show this help message and quit.') { |v| options[:help] = v }
        opt.on('-p', '--pretend', 'Run but do not make any changes.') { |v| options[:pretend] = v }
        opt.on('-f', '--force', 'Overwrite files that already exist.') { options[:collision] = :force }
        opt.on('-s', '--skip', 'Skip files that already exist.') { options[:collision] = :skip }
        opt.on('-q', '--quiet', 'Suppress normal output.') { |v| options[:quiet] = v }
        opt.on('-t', '--backtrace', 'Debugging: show backtrace on errors.') { |v| options[:backtrace] = v }
        opt.on('-c', '--svn', 'Modify files with subversion. (Note: svn must be in path)') do
          options[:svn] = `svn status`.inject({}) do |opt, e|
            opt[e.chomp[7..-1]] = true
            opt
          end
        end
        opt.on('-g', '--git', 'Modify files with git. (Note: git must be in path)') do
          options[:git] = `git status`.inject({:new => {}, :modified => {}}) do |opt, e|
            opt[:new][e.chomp[14..-1]] = true if e =~ /new file:/
            opt[:modified][e.chomp[14..-1]] = true if e =~ /modified:/
            opt
          end
        end
      end
295242
def setup_git(pelican):
    """"""
    pelican.settings.setdefault('GIT_CACHE_ENABLED', False)
    pelican.settings.setdefault('GIT_CACHE_LOCATION',
                                '/tmp/git-cache')

    # Make sure the cache directory exists
    cache_base = pelican.settings.get('GIT_CACHE_LOCATION')
    if not os.path.exists(cache_base):
        os.makedirs(cache_base)
827523
def choose(self):
        
        keys = """
 at the right side for enable or to the
left side for disable.

Keys: SPACE   select or deselect the highlighted repositories,
             move it between the left and right lists
          ^       move the focus to the left list
          $       move the focus to the right list
        TAB     move focus
      ENTER   press the focused button

      Disabled  <-------- REPOSITORIES ------->  Enabled"""
        self.read_enabled()
        self.read_disabled()
        text, title, backtitle, status = keys, " Repositories ", "", False
        self.selected = DialogUtil(self.disabled, text, title, backtitle,
                                   status).buildlist(self.enabled)
        if self.selected is not None:
            self.update_repos()
        else:
            self.selected = self.enabled
        self.clear_screen()
        self.reference()
1286851
def commit_config(self):
        """"""
        commands = []
        commands.append('copy startup-config flash:rollback-0')
        commands.append('configure session {}'.format(self.config_session))
        commands.append('commit')
        commands.append('write memory')

        self.device.run_commands(commands)
        self.config_session = None
817118
protected function configure()
    {
        $this->setName('split')
            ->setDescription('Split subtree and push to various remotes.')
            ->addArgument(
                'parent',
                InputArgument::REQUIRED,
                'The parent repository tag to which each component is linked.'
            )
            ->addOption(
                'token',
                't',
                InputOption::VALUE_OPTIONAL,
                sprintf(
                    'A Github Auth Token. If not provided, uses value of environment variable `%s`.',
                    self::TOKEN_ENV
                )
            )
            ->addOption(
                'splitsh',
                null,
                InputOption::VALUE_OPTIONAL,
                'Path to a pre-compiled splitsh-lite binary.'
            )
            ->addOption(
                'component',
                'c',
                InputOption::VALUE_OPTIONAL,
                'Split and release only a single component.'
            );
    }
117393
def main():
    """"""

    parser = argparse.ArgumentParser(description=__doc__)
    parser.add_argument(
        'githubtoken',
        help="Github OAuth token, see https://developer.github.com/v3/oauth/")
    parser.add_argument('destination', help="location of the downloaded repos")
    parser.add_argument(
        '-n', '--nbrepo', help="number of repositories per language",
        type=int, default=1000)
    parser.add_argument(
        '-d', '--debug', default=False, action='store_true',
        help="show debug messages")

    args = parser.parse_args()
    config_logging(args.debug)

    destination = Path(args.destination)
    nb_repos = args.nbrepo
    token = args.githubtoken

    languages = config_dict('languages.json')
    destination.mkdir(exist_ok=True)

    for pos, language in enumerate(sorted(languages), 1):
        LOGGER.info("Step %.2f%%, %s", 100 * pos / len(languages), language)
        LOGGER.info("Fetch %d repos infos for language %s", nb_repos, language)
        repos = _retrieve_repo_details(language, nb_repos, token)
        LOGGER.info("%d repos details kept. Downloading", len(repos))
        _download_repos(language, repos, destination)
        LOGGER.info("Language %s repos downloaded", language)

    LOGGER.debug("Exit OK")
1003739
def update_git_repo():
    
    today
    commands = """
        git add docs/*.html
        git add docs/images/
        git add docs*.ipynb
        git commit -am "autocommit new docs build {}"
        git push hobson
        git push origin

        git checkout master
        git merge gh-pages -m "automerge gh-pages into master"
        git push hobson
        git push origin

        git checkout gh-pages
        git merge master -m "automerge master into gh-pages"
        git push hobson
        git push origin
        """.format(datetime.datetime.today().isoformat())

    for cmd in commands.split('\n'):
        cmd = cmd.strip()
        if cmd:
            try:
                output = subprocess.check_output(cmd.split())
                print(output)
            except CalledProcessError:
                print_exc()
1317200
def configure(options)

      # config file default options
      configuration = {
                        :options => {
                          :verbose => false,
                          :color => 'AUTO',
                          :short => false,
                          :unmodified => 'HIDE',
                          :match => 'ALL',
                          :list => 'ALL'
                        },
                        :commands => [
                          'diff',
                          'grep',
                          'log',
                          'ls-files',
                          'show',
                          'status'
                        ]
                      }

      # set default config if not given on command line
      config = options[:config]
      if config.nil?
        config = [
                   File.join(@working_dir, "repo.conf"),
                   File.join(@working_dir, ".repo.conf"),
                   File.join(@working_dir, "repo_manager", "repo.conf"),
                   File.join(@working_dir, ".repo_manager", "repo.conf"),
                   File.join(@working_dir, "config", "repo.conf"),
                   File.expand_path(File.join("~", ".repo.conf")),
                   File.expand_path(File.join("~", "repo.conf")),
                   File.expand_path(File.join("~", "repo_manager", "repo.conf")),
                   File.expand_path(File.join("~", ".repo_manager", "repo.conf"))
                 ].detect { |filename| File.exists?(filename) }
      end

      if config && File.exists?(config)
        # load options from the config file, overwriting hard-coded defaults
        logger.debug "reading configuration file: #{config}"
        config_contents = YAML.load(ERB.new(File.open(config, "rb").read).result)
        configuration.merge!(config_contents.symbolize_keys!) if config_contents && config_contents.is_a?(Hash)
      else
        # user specified a config file?, no error if user did not specify config file
        raise "config file not found" if options[:config]
      end

      # store the original full config filename for later use
      configuration[:configuration_filename] = config

      configuration.recursively_symbolize_keys!

      # the command line options override options read from the config file
      configuration[:options].merge!(options)
      configuration
    end
938314
def repo_name
      unless @repo_name
        url = config["remote.#{name}.url"]
        raise GitProcessError.new("There is no #{name} url set up.") if url.nil? or url.empty?
        uri = Addressable::URI.parse(url)
        @repo_name = uri.path.sub(/\.git/, '').sub(/^\//, '')
      end
      @repo_name
    end
577918
function _config(args) {
  var opts = {};

  if(args.removeExtraneous){
    opts.removeExtraneous = true;
  }

  if (args.bitbucketAuthUser || args.bitbucketAuthPass) {
    opts.bitbucket = {
      authUser: args.bitbucketAuthUser,
      authPass: args.bitbucketAuthPass
    };

  } else if (args.githubUser || args.githubOrg || args.githubAuthUser || args.githubAuthPass) {
    opts.github = {
      user    : args.githubUser,
      org     : args.githubOrg,
      authUser: args.githubAuthUser,
      authPass: args.githubAuthPass,
      useSsh : args.githubUseSsh
    };

  } else if (args.gitoriousUrl || args.gitoriousProject) {
    opts.gitorious = {
      url    : args.gitoriousUrl,
      project: args.gitoriousProject
    };

  } else if (args.local) {
    opts.local = {
      dir: process.cwd()
    };
  }

  new Repoman().config(opts, bag.exit);
}
1253201
def repo_branches(self, repo):
        
        branches = []
        try:
            # switch to directory where repo will be cloned to
            status = self.path_dirs.apply_path(repo)
            if status[0]:
                cwd = status[1]
            else:
                self.logger.error('apply_path failed. Exiting repo_branches'
                                  ' with status ' + str(status))
                return status

            branch_output = check_output(shlex.split('git branch -a'),
                                         stderr=STDOUT,
                                         close_fds=True)
            branch_output = branch_output.split(b'\n')
            for branch in branch_output:
                br = branch.strip()
                if br.startswith(b'*'):
                    br = br[2:]
                if b'/' in br:
                    branches.append(br.rsplit(b'/', 1)[1].decode('utf-8'))
                elif br:
                    branches.append(br.decode('utf-8'))

            branches = list(set(branches))
            for branch in branches:
                try:
                    check_output(shlex.split('git checkout ' + branch),
                                 stderr=STDOUT,
                                 close_fds=True)
                except Exception as e:  # pragma: no cover
                    self.logger.error('repo_branches failed with error: ' +
                                      str(e) + ' on branch: ' + str(branch))
                    status = (False, e)
                    return status

            chdir(cwd)
            status = (True, branches)
        except Exception as e:  # pragma: no cover
            self.logger.error('repo_branches failed with error: ' + str(e))
            status = (False, e)

        return status
519545
def _install(_):
    
    if not os.path.exists(".git"):
        fatal("not in a git repo.")

    config = __load_config()

    if config.get("checks") is None:
        fatal("global ``checks`` variable missing from configuration.")

    # We try to load all checks to check that they exist NOW.
    for hook in config["checks"]:
        checks = __load_checks(config["checks"][hook])
        # Also verify that they apply to the hooks.
        __verify_checks_for_hook(checks, hook)

    reply = input("This will overwrite your current hooks. "
                  "Proceed [yes/No]? ")
    if reply != "yes":
        raise Exit(0)

    for hook in config["checks"]:
        hook_f = open(os.path.join(".git/hooks/", hook), 'w')
        hook_f.write("""#!/usr/bin/env python
# GENRATED BY GLERBL. DO NOT MODIFY.
from glerbl.__main__ import main


exit(main(["glerbl", "hook", "{0}"]))
""".format(hook))
        os.fchmod(hook_f.fileno(),
                  os.fstat(hook_f.fileno()).st_mode | stat.S_IXUSR)
        hook_f.close()