Commit Graph

23 Commits (f1fab926ed0aa51339d8e168322d0f93624d7764)

Author SHA1 Message Date
Neels Hofmeyr f486870137 src/ maxdepth 2 2021-06-22 00:37:05 +02:00
Neels Hofmeyr 0a5ccc45d8 gits fu
Change-Id: I453c6644be4d6fc6032b162216b8c3a25854c26a
2020-09-25 05:17:55 +02:00
Neels Hofmeyr 67e53d9d7f gits: proper rebase dialog
Change-Id: I3d399f38db583df990d6f6da858fc2e199639cb0
2020-09-08 01:37:56 +02:00
Neels Hofmeyr bc2caa3fd9 gits: tweak UI flow
Change-Id: I937f817245a36b14b5b2052e68155923042ddab4
2020-08-26 15:31:28 +02:00
Neels Hofmeyr 7f46be3a0d gits: dont ask to push -f to None
Change-Id: I5edf0abff1b01a3d85e4bf2d77c8ab964e0bf2f0
2019-03-29 15:43:04 +01:00
Neels Hofmeyr efa34acc59 gits: also rebase onto origin/master
Change-Id: Icb331d225e8ec1b75d199e40c61c741a44c9a87c
2019-03-15 15:35:38 +01:00
Neels Hofmeyr 94e0aec3f6 gits: tweak "Rebasing" output
Change-Id: I81d57481650c6f94a3816f04d7b93e28bbc7f9c3
2019-03-15 15:35:38 +01:00
Neels Hofmeyr ae79f4b349 gits: fix ask_reset_hard_or_push_f(), missing args
Change-Id: I91a1087ce1f6399ff652dfeba0097f275050aba3
2018-11-23 04:09:19 +01:00
Neels Hofmeyr 20d95d003e gits: when asking for reset --hard, also offer push -f
Change-Id: Iab38229ee7deaec91c342fa114028e222e652b60
2018-11-20 16:50:15 +01:00
Neels Hofmeyr dff944bff6 gits: remove code dup: ask_reset_hard()
Change-Id: I741aa6ca29370f26a724f5b4b9c6e7f8ac3f282a
2018-11-20 16:50:15 +01:00
Neels Hofmeyr 68d8f34206 gits: use @{u} to get upstream branch, not origin/%s
git has an internal concept of a branch's upstream branch, and the remote need
not be 'origin', and also, the upstream branch name may differ completely. So,
use git's {u} keyword to obtain the upstream branch name.

This removes all 'origin' strings from gits. Also, git_branch_exists() is no
longer needed, drop it.

Also remove a couple of default arguments which aren't ever used because we
always pass arguments anyway.

In the case of git_ahead_behind(), we would have use for a default
branch_upstream=None to imply calling git_branch_upstream(), but then during
rebase, if no upstream exists, we would invoke it twice to get None a second
time. So just call the function explicitly. I thought about returning an empty
string instead of None, but it's too convoluted.

In git_output(), pipe STDERR to STDOUT, because every time we parse a remote
ref (git ref-parse --abbrev-ref '%s{u}') and there is no remote branch, git
prints 'Fatal: there is no remote bla bla' on stdout, and that error is
expected / ok to happen, so it just clutters the 'gits' output. The easiest way
to achieve silence then is to pipe to STDOUT, IIUC otherwise we'd have to use
Popen() and communicate()... In the case of error, subprocess raises an
exception and we see that an error happens. In the ref-parse case we can simply
catch the exception and be quiet.

Change-Id: Ife146903ae1323a4e568587ccfd4018725e9d719
2018-11-20 16:49:29 +01:00
Neels Hofmeyr 39b19b687c gits: fix git_can_fast_forward: use arg instead of HEAD
Change-Id: Idec9c9b9b7eddea2dc574fe41f73c0ac570630ca
2018-11-19 15:45:20 +00:00
Oliver Smith 2a30b520c4 gits: fix MODS marks by timestamp-only changes
Use 'git diff' instead of 'git diff-index'. The latter does not look at
the content. It listed a file with an updated timestap as modified
(indicated in gits with "MODS"), whereas 'git diff' and 'git status'
did not (and we want this behavior, not marking it as modified).

This was a regression from b93f50 ("gits: use git plumbing commands").

Change-Id: I6726190912a1b3eb865cda77fbea6bf58a635d6e
2018-11-19 12:51:25 +00:00
Oliver Smith b93f504814 gits: use git plumbing commands
Instead of 'git status' and 'git branch', which change their output
depending on the git version and locale, use the low-level plumbing

'gits status' output is exactly the same, 'gits rebase' output is
a bit less redundant now (that was easier to implement).

Change-Id: I42544313d14db126c99e2d9a02b8f63031944947
2018-11-09 15:22:09 +01:00
Neels Hofmeyr b459b6c2ae replace src/* git scripts with a single src/gits
I keep re-using this functionality in completely unrelated realms, and decided
to unify the oddly named scripts in a single 'gits' meta-repos tool, so I can
just symlink this script into my ~/bin and use it everywhere.

Change-Id: I579e7af26d76d5c5d83b2349695456bc7b54f5a2
2018-11-08 11:37:19 +01:00
Neels Hofmeyr 693355ea35 e: rewrite in python for proper arg handling 2018-07-26 16:46:38 +02:00
Neels Hofmeyr d313c72b40 s: auto fast forward, commit local mods first 2018-02-28 18:28:09 +01:00
Neels Hofmeyr 9316ee7810 g: use python to pass args transparently
Change-Id: Ib02058a73d2959c5ea5073924b2c38195bbe08fc
2017-11-21 13:03:10 +01:00
Neels Hofmeyr 41c369cdd7 git_branch_summary: use utf-8 for 'git branch -vv' output
Change-Id: I8dc1ac7bb25b1d2944cfe6a659aa3c2a7d1e56ed
2017-09-16 22:08:42 +02:00
Neels Hofmeyr f927c6f82c add usage, make py3 compatible
Change-Id: Ia8cc461fd0f1fb43e19ee8846cc48a828d153b2f
2017-09-04 15:02:23 +02:00
Neels Hofmeyr f6402d8921 add, tweak READMEs
Change-Id: I6df4f3226af9087ef346de72cbcaa86a4d4d5e13
2017-09-04 04:45:00 +02:00
Neels Hofmeyr 8bf033901b add
Change-Id: I41d609ca05aad3385e9e42efb2e7533749df209f
2017-08-31 00:02:03 +02:00
Neels Hofmeyr 45f3cec3b5 add src scripts 2017-08-22 15:58:51 +02:00