@cli.command(cls=AliasedCommand, aliases=['<STR_LIT>'], short_help="<STR_LIT>")<EOL>@click.option('<STR_LIT>', '<STR_LIT>', '<STR_LIT:f>',<EOL>type=click.Path(exists=True, dir_okay=False),<EOL>help="<STR_LIT>")<EOL>@click.option('<STR_LIT>', '<STR_LIT>', '<STR_LIT>', is_flag=True,<EOL>help="<STR_LIT>")<EOL>@date_options<EOL>@click.pass_context<EOL>def commit(ctx, f, force_yes, date):
timesheet_collection = get_timesheet_collection_for_context(ctx, f)<EOL>if not date and not force_yes:<EOL><INDENT>non_workday_entries = timesheet_collection.entries.filter(ignored=False, pushed=False, current_workday=False)<EOL>if non_workday_entries:<EOL><INDENT>if not ctx.obj['<STR_LIT>'].confirm_commit_entries(non_workday_entries):<EOL><INDENT>ctx.obj['<STR_LIT>'].msg("<STR_LIT>")<EOL>return<EOL><DEDENT><DEDENT><DEDENT>ctx.obj['<STR_LIT>'].pushing_entries()<EOL>backends_entries = defaultdict(list)<EOL>try:<EOL><INDENT>for timesheet in timesheet_collection.timesheets:<EOL><INDENT>entries_to_push = get_entries_to_push(<EOL>timesheet, date, ctx.obj['<STR_LIT>']['<STR_LIT>']<EOL>)<EOL>for (entries_date, entries) in entries_to_push.items():<EOL><INDENT>for entry in entries:<EOL><INDENT>backend_name = aliases_database[entry.alias].backend<EOL>backend = plugins_registry.get_backend(backend_name)<EOL>backends_entries[backend].append(entry)<EOL>try:<EOL><INDENT>additional_info = backend.push_entry(entries_date, entry)<EOL><DEDENT>except KeyboardInterrupt:<EOL><INDENT>entry.push_error = ("<STR_LIT>"<EOL>"<STR_LIT>")<EOL>raise<EOL><DEDENT>except Exception as e:<EOL><INDENT>additional_info = None<EOL>entry.push_error = six.text_type(e)<EOL><DEDENT>else:<EOL><INDENT>entry.push_error = None<EOL><DEDENT>finally:<EOL><INDENT>ctx.obj['<STR_LIT>'].pushed_entry(entry, additional_info)<EOL><DEDENT><DEDENT><DEDENT><DEDENT>backends_post_push(backends_entries)<EOL><DEDENT>except KeyboardInterrupt:<EOL><INDENT>pass<EOL><DEDENT>finally:<EOL><INDENT>comment_timesheets_entries(timesheet_collection, date)<EOL><DEDENT>ignored_entries = timesheet_collection.entries.filter(date=date, ignored=True, unmapped=False, pushed=False)<EOL>ignored_entries_list = []<EOL>for (entries_date, entries) in six.iteritems(ignored_entries):<EOL><INDENT>ignored_entries_list.extend(entries)<EOL><DEDENT>all_entries = itertools.chain(*backends_entries.values())<EOL>ctx.obj['<STR_LIT>'].pushed_entries_summary(list(all_entries),<EOL>ignored_entries_list)<EOL>
Commits your work to the server. The [date] option can be used either as a
single date (eg. 20.01.2014), as a range (eg. 20.01.2014-22.01.2014), or as
a range with one of the dates omitted (eg. -22.01.2014).