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
Mon Nov 12 22:35:53 UTC 2018


Neels Hofmeyr has uploaded this change for review. ( 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(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-dev refs/changes/58/11758/1

diff --git a/src/gits b/src/gits
index bd3e3f2..2c25129 100755
--- a/src/gits
+++ b/src/gits
@@ -270,16 +270,19 @@
             raise SkipThisRepo()
 
 
-    def ask_reset_hard():
+    def ask_reset_hard_or_push_f():
         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')
 
 
     # Missing upstream branch
@@ -288,7 +291,7 @@
 
     # Diverged
     elif ahead and behind:
-        ask_reset_hard()
+        ask_reset_hard_or_push_f()
 
     # Behind
     elif behind:
@@ -316,7 +319,7 @@
             git(git_dir, 'commit', '-am', 'wip', may_fail=True)
             git(git_dir, 'checkout', orig_branch)
 
-        ask_reset_hard()
+        ask_reset_hard_or_push_f()
 
     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: newchange
Gerrit-Change-Id: Iab38229ee7deaec91c342fa114028e222e652b60
Gerrit-Change-Number: 11758
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181112/283adc4a/attachment.htm>


More information about the gerrit-log mailing list