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 <[email protected]>

Reply via email to