commits files in the src/ dir as a patch or tarball update
10611
def commit_sources(message, new_tarball)
      from_directory do
        comments = "#{message}\n"
        if new_tarball
          comments << "\ntetra: sources-tarball"
          @git.disable_special_files("src")
        end
        @git.commit_directories(["src"], comments)
      end
    end
402892
def commit_handler(self, cmd):
        """"""
        self.cmd_counts[cmd.name] += 1
        self.committers.add(cmd.committer)
        if cmd.author is not None:
            self.separate_authors_found = True
        for fc in cmd.iter_files():
            self.file_cmd_counts[fc.name] += 1
            if isinstance(fc, commands.FileModifyCommand):
                if fc.mode & 0o111:
                    self.executables_found = True
                if stat.S_ISLNK(fc.mode):
                    self.symlinks_found = True
                if fc.dataref is not None:
                    if fc.dataref[0] == ':':
                        self._track_blob(fc.dataref)
                    else:
                        self.sha_blob_references = True
            elif isinstance(fc, commands.FileRenameCommand):
                self.rename_old_paths.setdefault(cmd.id, set()).add(fc.old_path)
            elif isinstance(fc, commands.FileCopyCommand):
                self.copy_source_paths.setdefault(cmd.id, set()).add(fc.src_path)

        # Track the heads
        parents = self.reftracker.track_heads(cmd)

        # Track the parent counts
        parent_count = len(parents)
        try:
            self.parent_counts[parent_count] += 1
        except KeyError:
            self.parent_counts[parent_count] = 1
            if parent_count > self.max_parent_count:
                self.max_parent_count = parent_count

        # Remember the merges
        if cmd.merges:
            #self.merges.setdefault(cmd.ref, set()).update(cmd.merges)
            for merge in cmd.merges:
                if merge in self.merges:
                    self.merges[merge] += 1
                else:
                    self.merges[merge] = 1
615122
def _patch_file(path, content):
    """"""
    f = open(path)
    existing_content = f.read()
    f.close()
    if existing_content == content:
        # already patched
        log.warn('Already patched.')
        return False
    log.warn('Patching...')
    _rename_path(path)
    f = open(path, 'w')
    try:
        f.write(content)
    finally:
        f.close()
    return True
1157295
def commit(files=[], msg='')
      if files and files.empty? or files.nil? then files = self.svn_repo_working_copy end

      rev = ''
      svn_session(msg) do |svn|
        begin
          rev = svn.commit(files).revision
        #rescue Svn::Error::AuthnNoProvider,
        #       #Svn::Error::WcNotDirectory,
        #       Svn::Error::IllegalTarget,
        #       #Svn::Error::EntryNotFound => e
        #       Exception => e
        rescue Exception => err
          raise RepoAccessError, "Commit Failed: #{err.message}"
        end
      end
      rev
    end
1216887
function commit() {
		console.log( "Adding files to dist..." );
		Release.exec( "git add -A", "Error adding files." );
		Release.exec(
			"git commit -m \"Release " + Release.newVersion + "\"",
			"Error committing files."
		);
		console.log();

		console.log( "Tagging release on dist..." );
		Release.exec( "git tag " + Release.newVersion,
			"Error tagging " + Release.newVersion + " on dist repo." );
		Release.tagTime = Release.exec( "git log -1 --format=\"%ad\"",
			"Error getting tag timestamp." ).trim();
	}
574898
def patch_tree(actions, tree):
    """"""
    patcher = patch.Patcher()
    return patcher.patch(actions, tree)
545427
def commit(self, f):
        ''''''
        if self._overwrite:
            replace_atomic(f.name, self._path)
        else:
            move_atomic(f.name, self._path)
1199724
def patch(self, delta):
        ""
        return self.api.post('path/sync/patch', self.path, delta=delta)
763854
function patch(patchURI, patch, callback) {

  util.patch(patchURI, patch, function(err, res) {
    if (err) {
      callback(err)
    } else {
      callback(null, res)
    }
  })
}
84878
def commit_source_archive(file, message)
      from_directory do
        result_dir = File.join(packages_dir, name)
        FileUtils.mkdir_p(result_dir)

        result_path = File.join(result_dir, File.basename(file))
        FileUtils.cp(file, result_path)
        @git.commit_file(result_path, "Source archive added")

        unarchiver = if file =~ /\.zip$/
                       Tetra::Unzip.new
                     else
                       Tetra::Tar.new
                     end

        Dir.glob(File.join("src", "*")).each { |f| FileUtils.rm_rf(f) }
        unarchiver.decompress(file, "src")
        commit_sources(message, true)
      end
    end
