<commit_before>Meteor.Repo = {}

Meteor.SetRepo = (name) ->
	repo = Meteor.Repos.findOne {name: name}
	repo = {name: name} if not repo

	# list of commits
	repo.commits = new Meteor.Utils.ItemList 'commits', [name]

	# id of selected commit
	repo.selected_commit = new ReactiveProperty null

	# list of diffs for selected commit
	diff_args =  ->
		id = repo.selected_commit.get()
		return [] if not id
		[name, id]
	diffs = new Meteor.Utils.ItemList 'diffs', diff_args, {polling: false}

	repo.diffs = ->
		id = repo.selected_commit.get()
		if id then diffs.fetch() else repo.changes.fetch()

	repo.select_commit = (id) ->
		repo.selected_commit.set id
		diffs.update()

	# list of recent changes
	repo.changes = new Meteor.Utils.ItemList 'changes', [name]
	repo.show_changes = ->
		repo.selected_commit.set null

	repo.commit = (opts, cb) ->
		Meteor.call 'commit', name, opts, (err) ->
			return cb(err) if err
			repo.selected_commit.set null
			repo.changes.update()<commit_msg>'update history on commit (issue #3)'<commit_after>Meteor.Repo = {}

Meteor.SetRepo = (name) ->
	repo = Meteor.Repos.findOne {name: name}
	repo = {name: name} if not repo

	# list of commits
	repo.commits = new Meteor.Utils.ItemList 'commits', [name]

	# id of selected commit
	repo.selected_commit = new ReactiveProperty null

	# list of diffs for selected commit
	diff_args =  ->
		id = repo.selected_commit.get()
		return [] if not id
		[name, id]
	diffs = new Meteor.Utils.ItemList 'diffs', diff_args, {polling: false}

	repo.diffs = ->
		id = repo.selected_commit.get()
		if id then diffs.fetch() else repo.changes.fetch()

	repo.select_commit = (id) ->
		repo.selected_commit.set id
		diffs.update()

	# list of recent changes
	repo.changes = new Meteor.Utils.ItemList 'changes', [name]
	repo.show_changes = ->
		repo.selected_commit.set null

	repo.commit = (opts, cb) ->
		Meteor.call 'commit', name, opts, (err) ->
			return cb(err) if err
			repo.selected_commit.set null
			repo.changes.update()
			repo.commits.update()
{'fraction_non_alphanumeric': 0.13164431197218082, 'fraction_numerical': 0.0004967709885742673, 'mean_word_length': 3.640552995391705, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6513049', 'n_tokens_mistral': 764, 'n_tokens_neox': 705, 'n_words': 189}