Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
Formast
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
chrg
Formast
Commits
46ad8cc3
Commit
46ad8cc3
authored
2 years ago
by
s200545
Browse files
Options
Downloads
Patches
Plain Diff
Updated evaluation, and name fixes
parent
50f554a7
No related branches found
No related tags found
No related merge requests found
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
README.md
+1
-1
1 addition, 1 deletion
README.md
eval/evaluation.ipynb
+101
-1256
101 additions, 1256 deletions
eval/evaluation.ipynb
formast/commitdiff.py
+31
-0
31 additions, 0 deletions
formast/commitdiff.py
src/formast/__main__.py
+1
-0
1 addition, 0 deletions
src/formast/__main__.py
with
134 additions
and
1257 deletions
README.md
+
1
−
1
View file @
46ad8cc3
...
...
@@ -16,6 +16,6 @@ How to run:
pdm run regit -vv --repo "C:\Users\boran\OneDrive\DTU\BSc Thesis\babyrepos\onlinebookstore" -o "C:\Users\boran\OneDrive\DTU\BSc Thesis\babyrepos\onlinebookstore_ast10" -p '**\*.java' -m mapping.csv -- formast --writeast --overwrite {}
pdm run python .\formast\commitdif.py -w "C:\Users\boran\OneDrive\DTU\BSc Thesis\babyrepos\onlinebookstore" output_nws.csv
pdm run python .\formast\commitdif
f
.py -w "C:\Users\boran\OneDrive\DTU\BSc Thesis\babyrepos\onlinebookstore" output_nws.csv
```
This diff is collapsed.
Click to expand it.
eval/evaluation.ipynb
+
101
−
1256
View file @
46ad8cc3
This diff is collapsed.
Click to expand it.
formast/commitdiff.py
0 → 100644
+
31
−
0
View file @
46ad8cc3
import
csv
import
git
import
click
from
tqdm
import
tqdm
@click.command
()
@click.argument
(
"
repo
"
)
@click.argument
(
"
output
"
)
@click.option
(
"
-w
"
,
"
--ignore-all-space
"
,
is_flag
=
True
,
help
=
"
Ignore whitespace when comparing the parent commit and the current commit
"
)
def
main
(
repo
,
output
,
ignore_all_space
):
# Open the output CSV file for writing
with
open
(
output
,
"
w
"
)
as
f
:
repo
=
git
.
Repo
(
repo
)
writer
=
csv
.
writer
(
f
)
# Write the header row
writer
.
writerow
([
"
commit_hash
"
,
"
num_additions
"
,
"
num_deletions
"
,
"
filename
"
])
# Loop through the commits and get the diff stats
for
commit
in
tqdm
(
list
(
repo
.
iter_commits
())):
if
len
(
parrent
:
=
commit
.
parents
)
!=
1
:
continue
# Option to ignore-all-space
diff
=
repo
.
git
.
diff
(
parrent
,
commit
,
numstat
=
True
,
ignore_all_space
=
ignore_all_space
)
for
line
in
diff
.
splitlines
():
num_additions
,
num_deletions
,
filename
=
line
.
split
(
"
\t
"
)
writer
.
writerow
([
commit
.
hexsha
,
num_additions
,
num_deletions
,
filename
])
if
__name__
==
"
__main__
"
:
main
()
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/formast/__main__.py
+
1
−
0
View file @
46ad8cc3
...
...
@@ -31,6 +31,7 @@ JAVA_LANGUAGE = Language(str(language_file), 'java')
@click.option
(
"
--overwrite
"
,
is_flag
=
True
,
help
=
"
Overwrite the original .java file with the new content
"
)
@click.option
(
"
-v
"
,
"
--verbose
"
,
count
=
True
,
help
=
"
Increase output verbosity
"
)
@click.argument
(
"
file_path
"
,
type
=
click
.
Path
(
exists
=
True
))
## Formast
def
formast
(
file_path
,
writetoken
,
writeast
,
writerelativeast
,
writecompast
,
overwrite
,
verbose
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment