Change in osmo-dev[master]: gits: when asking for reset --hard, also offer push -f

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.org
Tue Nov 20 15:51:19 UTC 2018


Neels Hofmeyr has submitted this change and it was merged. ( https://gerrit.osmocom.org/11758 )

Change subject: gits: when asking for reset --hard, also offer push -f
......................................................................

gits: when asking for reset --hard, also offer push -f

Change-Id: Iab38229ee7deaec91c342fa114028e222e652b60
---
M src/gits
1 file changed, 8 insertions(+), 5 deletions(-)

Approvals:
  osmith: Looks good to me, but someone else must approve



diff --git a/src/gits b/src/gits
index c7f5750..d47759f 100755
--- a/src/gits
+++ b/src/gits
@@ -238,16 +238,19 @@
                 return answer
 
 
-def ask_reset_hard(git_dir):
+def ask_reset_hard_or_push_f(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'))
+                   'OK  yes, reset to upstream (write OK in caps!)',
+                   'P   `push -f` to overwrite upstream (P in caps!)',
+                   valid_answers=('', 'OK', 'P'))
 
     if do_reset == 'OK':
         git(git_dir, 'reset', '--hard', upstream_branch)
+    elif do_reset == 'P':
+        git(git_dir, 'push', '-f')
 
 
 def rebase(git_dir):
@@ -287,7 +290,7 @@
 
     # Diverged
     elif ahead and behind:
-        ask_reset_hard(git_dir)
+        ask_reset_hard_or_push_f(git_dir)
 
     # Behind
     elif behind:
@@ -315,7 +318,7 @@
             git(git_dir, 'commit', '-am', 'wip', may_fail=True)
             git(git_dir, 'checkout', orig_branch)
 
-        ask_reset_hard(git_dir)
+        ask_reset_hard_or_push_f(git_dir)
 
     return orig_branch
 

-- 
To view, visit https://gerrit.osmocom.org/11758
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: Iab38229ee7deaec91c342fa114028e222e652b60
Gerrit-Change-Number: 11758
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/c47fbeb4/attachment.htm>


More information about the gerrit-log mailing list