archives a tarball of kit/ in packages/
 the latest commit marked as dry-run-finished is taken as the version
541947
def archive_kit
      from_directory do
        id = @git.latest_id("tetra: dry-run-finished")
        destination_path = File.join(full_path, packages_dir, "#{name}-kit", "#{name}-kit.tar.xz")
        @git.archive("kit", id, destination_path)
      end
    end
720378
function compileHistory(resultingArrayOfCommits) {
  var lastSha;
  if (historyCommits.length > 0) {
    lastSha = historyCommits[historyCommits.length - 1].commit.sha();
    if (
      resultingArrayOfCommits.length == 1 &&
      resultingArrayOfCommits[0].commit.sha() == lastSha
    ) {
      return;
    }
  }

  resultingArrayOfCommits.forEach(function(entry) {
    historyCommits.push(entry);
  });

  lastSha = historyCommits[historyCommits.length - 1].commit.sha();

  walker = repo.createRevWalk();
  walker.push(lastSha);
  walker.sorting(nodegit.Revwalk.SORT.TIME);

  return walker.fileHistoryWalk(historyFile, 500)
    .then(compileHistory);
}
269331
def commit_update():
    
    unused = _find_unused_partition()
    new = _switch_partition()
    if new != unused:
        msg = f"Bad switch: switched to {new} when {unused} was unused"
        LOG.error(msg)
        raise RuntimeError(msg)
    else:
        LOG.info(f'commit_update: committed to booting {new}')
259511
def upgrade(self, flag):
        
        for pkg in self.binary:
            try:
                subprocess.call("upgradepkg {0} {1}".format(flag, pkg),
                                shell=True)
                check = pkg[:-4].split("/")[-1]
                if os.path.isfile(self.meta.pkg_path + check):
                    print("Completed!\n")
                else:
                    raise SystemExit()
            except subprocess.CalledProcessError:
                self._not_found("Can't upgrade", self.binary, pkg)
                raise SystemExit(1)
1347542
def run(self):
        
        args = {"remote": self.remote, "branch": self.branch}
        cmdl = "git pull --ff-only {remote:s} {branch:s}".format(**args)
        try:
            check_call(cmdl.split())
        except CalledProcessError:
            raise SystemExit(1)
        log.info("package version is now {:s}".format(version()))
        return
699258
function tarballedProps (pkg, spec, opts) {
  const needsShrinkwrap = (!pkg || (
    pkg._hasShrinkwrap !== false &&
    !pkg._shrinkwrap
  ))
  const needsBin = !!(!pkg || (
    !pkg.bin &&
    pkg.directories &&
    pkg.directories.bin
  ))
  const needsIntegrity = !pkg || (!pkg._integrity && pkg._integrity !== false)
  const needsShasum = !pkg || (!pkg._shasum && pkg._shasum !== false)
  const needsHash = needsIntegrity || needsShasum
  const needsManifest = !pkg || !pkg.name
  const needsExtract = needsShrinkwrap || needsBin || needsManifest
  if (!needsShrinkwrap && !needsBin && !needsHash && !needsManifest) {
    return BB.resolve({})
  } else {
    opts = optCheck(opts)
    const tarStream = fetchFromManifest(pkg, spec, opts)
    const extracted = needsExtract && new tar.Parse()
    return BB.join(
      needsShrinkwrap && jsonFromStream('npm-shrinkwrap.json', extracted),
      needsManifest && jsonFromStream('package.json', extracted),
      needsBin && getPaths(extracted),
      needsHash && ssri.fromStream(tarStream, { algorithms: ['sha1', 'sha512'] }),
      needsExtract && pipe(tarStream, extracted),
      (sr, mani, paths, hash) => {
        if (needsManifest && !mani) {
          const err = new Error(`Non-registry package missing package.json: ${spec}.`)
          err.code = 'ENOPACKAGEJSON'
          throw err
        }
        const extraProps = mani || {}
        delete extraProps._resolved
        // drain out the rest of the tarball
        tarStream.resume()
        // if we have directories.bin, we need to collect any matching files
        // to add to bin
        if (paths && paths.length) {
          const dirBin = mani
            ? (mani && mani.directories && mani.directories.bin)
            : (pkg && pkg.directories && pkg.directories.bin)
          if (dirBin) {
            extraProps.bin = {}
            paths.forEach(filePath => {
              if (minimatch(filePath, dirBin + '/**')) {
                const relative = path.relative(dirBin, filePath)
                if (relative && relative[0] !== '.') {
                  extraProps.bin[path.basename(relative)] = path.join(dirBin, relative)
                }
              }
            })
          }
        }
        return Object.assign(extraProps, {
          _shrinkwrap: sr,
          _resolved: (mani && mani._resolved) ||
          (pkg && pkg._resolved) ||
          spec.fetchSpec,
          _integrity: needsIntegrity && hash && hash.sha512 && hash.sha512[0].toString(),
          _shasum: needsShasum && hash && hash.sha1 && hash.sha1[0].hexDigest()
        })
      }
    )
  }
}
66183
function (version) {
        let cachePath = path.join(ForestInternal.elmRoot(version), 'binpath.log');
        let promiseFn = function (resolve, reject) {
            fs.readFile(cachePath, 'utf-8', (err, data) => {
                if (err) {
                    // TODO: Try to re-cache the result of `npm bin`
                    throw new ForestError(Errors.BinPathReadFailed, err.message);
                }
                else {
                    resolve(data.trim());
                }
            });
        };
        return new Promise(promiseFn);
    }
