Merge all the commits for the user.

        Aggregate line counts, and use the most recent commit (by date/time)
        as the representative commit for the user.
421049
def merge_user_commits(cls, commits):
        
        user = None
        for commit in commits:
            if not user:
                user = commit
            else:
                if commit.committer_time > user.committer_time:
                    commit.line_count += user.line_count
                    user = commit
                else:
                    user.line_count += commit.line_count
        return user
1264313
public void applyLogEntries() {
        // Reject logs we've applied already
        long commitIndex = state.commitIndex();
        long lastApplied = state.lastApplied();

        if (commitIndex == lastApplied) {
            return;
        }

        // If commitIndex > lastApplied: increment lastApplied, apply log[lastApplied] to state machine (§5.3)
        assert commitIndex > lastApplied
                : "commit index: " + commitIndex + " cannot be smaller than last applied: " + lastApplied;

        // Apply all the preceding logs
        RaftLog raftLog = state.log();
        for (long idx = state.lastApplied() + 1; idx <= commitIndex; idx++) {
            LogEntry entry = raftLog.getLogEntry(idx);
            if (entry == null) {
                String msg = "Failed to get log entry at index: " + idx;
                logger.severe(msg);
                throw new AssertionError(msg);
            }

            applyLogEntry(entry);

            // Update the lastApplied index
            state.lastApplied(idx);
        }

        assert status != TERMINATED || commitIndex == raftLog.lastLogOrSnapshotIndex()
                : "commit index: " + commitIndex + " must be equal to " + raftLog.lastLogOrSnapshotIndex() + " on termination.";

        if (state.role() == LEADER || state.role() == FOLLOWER) {
            takeSnapshotIfCommitIndexAdvanced();
        }
    }
110807
@Override
	public void commit() throws TransactionManagementException {
		logger.entering(CLASSNAME, "commit");
		try {
			userTran.commit();
			logger.log(Level.FINE, "javax.transaction.Status: {0}", userTran.getStatus());
		} catch (SecurityException e) {
			throw new TransactionManagementException(e);
		} catch (IllegalStateException e) {
			throw new TransactionManagementException(e);
		} catch (RollbackException e) {
			throw new TransactionManagementException(e);
		} catch (HeuristicMixedException e) {
			throw new TransactionManagementException(e);
		} catch (HeuristicRollbackException e) {
			throw new TransactionManagementException(e);
		} catch (SystemException e) {
			throw new TransactionManagementException(e);
		}
		logger.exiting(CLASSNAME, "commit");
	}
125436
def do_commit_amends(self):
        
        commit_cumalative_count = 0
        for days in MARKED_DAYS:
            amend_date = (
                self.end_date - datetime.timedelta(days)).strftime("%Y-%m-%d %H:%M:%S")
            for commit_number_in_a_day in xrange(0, self.max_commits):
                commit_cumalative_count += 1
                subprocess.check_call(
                    ['git', 'commit', '--amend', "--date='<" + amend_date + " + 0530 >' ", '-C',
                     'HEAD~{commit_number}'.format(commit_number=commit_cumalative_count)], cwd=self.repository_name)
                subprocess.check_call(
                    ['git', 'pull', '--no-edit'], cwd=self.repository_name)
                subprocess.check_call(
                    ['git', 'push', 'origin', 'master'], cwd=self.repository_name)
231992
def merge_base(commit1, commit2, *other_commits)
      Open3.popen2("git", "merge-base", commit1, commit2, *other_commits) { |_stdin, stdout, _wait_thr| stdout.read.rstrip }
    end
1265073
def _commit(self, ref):
        ''
        path_times = self._weakref_path_map[ref]
        path_times.append(nanotime())
        del self._weakref_path_map[ref]
        path = tuple(path_times[1::2])
        times = path_times[::2]
        if path not in self.path_stats:
            # tuple to save a tiny bit of memory
            self.path_stats[path] = tuple([
                Duration(interval=False) for i in range(len(path))])
        path_stats = self.path_stats[path]
        for i in range(1, len(times)):
            path_stats[i - 1]._stats.add(times[i] - times[i - 1])
466290
def aggregate(self):
        
        logger.info('Start aggregation of %s', self.cwd)
        target_dir = self.cwd

        is_new = not os.path.exists(target_dir)
        if is_new:
            self.init_repository(target_dir)

        self._switch_to_branch(self.target['branch'])
        for r in self.remotes:
            self._set_remote(**r)
        self.fetch()
        merges = self.merges
        if not is_new:
            # reset to the first merge
            origin = merges[0]
            merges = merges[1:]
            self._reset_to(origin["remote"], origin["ref"])
        for merge in merges:
            self._merge(merge)
        self._execute_shell_command_after()
        logger.info('End aggregation of %s', self.cwd)
