sageserpent-open / kineticMerge

Merge a heavily refactored codebase and stay sane.
MIT License
9 stars 1 forks source link

Add configuration option for `minimumSizeFractionForMotionDetection`. #20

Closed sageserpent-open closed 5 months ago

sageserpent-open commented 5 months ago

This is currently hardwired in Main to 10%.

It needs to be configurable via a command line option, probably in the same manner as the --find-renames, --find-copies and --break-rewrites options used by git diff and git merge.

So a fraction in (0, 1] that can be specified as a two-digit percentage followed by '%', or an integer that is taken to be implicitly preceded by 0. to make it a fraction in the correct range.

sageserpent-open commented 5 months ago

Needs to be reflected when the --help option is passed to the invocation of Kinetic Merge too.

sageserpent-open commented 5 months ago

Added a new command line flag: --match-threshold.

sageserpent-open commented 5 months ago

Manually tested via the debugger for valid values of --match-threshold.

Transcript for error validation:

% kineticMerge/target/kinetic-merge --help
kinetic-merge 0.1.10-SNAPSHOT
Usage: kinetic-merge [options] <their branch to merge into ours>

  --help                   Output this summary.
  --version                Show the version of this command.
  --no-commit              Do not commit a successful merge - leave merged changes staged in the index for review.
  --no-ff                  Prevent fast-forward merge - make a merge commit instead.
  --match-threshold <value>
                           Minimum fraction of a containing file's size for a section of text to qualify for matching.
  <their branch to merge into ours>
Utility to merge another Git branch's changes ('their branch') into the active Git branch in the current working directory ('our branch').
Exits with code 0 on completed successful merge.
Exits with code 1 on completed successful merge.
Exits with code 2 if command line is incorrect.
Exits with code 3 if Git porcelain or the filesystem experiences an error; any changes are rolled back.
% kineticMerge/target/kinetic-merge --match-threshold=200%
Error: Missing argument <their branch to merge into ours>
Error: Match threshold fraction 2.0 should be at least zero and at most one.
Try --help for more information.
% kinetic-merge --match-threshold=-1% 
Error: Match threshold -1% must be a percentage, or digits to the right of the decimal point of a non-negative fraction less than one, or a fraction at least zero and at most one.
Error: Missing argument <their branch to merge into ours>
Try --help for more information.
% kinetic-merge --match-threshold=1.2
Error: Missing argument <their branch to merge into ours>
Error: Match threshold fraction 1.2 should be at least zero and at most one.
Try --help for more information.
% kinetic-merge --match-threshold=-1.2
Error: Match threshold -1.2 must be a percentage, or digits to the right of the decimal point of a non-negative fraction less than one, or a fraction at least zero and at most one.
Error: Missing argument <their branch to merge into ours>
Try --help for more information.
% kinetic-merge --match-threshold=jupilier 
Error: Match threshold jupilier must be a percentage, or digits to the right of the decimal point of a non-negative fraction less than one, or a fraction at least zero and at most one.
Error: Missing argument <their branch to merge into ours>
Try --help for more information.
% kinetic-merge --match-threshold=-0      
Error: Match threshold -0 must be a percentage, or digits to the right of the decimal point of a non-negative fraction less than one, or a fraction at least zero and at most one.
Error: Missing argument <their branch to merge into ours>
Try --help for more information.
% kinetic-merge --match-threshold=-13
Error: Match threshold -13 must be a percentage, or digits to the right of the decimal point of a non-negative fraction less than one, or a fraction at least zero and at most one.
Error: Missing argument <their branch to merge into ours>
Try --help for more information.
sageserpent-open commented 5 months ago

Merged into branch main, Git commit SHA 882bc1f4e2feee8ca892f9298a3ea9a0244ae031.

sageserpent-open commented 5 months ago

This went out in release 0.1.10, Git commit SHA 64fd5448f2f9e6d36953c86345d069d62d1d3a2f.