1356342
def cleanup_releases(limit=5):
    

    init_tasks()

    max_versions = limit + 1

    env.run("ls -dt %s/*/ | tail -n +%s | xargs rm -rf" % (
        paths.get_releases_path(),
        max_versions)
    )
92563
def ensure_dry_running(state, project)
      dry_running = project.dry_running?
      has_finished = !project.version.nil?

      if (state == :is_in_progress && dry_running) ||
         (state == :is_not_in_progress && !dry_running) ||
         (state == :has_finished && !dry_running && has_finished)
        yield
      else
        if (state == :is_in_progress) ||
           (state == :has_finished && !dry_running && !has_finished)
          puts "Please start a dry-run first, use \"tetra dry-run\""
        elsif (state == :is_not_in_progress) ||
              (state == :has_finished && dry_running)
          puts "There is a dry-run in progress, please finish it (^D) or abort it (^C^D)"
        end
      end
    end
183222
def define
      fail "Version required (or :noversion)" if @version.nil?
      @version = nil if :noversion == @version

      desc "Build all the packages"
      task :package

      desc "Force a rebuild of the package files"
      task repackage: [:clobber_package, :package]

      desc "Remove package products"
      task :clobber_package do
        rm_r package_dir rescue nil
      end

      task clobber: [:clobber_package]

      [
        [need_tar, tgz_file, "z"],
        [need_tar_gz, tar_gz_file, "z"],
        [need_tar_bz2, tar_bz2_file, "j"],
        [need_tar_xz, tar_xz_file, "J"]
      ].each do |need, file, flag|
        if need
          task package: ["#{package_dir}/#{file}"]
          file "#{package_dir}/#{file}" =>
            [package_dir_path] + package_files do
            chdir(package_dir) { sh @tar_command, "#{flag}cvf", file, package_name }
          end
        end
      end

      if need_zip
        task package: ["#{package_dir}/#{zip_file}"]
        file "#{package_dir}/#{zip_file}" =>
          [package_dir_path] + package_files do
          chdir(package_dir) { sh @zip_command, "-r", zip_file, package_name }
        end
      end

      directory package_dir_path => @package_files do
        @package_files.each do |fn|
          f = File.join(package_dir_path, fn)
          fdir = File.dirname(f)
          mkdir_p(fdir) unless File.exist?(fdir)
          if File.directory?(fn)
            mkdir_p(f)
          else
            rm_f f
            safe_ln(fn, f)
          end
        end
      end
      self
    end
1351493
function bumpVersion() {
  const versionList = gitVersionInfo(packageJson.version);
  const targetBranch = 'master';
  const repoURL = packageJson.repository.url.replace(/(?:git\+|\.git)/g, '');

  gitPorcelainStatus()
    .then(status => {
      if (status.currentBranch !== targetBranch) {
        log.error(
          `${chalk.bold('Working on the wrong branch!')}`,
          `All tags must be created on ${chalk.bold(targetBranch)} branch. Please push your work and`,
          `create a Pull Request to ${chalk.bold(targetBranch)}. Then you can continue this process.`
        );
      }

      if (!status.clean) {
        log.error(`${chalk.bold('Working dirty!')}`, 'Please commit before trying again!');
      }

      log.info(`Current version in package.json is ${chalk.bold(versionList.current)}\n`);

      return inquirer.prompt([
        {
          type: 'list',
          name: 'newVersion',
          message: 'How would you like to bump it?',
          choices: versionList.prompt
        }
      ]);
    })
    .then(answers => {
      packageJson.version = answers.newVersion;
      packageLock.version = answers.newVersion;

      // Update Package files
      return Promise.all([
        promiseWriteFile(path.join(cwd, 'package.json'), packageJson, 2),
        promiseWriteFile(path.join(cwd, 'package-lock.json'), packageLock, 2)
      ]);
    })
    .then(([rewritePKG, rewritePKGLOCK]) => {
      log.success(
        `Version bumped in the following file:`,
        `${figures.arrowRight} ${rewritePKG.fileName}`,
        `${figures.arrowRight} ${rewritePKGLOCK.fileName}`
      );

      return gitTagsInfo(`v${packageJson.version}`);
    })
    .then(([tagsList, firstCommit]) =>
      changelog(
        // Object with all the tags info.
        tagsList,
        // First commit.
        firstCommit.trim(),
        // URL of the repository.
        repoURL,
        // Name of the repository.
        capitalize(packageJson.name.replace(/-/g, ' '))
      )
    )
    .then(result => {
      var filesToAdd = ['changelog/', 'package.json', 'package-lock.json'];
      var resultLog = result.reduce((prev, { fileName }) => prev.concat(`${figures.arrowRight} ${fileName}`), []);

      log.success(`Changelog:`, ...resultLog);

      log.info(`Pushing new tag to ${chalk.bold('origin')}...`);

      return git(`add ${filesToAdd.join(' ')}`);
    })
    .then(() => {
      var commitMessage = `Bump version to ${packageJson.version}`;

      return git(`commit -m "${commitMessage}"`, gitParseOutput);
    })
    .then(status => {
      log(...status);

      return git(`push origin ${targetBranch}`, gitParseOutput);
    })
    .then(status => {
      log(...status);

      return git(`tag -a -m "Tag version ${packageJson.version}." "v${packageJson.version}"`);
    })
    .then(() => git('git push origin --tags', gitParseOutput))
    .then(status => {
      var publicURL = `${repoURL}/releases/tag/v${packageJson.version}`;

      log(...status);

      log.success(`Release v${packageJson.version} was generated!`);

      log(`Please go to: ${chalk.underline(publicURL)}`, 'to describe the new changes/features added in this release.');

      return opn(publicURL, { wait: false });
    })
    .catch(log.error);
}
42881
function () {
      if (options['offline']) {
        options.drupalDistroRelease = '0.0.0';
      }
      else {
        // Find the latest stable release for the Drupal distro version.
        var done = this.async();
        options.drupalDistro.releaseVersion(options.drupalDistroVersion, done, function(err, version, done) {
          if (err) {
            this.env.error('Could not retrieve distribution project info: ' + err);
            return done(err);
          }
          options.drupalDistroRelease = version;
          done();
        }.bind(this));
      }
    }
