From 3716dc407ebc720b997a7b2f1db4c70ad9b82136 Mon Sep 17 00:00:00 2001 From: petrzpav Date: Mon, 17 Jul 2023 15:50:21 +0200 Subject: [PATCH 1/5] Update changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a1b8915..1fef9bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [Unreleased] + ## [3.0.0-rc.2] - 2023-07-17 ## [3.0.0-rc.1] - 2023-06-13 @@ -95,6 +97,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [1.0.0] - 2016-12-22 +[Unreleased]: https://https://github.com/internetguru/flow/compare/staging...dev [3.0.0-rc.2]: https://github.com/internetguru/flow/releases/tag/v2.2.0 [3.0.0-rc.1]: https://github.com/internetguru/flow/releases/tag/v2.2.0 [2.2.0]: https://github.com/internetguru/flow/compare/v2.1.2...v2.2.0 From 2999c0d842126552e1c360ae7757e96b697ed627 Mon Sep 17 00:00:00 2001 From: George Date: Tue, 7 Nov 2023 11:07:38 -0500 Subject: [PATCH 2/5] Consolidate push/pull and show their output --- flow | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/flow b/flow index 65c4a85..5b37fc0 100755 --- a/flow +++ b/flow @@ -314,7 +314,7 @@ main() { [[ ${CONFORM} == 0 ]] \ && err "Local branch '${1}' is behind remote." 3 confirm "Merge branch '${1}' with its remote?" - update_branch "${1}" + git fetch --update-head-ok "${ORIGIN}" "${1}:${1}" } create_branch() { @@ -1106,19 +1106,14 @@ main() { git_checkout "${BCHD}" } - update_branch() { - git_fetch "${ORIGIN}" "${1}:${1}" - } - flow_pull() { validate_git_remote confirm '* Pull all remote branches?' msg_start 'Pulling branches' local gcb gcb=$(current_branch) - git_fetch --all - git_fetch --tags - git_fetch "${ORIGIN}" --prune + git fetch --update-head-ok --all --prune + git fetch --tags for branch in $(git_branch_format -r | grep "^${ORIGIN}" | flow_sed "s/^${ORIGIN}\///"); do [[ "${branch}" == HEAD ]] \ && continue @@ -1135,8 +1130,8 @@ main() { validate_git_remote confirm '* Push all branches to the remote repository?' msg_start 'Pushing all branches and tags' - git_push "${ORIGIN}" --all - git_push "${ORIGIN}" --tags + git push "${ORIGIN}" --all + git push "${ORIGIN}" --tags msg_done } @@ -1144,8 +1139,8 @@ main() { validate_git_remote local gcb gcb=$(current_branch) - git_push "${ORIGIN}" "${1}" - git_push "${ORIGIN}" "${gcb}" + git push "${ORIGIN}" "${1}" + git push "${ORIGIN}" "${gcb}" request_url_fromto "${gcb}" "${1}" } From af33992f3ba4397c8300029210b22fd79b57849b Mon Sep 17 00:00:00 2001 From: petrzpav Date: Thu, 19 Sep 2024 13:34:35 +0200 Subject: [PATCH 3/5] Do not automatically merge conflicts --- CHANGELOG.md | 7 ++++++- flow | 11 ++++++++--- flow.1.rst | 11 ++++++----- test/test.butt | 21 +++++++++++++++++++++ 4 files changed, 41 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ceef99c..a4c346d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] +### Changed + +- Do not automatically merge conflicts. +- Consolidate pull and push and their outputs. + ## [3.0.11] - 2023-10-06 ### Fixed @@ -110,7 +115,7 @@ _Stable release based on [3.0.0-rc.2]._ ## [2.2.0] - 2017-06-05 ### Changed - Increment minor version when release is created #31 - + ### Fixed - Initialization checks only local branches #73 - `omgf pull` updates only local branches with remote branch #59 diff --git a/flow b/flow index 5b37fc0..aa83ff3 100755 --- a/flow +++ b/flow @@ -152,6 +152,11 @@ main() { || err "${out}" } + git_reset() { + local out + out="$(git reset "${@}" 2>&1)" + } + git_log() { local out out="$(git log "${@}" 2>&1)" \ @@ -243,7 +248,7 @@ main() { git_merge() { local out out="$(env GIT_EDITOR=: git merge "${@}" 2>&1)" \ - || err "${out}" + || err "${out}" 7 } git_show() { @@ -387,10 +392,10 @@ main() { && return git_merge_nocommit "${1}" # hard reset version file regardless of a conflict - git reset -q "${VERSION}" + git_reset -q "${VERSION}" git_checkout "${VERSION}" flow_sed -i '/^<<<<<<< /d;0,/^=======$/s///;/^=======$/d;/^>>>>>>> /d' "${CHANGELOG}" - git_add . + git_add "${CHANGELOG}" "${VERSION}" git_merge --continue } diff --git a/flow.1.rst b/flow.1.rst index 2c7dcec..b7b657d 100644 --- a/flow.1.rst +++ b/flow.1.rst @@ -76,14 +76,15 @@ EXIT CODES 2 Parse or invalid option error. 3 - Git is not conform with the branching model (fixable). + Nonconforming, fixable with --conform / --init. 4 - Git is not conform with the branching model (unfixable). + Nonconforming, cannot be fixed automatically. 5 - Git status is not empty AKA uncommitted changes. + Uncommitted changes. 6 - Nothing to do (e. g. empty merge). - + Nothing to do, e. g. empty merge. +7 + Unexpected merge conflicts. REPOSITORY ========== diff --git a/test/test.butt b/test/test.butt index df36283..c1cea39 100755 --- a/test/test.butt +++ b/test/test.butt @@ -762,3 +762,24 @@ start "merge hotfix with unmerged staging" debug "flow -n" assert_equal "${status}" 0 end +####################################### +: $((i++)) +start "merge staging into dev with conflicts" + take "${i}" + { + flow -iy \ + && flow --yes \ + && git checkout dev \ + && echo "dev content" > a \ + && git add a \ + && git commit -m "Update file 'a' in dev" \ + && git checkout staging \ + && echo "staging content" > a \ + && git add a \ + && git commit -m "Update file 'a' in staging" \ + && git checkout dev + } >/dev/null 2>&1 + debug "flow --yes --conform" + assert_equal "${status}" 7 + assert_equal "${errlines[0]}" "flow: error: Committing is not possible because you have unmerged files." +end From 046a38f03431ee7010d3e8232958c5303248ff1b Mon Sep 17 00:00:00 2001 From: petrzpav Date: Thu, 19 Sep 2024 13:34:38 +0200 Subject: [PATCH 4/5] Update changelog --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a4c346d..cd18da4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). -## [Unreleased] +## [3.1.0-rc.1] - 2024-09-19 ### Changed @@ -172,7 +172,7 @@ _Stable release based on [3.0.0-rc.2]._ ## [1.0.0] - 2016-12-22 -[Unreleased]: https://https://github.com/internetguru/flow/compare/staging...dev +[3.1.0-rc.1]: https://github.com/internetguru/flow/releases/tag/v3.0.11 [3.0.11]: https://https://github.com/internetguru/flow/compare/v3.0.10...v3.0.11 [3.0.10]: https://https://github.com/internetguru/flow/compare/v3.0.9...3.0.10 [3.0.9]: https://https://github.com/internetguru/flow/compare/v3.0.8...v3.0.9 From 8d74699c15cbb257a28108f36ddc97baee47ec20 Mon Sep 17 00:00:00 2001 From: petrzpav Date: Thu, 19 Sep 2024 13:34:41 +0200 Subject: [PATCH 5/5] Update changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cd18da4..ed95bf2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [3.1.0] - 2024-09-19 + +_Stable release based on [3.1.0-rc.1]._ + ## [3.1.0-rc.1] - 2024-09-19 ### Changed @@ -172,6 +176,7 @@ _Stable release based on [3.0.0-rc.2]._ ## [1.0.0] - 2016-12-22 +[3.1.0]: https://https://github.com/internetguru/flow/compare/v3.0.11...v3.1.0 [3.1.0-rc.1]: https://github.com/internetguru/flow/releases/tag/v3.0.11 [3.0.11]: https://https://github.com/internetguru/flow/compare/v3.0.10...v3.0.11 [3.0.10]: https://https://github.com/internetguru/flow/compare/v3.0.9...3.0.10