-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.mrconfig-omr
223 lines (192 loc) · 9.55 KB
/
.mrconfig-omr
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
# vim:tw=0:ts=2:sw=2:et:norl:nospell:ft=bash
# Author: Landon Bouma (landonb @ retrosoft . com)
# Project: https://github.com/landonb/ohmyrepos#😤
# License: MIT
# ========================================================================
# ------------------------------------------------------------------------
# USAGE: Source this script from your own ~/.mrconfig.
#
# If you clone ohmyrepos to, e.g., ~/.ohmyrepos, it's easy:
#
# - Trust this file first:
#
# $ echo "${HOME}/.ohmyrepos/.mrconfig-omr" >> ~/.mrtrust
#
# - Sourch this file from your user's ~/.mrconfig:
#
# $ cat >> ~/.mrconfig <<'EOF'
# [DEFAULT]
# include = cat "${OHMYREPOS_LIB:-${HOME}/.ohmyrepos/lib}/../.mrconfig-omr"
# EOF
#
# - Then use it! E.g.,
#
# $ mr -d / mystatus
#
# - For more inspiration, look at `.mrconfig.example`.
# ========================================================================
# ------------------------------------------------------------------------
[DEFAULT]
lib =
_omr_before_cd="$(pwd -L)"
# - Wire the logger library.
# https://github.com/landonb/sh-logger#🎮🐸
# - Also wires the color library.
# https://github.com/landonb/sh-colors#💥
# Let the caller override the LOG_LEVEL. Note that we don't check LOG_LEVEL
# itself, because the user might be using logger.sh in their own environment
# and have the level set to their liking for their environment, but that does
# not mean it's the best value for when they run `mr`. So if the user wants
# to change the log level for the `mr` command, they must use MR_LOG_LEVEL.
cd "${OHMYREPOS_LIB:-${HOME}/.ohmyrepos/lib}/../deps/sh-logger/bin"
. "${OHMYREPOS_LIB:-${HOME}/.ohmyrepos/lib}/../deps/sh-logger/bin/logger.sh"
# Verify MR_LOG_LEVEL is an integer. Note the -eq spews when it fails, e.g.:
# bash: [: <foo>: integer expression expected
[ -n "${MR_LOG_LEVEL}" ] \
&& ! [ ${MR_LOG_LEVEL} -eq ${MR_LOG_LEVEL} ] \
&& >&2 echo "WARNING: Resetting MR_LOG_LEVEL, not an integer" \
&& export MR_LOG_LEVEL=
# Default log level: Debug and higher.
LOG_LEVEL=${MR_LOG_LEVEL:-${LOG_LEVEL_DEBUG}}
cd "${_omr_before_cd}"
# ========================================================================
# ------------------------------------------------------------------------
[DEFAULT]
# Oh My Repos offers a handful of actions and utilities, included here.
# - Note that it's difficult to debug parse errors with glob, e.g.,
# include = cat ${OHMYREPOS_LIB:-${HOME}/.ohmyrepos/lib}/*
# because any line number printed will not be very meaningful.
include =
_omr_before_cd="$(pwd -L)"
cd "${OHMYREPOS_LIB:-${HOME}/.ohmyrepos/lib}"
cat "${OHMYREPOS_LIB:-${HOME}/.ohmyrepos/lib}/checkout"
cat "${OHMYREPOS_LIB:-${HOME}/.ohmyrepos/lib}/echo-install-help"
cat "${OHMYREPOS_LIB:-${HOME}/.ohmyrepos/lib}/fetch-selective"
cat "${OHMYREPOS_LIB:-${HOME}/.ohmyrepos/lib}/git-auto-commit"
cat "${OHMYREPOS_LIB:-${HOME}/.ohmyrepos/lib}/git-config-user-email-privatize"
# On-demand: "${OHMYREPOS_LIB:-${HOME}/.ohmyrepos/lib}/git-hooks-rewire"
# Optional: https://github.com/landonb/git-my-merge-status
cat "${OHMYREPOS_LIB:-${HOME}/.ohmyrepos/lib}/git-my-merge-status"
cat "${OHMYREPOS_LIB:-${HOME}/.ohmyrepos/lib}/infuse-no-op"
cat "${OHMYREPOS_LIB:-${HOME}/.ohmyrepos/lib}/install-os-specific"
cat "${OHMYREPOS_LIB:-${HOME}/.ohmyrepos/lib}/no-travel"
# CAVEAT: Though `. skip-grouping.sh` called by `skip-grouping`, it's via
# a `lib` block, which run after `include` blocks. So to use `mr_exclusive`
# from an include block, you need to `. skip-grouping.sh` from that block.
cat "${OHMYREPOS_LIB:-${HOME}/.ohmyrepos/lib}/skip-grouping"
cat "${OHMYREPOS_LIB:-${HOME}/.ohmyrepos/lib}/skip-unless-archiving"
cat "${OHMYREPOS_LIB:-${HOME}/.ohmyrepos/lib}/sync-travel-remote"
cat "${OHMYREPOS_LIB:-${HOME}/.ohmyrepos/lib}/wire-remotes"
cd "${_omr_before_cd}"
# ========================================================================
# ------------------------------------------------------------------------
[DEFAULT]
lib =
_omr_before_cd="$(pwd -L)"
cd -- "${OHMYREPOS_LIB:-${HOME}/.ohmyrepos/lib}"
. "${OHMYREPOS_LIB:-${HOME}/.ohmyrepos/lib}/any-action-runtime.sh"
. "${OHMYREPOS_LIB:-${HOME}/.ohmyrepos/lib}/checkout.sh"
. "${OHMYREPOS_LIB:-${HOME}/.ohmyrepos/lib}/clone-giturl.sh"
. "${OHMYREPOS_LIB:-${HOME}/.ohmyrepos/lib}/echo-install-help.sh"
. "${OHMYREPOS_LIB:-${HOME}/.ohmyrepos/lib}/fetch-selective.sh"
. "${OHMYREPOS_LIB:-${HOME}/.ohmyrepos/lib}/git-auto-commit.sh"
. "${OHMYREPOS_LIB:-${HOME}/.ohmyrepos/lib}/git-my-merge-status.sh"
. "${OHMYREPOS_LIB:-${HOME}/.ohmyrepos/lib}/install-os-specific.sh"
. "${OHMYREPOS_LIB:-${HOME}/.ohmyrepos/lib}/line-in-file.sh"
. "${OHMYREPOS_LIB:-${HOME}/.ohmyrepos/lib}/link-hard.sh"
. "${OHMYREPOS_LIB:-${HOME}/.ohmyrepos/lib}/link-private-exclude.sh"
. "${OHMYREPOS_LIB:-${HOME}/.ohmyrepos/lib}/link-private-ignore.sh"
# On-demand: "${OHMYREPOS_LIB:-${HOME}/.ohmyrepos/lib}/mr-process-id.sh"
. "${OHMYREPOS_LIB:-${HOME}/.ohmyrepos/lib}/os-is-macos.sh"
. "${OHMYREPOS_LIB:-${HOME}/.ohmyrepos/lib}/overlay-symlink.sh"
. "${OHMYREPOS_LIB:-${HOME}/.ohmyrepos/lib}/pull-latest.sh"
# On-demand: "${OHMYREPOS_LIB:-${HOME}/.ohmyrepos/lib}/print-homebrew-prefix.sh"
. "${OHMYREPOS_LIB:-${HOME}/.ohmyrepos/lib}/print-unresolved-path.sh"
. "${OHMYREPOS_LIB:-${HOME}/.ohmyrepos/lib}/remote-set.sh"
. "${OHMYREPOS_LIB:-${HOME}/.ohmyrepos/lib}/remote-set-private.sh"
. "${OHMYREPOS_LIB:-${HOME}/.ohmyrepos/lib}/remote-add.sh"
. "${OHMYREPOS_LIB:-${HOME}/.ohmyrepos/lib}/skip-grouping.sh"
. "${OHMYREPOS_LIB:-${HOME}/.ohmyrepos/lib}/sorted-commit.sh"
. "${OHMYREPOS_LIB:-${HOME}/.ohmyrepos/lib}/sync-travel-remote.sh"
. "${OHMYREPOS_LIB:-${HOME}/.ohmyrepos/lib}/wire-remotes.sh"
# Depdendencies for previous
# - Wire the timing library.
# https://github.com/landonb/sh-print-nanos-now#⏱️
cd "${OHMYREPOS_LIB:-${HOME}/.ohmyrepos/lib}/../deps/sh-print-nanos-now/bin"
. "${OHMYREPOS_LIB:-${HOME}/.ohmyrepos/lib}/../deps/sh-print-nanos-now/bin/print-nanos-now.sh"
cd -- "${_omr_before_cd}"
# ========================================================================
# ------------------------------------------------------------------------
[DEFAULT]
# Use the _append feature to chain setup and teardown functions.
setup_dispatch_append = git_any_cache_setup "${@}"
# Optional: https://github.com/landonb/git-my-merge-status
setup_dispatch_append = command -v "git_status_cache_setup" > /dev/null \
&& git_status_cache_setup "${@}"
setup_dispatch_append = git_travel_cache_setup "${@}"
teardown_dispatch_append = git_travel_cache_teardown "${@}"
# Optional: https://github.com/landonb/git-my-merge-status
teardown_dispatch_append = command -v "git_status_cache_teardown" > /dev/null \
&& git_status_cache_teardown "${@}"
# Order matters: Ensure the 'any' teardown is last, so it runs last.
teardown_dispatch_append = git_any_cache_teardown "${@}"
# ========================================================================
# ------------------------------------------------------------------------
[DEFAULT]
# For all actions (any action), do not print blank line between repos.
no_print_sep = true
# For mystatus action, do not print action or directory header line.
no_print_action_mystatus = true
no_print_dir_mystatus = true
# For mystatus action, do not print if repo fails (action will do it).
no_print_failed_mystatus = true
# Likewise for `ffssh`...
no_print_action_ffssh = true
no_print_dir_ffssh = true
no_print_failed_ffssh = true
# ... and the `travel` command.
no_print_action_travel = true
no_print_dir_travel = true
no_print_failed_travel = true
# ... and the `unpack` command.
no_print_action_unpack = true
no_print_dir_unpack = true
no_print_failed_unpack = true
# ... and the `autocommit` command.
# Note also the `[DEFAULT] autocommit = true`,
# below, which further reduces amount of output.
no_print_action_autocommit = true
no_print_dir_autocommit = true
no_print_failed_autocommit = true
# If a user `mr -d some/path -n run`s a command, they probably
# expect total control over the output. And it's easy to print
# the repo path, e.g.,
# mr -d some/path -n run sh -c 'echo "${MR_REPO}"'
no_print_action_run = true
no_print_dir_run = true
no_print_failed_run = true
# ========================================================================
# ------------------------------------------------------------------------
[DEFAULT]
# Wire `mr pull` to git-pull.
# - Note that myrepos wires pull, but via `update`, e.g., `mr update`.
# - If you compare the equivalent update commands for the 9 SCMs that
# myrepos supports, you'll see `pull` is less ambiguous than `update`.
# - For instance, `svn update` is like `git pull`, but in hg,
# `hg pull` is like `git fetch`, and `hg update` like `git merge`,
# so hg_update calls `hg pull "$@"; hg update "$@"`.
# (lb): But I only use git, so let's wire `mr pull` for parity.
# - We could naively wire the function, e.g.,
# git_pull = git pull "$@"
# but that runs the risk of creating conflicts in the user's projects.
# - The user could avoid this with the following in their .gitconfig:
# [pull]
# ff = only
# - Or we could just be explicit about it here (let's do that).
# git_pull = git pull "$@"
git_pull =
git fetch "$@" \
&& git merge --ff-only "$@" FETCH_HEAD \
| grep -v "Already up to date." || true
# ========================================================================
# ------------------------------------------------------------------------