This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Neels Hofmeyr gerrit-no-reply at lists.osmocom.orgNeels Hofmeyr has submitted this change and it was merged. ( https://gerrit.osmocom.org/11757 ) Change subject: gits: remove code dup: ask_reset_hard() ...................................................................... gits: remove code dup: ask_reset_hard() Change-Id: I741aa6ca29370f26a724f5b4b9c6e7f8ac3f282a --- M src/gits 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/src/gits b/src/gits index 95b722e..c7f5750 100755 --- a/src/gits +++ b/src/gits @@ -238,6 +238,18 @@ return answer +def ask_reset_hard(git_dir): + do_reset = ask(git_dir, 'Diverged.', + '%s: git reset --hard %s?' % ( + orig_branch, upstream_branch), + '<empty> no', + 'OK yes (write OK in caps!)', + valid_answers=('', 'OK')) + + if do_reset == 'OK': + git(git_dir, 'reset', '--hard', upstream_branch) + + def rebase(git_dir): orig_branch = git_branch_current(git_dir) if orig_branch is None: @@ -275,15 +287,7 @@ # Diverged elif ahead and behind: - do_reset = ask(git_dir, 'Diverged.', - '%s: git reset --hard %s?' % ( - orig_branch, upstream_branch), - '<empty> no', - 'OK yes (write OK in caps!)', - valid_answers=('', 'OK')) - - if do_reset == 'OK': - git(git_dir, 'reset', '--hard', upstream_branch) + ask_reset_hard(git_dir) # Behind elif behind: @@ -311,13 +315,7 @@ git(git_dir, 'commit', '-am', 'wip', may_fail=True) git(git_dir, 'checkout', orig_branch) - do_reset = ask(git_dir, '%s: git reset --hard %s?' % (orig_branch, upstream_branch), - '<empty> no', - 'OK yes (write OK in caps!)', - valid_answers=('', 'OK')) - - if do_reset == 'OK': - git(git_dir, 'reset', '--hard', upstream_branch) + ask_reset_hard(git_dir) return orig_branch -- To view, visit https://gerrit.osmocom.org/11757 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-dev Gerrit-Branch: master Gerrit-MessageType: merged Gerrit-Change-Id: I741aa6ca29370f26a724f5b4b9c6e7f8ac3f282a Gerrit-Change-Number: 11757 Gerrit-PatchSet: 5 Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de> Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de> Gerrit-Reviewer: osmith <osmith at sysmocom.de> -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181120/145cdae9/attachment.htm>