425202
public void commit() throws HandlerException {
        if (_isInitiator) {
            try {
                _userTx.commit();
            } catch (SystemException se) {
                throw CommonKnowledgeMessages.MESSAGES.userTransactionCommitFailedSystem(se);
            } catch (HeuristicRollbackException hre) {
                throw CommonKnowledgeMessages.MESSAGES.userTransactionCommitFailedRollback(hre);
            } catch (HeuristicMixedException hme) {
                throw CommonKnowledgeMessages.MESSAGES.userTransactionCommitFailedMixed(hme);
            } catch (RollbackException re) {
                throw CommonKnowledgeMessages.MESSAGES.userTransactionCommitFailed(re);
            }
        }
    }
513067
def users_me_merge(self, data, **kwargs):
        ""
        api_path = "/api/v2/users/me/merge.json"
        return self.call(api_path, method="PUT", data=data, **kwargs)
1128489
@Override
    public void commit()
    {
        if (!getRollbackOnly())
        {
            onTransaction(TxAction.COMMIT);
            ((EntityManagerImpl) entityManager).getPersistenceDelegator().commit();
        }
    }
605337
function(aggregate, vm, callback) {
                vm.set(aggregate.toJSON());
                self.commit(vm, function(err) {
                    callback(err, aggregate, cmd);
                });
            }
796838
def commit(self):
        
        self._check_thread()
        if self.state != _STATE_ACTIVE:
            raise TransactionError("Transaction is not active.")
        try:
            self._check_timeout()
            request = transaction_commit_codec.encode_request(self.id, self.thread_id)
            self.client.invoker.invoke_on_connection(request, self.connection).result()
            self.state = _STATE_COMMITTED
        except:
            self.state = _STATE_PARTIAL_COMMIT
            raise
        finally:
            self._locals.transaction_exists = False
1040295
def update(self, commit=True, **kwargs):
        

        for (attr, value) in kwargs.iteritems():
            setattr(self, attr, value)
        return commit and self.save() or self
339376
def commit():
    

    session_token = request.headers['session_token']
    repository    = request.headers['repository']

    #===
    current_user = have_authenticated_user(request.environ['REMOTE_ADDR'], repository, session_token)
    if current_user is False: return fail(user_auth_fail_msg)

    #===
    repository_path = config['repositories'][repository]['path']

    def with_exclusive_lock():
        if not varify_user_lock(repository_path, session_token): return fail(lock_fail_msg)

        #===
        data_store = versioned_storage(repository_path)
        if not data_store.have_active_commit(): return fail(no_active_commit_msg)

        result = {}
        if request.headers['mode'] == 'commit':
            new_head = data_store.commit(request.headers['commit_message'], current_user['username'])
            result = {'head' : new_head}
        else:
            data_store.rollback()

        # Release the user lock
        update_user_lock(repository_path, None)
        return success(result)
    return lock_access(repository_path, with_exclusive_lock)
669851
public final void commit() {
        ensureNotYetCreated();
        ensureHasChanges();
        alreadyCreated = true;
        area.replaceMulti(Collections.unmodifiableList(list));
    }
642135
def commit(self):
        

        if not self._parent._is_active:
            raise exc.InvalidRequestError("This transaction is inactive")
        yield from self._do_commit()
        self._is_active = False
823736
private int processCommits(GitHubRepo repo) {
        int count = 0;
        Long existingCount = commitRepository.countCommitsByCollectorItemId(repo.getId());
        if (existingCount == 0) {
            List<Commit> newCommits = gitHubClient.getCommits();
            newCommits.forEach(c -> c.setCollectorItemId(repo.getId()));
            Iterable<Commit> saved = commitRepository.save(newCommits);
            count = saved != null ? Lists.newArrayList(saved).size() : 0;
        } else {
            Collection<Commit> nonDupCommits = gitHubClient.getCommits().stream()
                    .<Map<String, Commit>> collect(HashMap::new,(m,c)->m.put(c.getScmRevisionNumber(), c), Map::putAll)
                    .values();
            for (Commit commit : nonDupCommits) {
                LOG.debug(commit.getTimestamp() + ":::" + commit.getScmCommitLog());
                if (isNewCommit(repo, commit)) {
                    commit.setCollectorItemId(repo.getId());
                    commitRepository.save(commit);
                    count++;
                }
            }
        }
        LOG.info("-- Saved Commits = " + count);
        return count;
    }