841451
def check_stale(package_info, *args):
    
    reason = 'Package not updated in {} days'.format(DAYS_STALE)
    result = False

    now = datetime.utcnow()

    release_urls = args[0]
    if len(release_urls) > 0:
        package_uploaded_time = release_urls[0]['upload_time']
        if now - timedelta(days=DAYS_STALE) <= package_uploaded_time:
            result = True

    return result, reason, NOT_STALE
1004076
def _has_commit(version, debug=False):
    
    if _has_tag(version, debug) or _has_branch(version, debug):
        return False
    cmd = sh.git.bake('cat-file', '-e', version)
    try:
        util.run_command(cmd, debug=debug)
        return True
    except sh.ErrorReturnCode:
        return False
48918
def recent_changes(parent_path=nil, max=100, offset=0)
    log = []
    # this is more gollum proper, but we can't set the path
    # commits = @gollum_wiki.latest_changes(max_count: max)
    ref = @gollum_wiki.ref # probably 'master'
    commits = @gollum_wiki.repo.log(ref, parent_path, {limit: max, offset: offset})
    commits.each do |c|
      c.stats.files.each do |f|
        path = f[0]
        if parent_path && ! path.starts_with?(parent_path)
          # we don't want this one
        elsif File.extname(path) == '.md'
          path.chomp!('.md')
          log << {path: path, commit: c}
        end
      end
    end
    # if we're out of commits, return nil rather than []
    return commits.empty? ? nil : log
  end
54210
def bin_upgrade(self):
        
        packages = self.args[1:]
        options = [
            "-u",
            "--upgradepkg"
        ]
        flag = ""
        flags = [
            "--dry-run",
            "--install-new",
            "--reinstall",
            "--verbose"
        ]
        if len(self.args) > 1 and self.args[0] in options:
            if self.args[1] in flags:
                flag = self.args[1]
                packages = self.args[2:]
            PackageManager(packages).upgrade(flag)
        else:
            usage("")
182020
async function buildUnreleasedPackages() {
	const cwdBefore = process.cwd();
	const unreleasedPackagesSourceFolder = path.resolve(__dirname, '../../packages/');
	const unreleasedPackagesDistFolder = path.resolve(__dirname, '../packages');
	await rimrafAsync(unreleasedPackagesDistFolder);
	await mkdirAsync(unreleasedPackagesDistFolder);
	process.chdir(unreleasedPackagesDistFolder);
	console.log('🎁  Packing current packages');
	await Promise.all(
		fs
			.readdirSync(unreleasedPackagesSourceFolder)
			.filter((packageName) => fs.statSync(path.join(unreleasedPackagesSourceFolder, packageName)).isDirectory())
			.map((packageName) => execAsync(`npm pack "${path.resolve(__dirname, '../../packages/' + packageName)}"`))
	);
	// Remove version number from file name
	await Promise.all(
		fs
			.readdirSync(unreleasedPackagesDistFolder)
			.filter((tarPackageName) => /\.tgz/.test(tarPackageName))
			.map((tarPackageName) =>
				renameAsync(
					path.join(unreleasedPackagesDistFolder, tarPackageName),
					path.join(unreleasedPackagesDistFolder, tarPackageName.replace(/\-\d[^-]+$/, '.tgz'))
				)
			)
	);

	process.chdir(cwdBefore);
}