* Add ConflictedFile to git-helpers.ps1, add git-helpers.tests.ps1 to exercise basic functionality. * Add `resolve-asset-conflict.ps1` a script that can autoresolve an assets.json file. --------- Co-authored-by: Scott Beddall (from Dev Box) <scbedd@microsoft.com> Co-authored-by: Scott Beddall <45376673+scbedd@users.noreply.github.com> Co-authored-by: Ben Broderick Phillips <bebroder@microsoft.com> |
||
|---|---|---|
| .. | ||
| README.md | ||
| resolve-asset-conflict.ps1 | ||
Merge Proxy Tags Script
This script is intended to allow easy resolution of a conflicting assets.json file.
In most cases where two branches X and Y have progressed alongside each other, a simple
git checkout X && git merge Y can successfully merge other than the assets.json file.
That often will end up looking like this:
{
"AssetsRepo": "Azure/azure-sdk-assets-integration",
"AssetsRepoPrefixPath": "python",
"TagPrefix": "python/storage/azure-storage-blob",
<<<<<<< HEAD
"Tag": "integration/example/storage_feature_addition2"
=======
"Tag": "integration/example/storage_feature_addition1"
>>>>>>> test-storage-tag-combination
}
This script uses git to tease out the source and target tags, then merge the incoming tag into the recordings of the base tag.
This script should only be used on an already conflicted assets.json file. Otherwise, no action will be executed.
Usage
PreReqs
- Must have []
pshell 6+](https://learn.microsoft.com/powershell/scripting/install/installing-powershell-on-windows) - Must have
gitavailable on your PATH - Must have the
test-proxyavailable on your PATHtest-proxyis honored when the proxy is installed as adotnet toolAzure.Sdk.Tools.TestProxyis honored when the standalone executable is on your PATH- Defaults to
dotnet toolif both are present on the PATH.
Call the script
For simplicity when resolving merge-conflicts, invoke the script from the root of the repo. The help instructions from merge-asset-tags use paths relative from repo root.
# including context to get into a merge conflict
cd "path/to/language/repo/root"
git checkout base-branch
git merge target-branch
# auto resolve / merge conflicting tag values
./eng/common/testproxy/scripts/resolve-asset-conflict/resolve-asset-conflict.ps1 sdk/storage/azure-storage-blob/assets.json
# user pushes
test-proxy push -a sdk/storage/azure-storage-blob/assets.json
Resolving conflicts
When an assets.json merge has conflicts on the test recordings side, the merge-proxy-tags script will exit with an error describing how to re-invoke the merge-proxy-tags script AFTER you resolve the conflicts.
cdinto the assets location output by the script- resolve the conflict or conflicts
- add the resolution, and invoke
git cherry-pick --continue
Afterwards, re-invoke the merge-proxy-tags script with arguments given to you in original error. This will leave the assets in a touched state that can be test-proxy push-ed.