935225
def _submit_changes_to_github_repo(path, url):
    
    try:
        repo = git.Repo(path)
    except Exception:
        raise RuntimeError('Couldn\'t locate a repository at `%s`.' % path)
    commited = False
    try:
        try:
            repo.delete_remote('trytravis')
        except Exception:
            pass
        print('Adding a temporary remote to '
              '`%s`...' % url)
        remote = repo.create_remote('trytravis', url)

        print('Adding all local changes...')
        repo.git.add('--all')
        try:
            print('Committing local changes...')
            timestamp = datetime.datetime.now().isoformat()
            repo.git.commit(m='trytravis-' + timestamp)
            commited = True
        except git.exc.GitCommandError as e:
            if 'nothing to commit' in str(e):
                commited = False
            else:
                raise
        commit = repo.head.commit.hexsha
        committed_at = repo.head.commit.committed_datetime

        print('Pushing to `trytravis` remote...')
        remote.push(force=True)
    finally:
        if commited:
            print('Reverting to old state...')
            repo.git.reset('HEAD^')
        try:
            repo.delete_remote('trytravis')
        except Exception:
            pass
    return commit, committed_at
33855
def update(self):
        """"""
        if not os.path.isdir(os.path.join(self.path)):
            os.makedirs(self.path)
        if not os.path.isdir(os.path.join(self.path, 'refs')):
            subprocess.check_output([
                'git', 'clone', '--bare', self.repo_git, self.path
            ])
        self.run(['gc', '--auto', '--prune=all'])
        self.run(['fetch', '-p', 'origin', '+refs/heads/*:refs/heads/*'])
        # github support
        self.run(['fetch', 'origin', '+refs/pull/*/head:refs/pull/*'])
        # gitlab support
        self.run([
            'fetch', 'origin', '+refs/merge-requests/*/head:refs/pull/*'])
292725
def merge_new_content(new_content, path, comment, kind)
      from_directory do
        log.debug "merging new content to #{path} of kind #{kind}"
        already_existing = File.exist?(path)

        generated_comment = "tetra: generated-#{kind}"
        whole_comment = [comment, generated_comment].join("\n\n")

        if already_existing
          unless @git.latest_id(generated_comment)
            log.debug "committing new file"
            @git.commit_file(path, whole_comment)
          end
          log.debug "moving #{path} to #{path}.tetra_user_edited"
          File.rename(path, "#{path}.tetra_user_edited")
        end

        previous_id = @git.latest_id(generated_comment)

        File.open(path, "w") { |io| io.write(new_content) }
        log.debug "committing new content: #{comment}"
        @git.commit_file(path, whole_comment)

        if already_existing
          # 3-way merge
          conflict_count = @git.merge_with_id(path, "#{path}.tetra_user_edited", previous_id)
          File.delete("#{path}.tetra_user_edited")

          @git.commit_file(path, "User changes merged back") if conflict_count == 0

          return conflict_count
        end
        return 0
      end
    end
898552
static void writePatch(final Patch rollbackPatch, final File file) throws IOException {
        final File parent = file.getParentFile();
        if (!parent.isDirectory()) {
            if (!parent.mkdirs() && !parent.exists()) {
                throw PatchLogger.ROOT_LOGGER.cannotCreateDirectory(file.getAbsolutePath());
            }
        }
        try {
            try (final OutputStream os = new FileOutputStream(file)){
                PatchXml.marshal(os, rollbackPatch);
            }
        } catch (XMLStreamException e) {
            throw new IOException(e);
        }
    }
1096565
function prepareRevision(revision) {
  console.log(`🍳  Preparing ${revision}...`);

  if (revision === LOCAL) {
    return babelBuild(LOCAL_DIR());
  } else {
    if (!fs.existsSync(TEMP_DIR())) {
      fs.mkdirSync(TEMP_DIR());
    }

    const hash = hashForRevision(revision);
    const dir = TEMP_DIR(hash);

    if (!fs.existsSync(dir)) {
      fs.mkdirSync(dir);
      execSync(`git archive "${hash}" | tar -xC "${dir}"`);
      execSync('yarn install', { cwd: dir });
    }
    for (const file of findFiles(LOCAL_DIR('src'), '*/__tests__/*')) {
      const from = LOCAL_DIR('src', file);
      const to = path.join(dir, 'src', file);
      fs.copyFileSync(from, to);
    }
    execSync(
      `cp -R "${LOCAL_DIR()}/src/__fixtures__/" "${dir}/src/__fixtures__/"`
    );

    return babelBuild(dir);
  }
}
1129797
def update_file path, matcher, currentVersion, nextVersion
      temp_path = "#{path}.autoversion"

      begin
        File.open(path) do |source|
          File.open(temp_path, 'w') do |target|
            source.each do |line|
              if matcher.call(line)
                target.write line.gsub currentVersion.to_s, nextVersion.to_s
              else
                target.write line
              end
            end
          end
        end

        File.rename temp_path, path
      ensure
        File.unlink temp_path if File.file? temp_path
      end
    end
367070
protected static function updateBootstrapping()
    {
        copy(__DIR__.'/uikit-stubs/webpack.mix.js', base_path('webpack.mix.js'));
        if (!self::expectsAssetsFolder()) {
            file_put_contents(
                base_path('webpack.mix.js'),
                str_replace(
                    'assets/',
                    '',
                    file_get_contents(base_path('webpack.mix.js'))
                )
            );
        }
        copy(__DIR__.'/uikit-stubs/bootstrap.js', static::getResourcePath('js/bootstrap.js'));
    }