Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion launchable/commands/record/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def list_sources() -> List[Workspace]:
def collect_commits():
if not no_commit_collection:
for w in ws:
ctx.invoke(commit, source=w.dir, max_days=max_days, scrub_pii=scrub_pii)
ctx.invoke(commit, name=w.name, source=w.dir, max_days=max_days)
else:
click.echo(click.style(
"Warning: Commit collection is turned off. The commit data must be collected separately.",
Expand Down
14 changes: 10 additions & 4 deletions launchable/commands/record/commit.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@


@click.command()
@click.option(
'--name',
help="repository name",
)
@click.option(
'--source',
help="repository path",
Expand Down Expand Up @@ -51,7 +55,7 @@
resolve_path=True, allow_dash=True),
)
@click.pass_context
def commit(ctx, source: str, executable: bool, max_days: int, scrub_pii: bool, import_git_log_output: str):
def commit(ctx, name: str, source: str, executable: bool, max_days: int, scrub_pii: bool, import_git_log_output: str):
if executable == 'docker':
sys.exit("--executable docker is no longer supported")

Expand Down Expand Up @@ -80,8 +84,10 @@ def commit(ctx, source: str, executable: bool, max_days: int, scrub_pii: bool, i
client.print_exception_and_recover(e)

cwd = os.path.abspath(source)
if not name:
name = os.path.basename(cwd)
try:
exec_jar(cwd, max_days, ctx.obj, is_collect_message, is_collect_files)
exec_jar(name, cwd, max_days, ctx.obj, is_collect_message, is_collect_files)
except Exception as e:
if os.getenv(REPORT_ERROR_KEY):
raise e
Expand All @@ -91,7 +97,7 @@ def commit(ctx, source: str, executable: bool, max_days: int, scrub_pii: bool, i
"If not, please set a directory use by --source option.\nerror: {}".format(cwd, e))


def exec_jar(source: str, max_days: int, app: Application, is_collect_message: bool, is_collect_files: bool):
def exec_jar(name: str, source: str, max_days: int, app: Application, is_collect_message: bool, is_collect_files: bool):
java = get_java_command()

if not java:
Expand All @@ -106,7 +112,6 @@ def exec_jar(source: str, max_days: int, app: Application, is_collect_message: b
command.extend([
"-jar",
cygpath(jar_file_path),
"ingest:commit",
"-endpoint",
"{}/intake/".format(base_url),
"-max-days",
Expand All @@ -126,6 +131,7 @@ def exec_jar(source: str, max_days: int, app: Application, is_collect_message: b
command.append("-files")
if os.getenv(COMMIT_TIMEOUT):
command.append("-enable-timeout")
command.append(name)
command.append(cygpath(source))

subprocess.run(
Expand Down
Loading