Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mergiraf to the evaluated tools #380

Merged
merged 30 commits into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
a776ab7
Add mergiraf to the evaluated tools
wetneb Sep 27, 2024
651fb4d
Review and linting suggestions
wetneb Nov 14, 2024
77f9707
Use `--local` for explicitness (even though it's the default)
mernst Nov 14, 2024
4b2708f
Add `mergiraf_plus.sh` that runs Mergiraf then Plume-lib Merging
mernst Nov 14, 2024
bb24ded
mergiraf_absolutepath is a variable that holds a path, not a command …
mernst Nov 14, 2024
aff2668
Merge ../AST-Merging-Evaluation-branch-main into add_mergiraf
mernst Nov 14, 2024
893b590
Updated test results
benedikt-schesch Nov 14, 2024
09e6e70
Added latest results
benedikt-schesch Nov 15, 2024
bb440ff
Add debugging code
benedikt-schesch Nov 15, 2024
67a5cc5
Added more debbuging code
benedikt-schesch Nov 16, 2024
d753b4a
Merge branch 'main' into add_mergiraf
benedikt-schesch Jan 16, 2025
b05f7af
Updated test results
benedikt-schesch Jan 16, 2025
126de8f
Added latest test data
benedikt-schesch Jan 20, 2025
1d00845
Fix in makefile
benedikt-schesch Jan 20, 2025
80428d2
Updated to mergiraf v0.4
benedikt-schesch Jan 20, 2025
6e878d4
Use cargo install instead
benedikt-schesch Jan 21, 2025
1ee924f
Added hash testing in small-test
benedikt-schesch Jan 21, 2025
63f5566
Check Hashes in ci/cd
benedikt-schesch Jan 21, 2025
9c39f11
Show which hashes are missing
benedikt-schesch Jan 21, 2025
0e0e2ec
Show which hashes are missing
benedikt-schesch Jan 21, 2025
072173d
More debugging code
benedikt-schesch Jan 21, 2025
1bea400
Added hashes
benedikt-schesch Jan 21, 2025
ef7d37e
New hashes
benedikt-schesch Jan 22, 2025
6776896
Ignore resolve and intellimerge
benedikt-schesch Jan 22, 2025
cd2ca8a
Mergiraf v0.4.0 results
benedikt-schesch Jan 24, 2025
b7a61b9
New small tests
benedikt-schesch Jan 26, 2025
08a81d9
Added hashes
benedikt-schesch Jan 26, 2025
4cf4de4
Updated results for hiresmerge
benedikt-schesch Jan 27, 2025
c6356a5
Install mergiraf in ci/cd
benedikt-schesch Jan 27, 2025
98de815
Add latest results
benedikt-schesch Jan 27, 2025
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
1 change: 1 addition & 0 deletions src/python/latex_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ def latex_def(name, value) -> str:
"gitmerge_ort_ignorespace",
"git_hires_merge",
"spork",
"mergiraf",
"intellimerge",
"adjacent",
"imports",
Expand Down
1 change: 1 addition & 0 deletions src/python/repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ def clone_repo(repo_slug: str, repo_dir: Path) -> None:
"gitmerge_resolve",
"git_hires_merge",
"spork",
"mergiraf",
"intellimerge",
"adjacent",
"imports",
Expand Down
74 changes: 74 additions & 0 deletions src/scripts/merge_tools/mergiraf.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#!/usr/bin/env bash

# usage: <scriptname> [--verbose] <clone_dir> <branch-1> <branch-2>
# <clone_dir> must contain a clone of a repository.
# Merges branch2 into branch1, in <clone_dir>.
# Return code is 0 for merge success, 1 for merge failure, 2 for script failure.
# For merge failure, also outputs "Conflict" and aborts the merge.

set -o nounset

verbose=
if [ "$1" = "--verbose" ] ; then
# shellcheck disable=SC2034 # unused
verbose="$1"
shift
fi

if [ "$#" -ne 3 ]; then
echo "Usage: $0 [--verbose] CLONE_DIR BRANCH1 BRANCH2" >&2
exit 2
fi

MERGIRAF_VERSION="0.3.0"

SCRIPT_PATH="$(dirname "$0")"; SCRIPT_PATH="$(eval "cd \"$SCRIPT_PATH\" && pwd")"
ROOT_PATH="$(realpath "${SCRIPT_PATH}/../../../")"
mergiraf_relativepath=bin/mergiraf
mergiraf_absolutepath="${ROOT_PATH}/${mergiraf_relativepath}"
mkdir -p ${ROOT_PATH}/bin

if [ ! -e $mergiraf_absolutepath ]; then
ARCH=$(uname -m)
if [[ "$ARCH" == x86_64* ]]; then
ARCH="x86_64"
elif [[ "$ARCH" == i*86 ]]; then
echo "No mergiraf binaries for architecture $ARCH"
exit 2
elif [[ "$ARCH" == arm* ]]; then
ARCH="aarch64"
fi
mernst marked this conversation as resolved.
Show resolved Hide resolved
if [[ $OSTYPE == 'darwin'* ]]; then
VENDOR="apple-darwin"
else
VENDOR="unknown-linux-gnu"
fi
FULL_ARCH="${ARCH}-${VENDOR}"

wget https://codeberg.org/mergiraf/mergiraf/releases/download/v${MERGIRAF_VERSION}/mergiraf_${FULL_ARCH}.tar.gz -O ${ROOT_PATH}/bin/mergiraf.tar.gz
tar -zxf ${ROOT_PATH}/bin/mergiraf.tar.gz -C ${ROOT_PATH}/bin/
rm ${ROOT_PATH}/bin/mergiraf.tar.gz
fi

clone_dir=$1
branch1=$2
branch2=$3

cd "$clone_dir" || { echo "$0: cannot cd to $clone_dir"; exit 2; }

# set up mergiraf driver
git config --global merge.mergiraf.name mergiraf
mernst marked this conversation as resolved.
Show resolved Hide resolved
git config --global merge.mergiraf.driver "${mergiraf_absolutepath} merge --git %O %A %B -s %S -x %X -y %Y -p %P"
$(mergiraf_absolutepath) languages --gitattributes >> .gitattributes

# perform merge
git checkout "$branch1" --force
git merge --no-edit "$branch2"
retVal=$?

# report conflicts
if [ $retVal -ne 0 ]; then
echo "mergiraf.sh: Conflict"
fi

exit $retVal
Loading