python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtpython3 lh-diff/lh-diff.pyOutput goes to output/ as XML files.
├── lh-diff/
│ └── lh-diff.py # LHDiff implementation
├── datasets/
│ └── provided/ # Test dataset + ground truth
│ └── new/ # Our dataset
│ └── custom/ # add new dataset here...
├── output/ # Generated XML mappings
└── requirements.txt
In lh-diff.py:
| Variable | Default | Description |
|---|---|---|
alpha |
0.6 | Weight: content (higher) vs context (lower) |
threshold |
0.6 | Minimum similarity to match |
k |
15 | SimHash candidates per line |
window |
4 | Context lines for similarity |
-
Add files to
datasets/your_dataset/asName_1.java,Name_2.java, etc. -
In
lh-diff.py, add your dataset config:
custom_path = "./datasets/your_dataset/"
custom_files = ["Name1", "Name2", ...]
custom_dataset = [
(i + 1, f, sorted(glob.glob(f"{custom_path}{f}_*")))
for i, f in enumerate(custom_files)
]- Set
selected_dataset = custom_dataset
Uses the SZZ algorithm to identify which commits introduced bugs that were later fixed.
python3 bonus/bonus.py /path/to/git/repo- Scans commit messages for bug-fix patterns (
fix,bug,closes #, etc.) - Shows recent fix commits and lets you choose one
- Uses
git blameto trace deleted/modified lines back to their original commit - Reports which commits introduced the buggy code