src/vs/workbench/services/workingCopy/common/workingCopyHistoryService.ts/WorkingCopyHistoryModel/addEntry
class WorkingCopyHistoryModel:	async addEntry(source = WorkingCopyHistoryModel.FILE_SAVED_SOURCE, timestamp = Date.now(), token: CancellationToken): Promise<IWorkingCopyHistoryEntry> {
		let entryToReplace: IWorkingCopyHistoryEntry | undefined = undefined;

		// Figure out if the last entry should be replaced based
		// on settings that can define a interval for when an
		// entry is not added as new entry but should replace.
		// However, when save source is different, never replace.
		const lastEntry = lastOrDefault(this.entries);
		if (lastEntry && lastEntry.source === source) {
			const configuredReplaceInterval = this.configurationService.getValue<number>(WorkingCopyHistoryModel.SETTINGS.MERGE_PERIOD, { resource: this.workingCopyResource });
			if (timestamp - lastEntry.timestamp <= (configuredReplaceInterval * 1000 /* convert to millies */)) {
				entryToReplace = lastEntry;
			}
		}

		let entry: IWorkingCopyHistoryEntry;

		// Replace lastest entry in history
		if (entryToReplace) {
			entry = await this.doReplaceEntry(entryToReplace, timestamp, token);
		}

		// Add entry to history
		else {
			entry = await this.doAddEntry(source, timestamp, token);
		}

		// Flush now if configured
		if (this.options.flushOnChange && !token.isCancellationRequested) {
			await this.store(token);
		}

		return entry;
	}