update-reset: allow specifying repositories.
This makes it easier to use this in e.g. CI to quickly reset various repositories to their upstream versions.
This commit is contained in:
parent
c1e26f5677
commit
3063b7fade
@ -1,10 +1,11 @@
|
|||||||
#: * `update-reset`:
|
#: * `update-reset` [<repositories>]:
|
||||||
#: Fetches and resets Homebrew and all tap repositories using `git`(1) to
|
#: Fetches and resets Homebrew and all tap repositories (or the specified
|
||||||
#: their latest `origin/master`. Note this will destroy all your uncommitted
|
#: `repositories`) using `git`(1) to their latest `origin/master`. Note this
|
||||||
#: or committed changes.
|
#: will destroy all your uncommitted or committed changes.
|
||||||
|
|
||||||
homebrew-update-reset() {
|
homebrew-update-reset() {
|
||||||
local DIR
|
local DIR
|
||||||
|
local -a REPOS=()
|
||||||
|
|
||||||
for option in "$@"
|
for option in "$@"
|
||||||
do
|
do
|
||||||
@ -15,10 +16,7 @@ homebrew-update-reset() {
|
|||||||
[[ "$option" = *d* ]] && HOMEBREW_DEBUG=1
|
[[ "$option" = *d* ]] && HOMEBREW_DEBUG=1
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
odie <<EOS
|
REPOS+=("$option")
|
||||||
This command updates brew itself, and does not take formula names.
|
|
||||||
Use 'brew upgrade <formula>'.
|
|
||||||
EOS
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
@ -28,7 +26,12 @@ EOS
|
|||||||
set -x
|
set -x
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for DIR in "$HOMEBREW_REPOSITORY" "$HOMEBREW_LIBRARY"/Taps/*/*
|
if [[ -z "$REPOS" ]]
|
||||||
|
then
|
||||||
|
REPOS+=("$HOMEBREW_REPOSITORY" "$HOMEBREW_LIBRARY"/Taps/*/*)
|
||||||
|
fi
|
||||||
|
|
||||||
|
for DIR in ${REPOS[@]}
|
||||||
do
|
do
|
||||||
[[ -d "$DIR/.git" ]] || continue
|
[[ -d "$DIR/.git" ]] || continue
|
||||||
cd "$DIR" || continue
|
cd "$DIR" || continue
|
||||||
|
|||||||
@ -578,10 +578,10 @@ With `--verbose` or `-v`, many commands print extra debugging information. Note
|
|||||||
If `--force` (or `-f`) is specified then always do a slower, full update check even
|
If `--force` (or `-f`) is specified then always do a slower, full update check even
|
||||||
if unnecessary.
|
if unnecessary.
|
||||||
|
|
||||||
* `update-reset`:
|
* `update-reset` [`repositories`]:
|
||||||
Fetches and resets Homebrew and all tap repositories using `git`(1) to
|
Fetches and resets Homebrew and all tap repositories (or the specified
|
||||||
their latest `origin/master`. Note this will destroy all your uncommitted
|
`repositories`) using `git`(1) to their latest `origin/master`. Note this
|
||||||
or committed changes.
|
will destroy all your uncommitted or committed changes.
|
||||||
|
|
||||||
* `upgrade` [`install-options`] [`--cleanup`] [`--fetch-HEAD`] [`--ignore-pinned`] [`--display-times`] [`formulae`]:
|
* `upgrade` [`install-options`] [`--cleanup`] [`--fetch-HEAD`] [`--ignore-pinned`] [`--display-times`] [`formulae`]:
|
||||||
Upgrade outdated, unpinned brews (with existing install options).
|
Upgrade outdated, unpinned brews (with existing install options).
|
||||||
|
|||||||
@ -527,7 +527,7 @@ If \fB\-\-merge\fR is specified then \fBgit merge\fR is used to include updates
|
|||||||
If \fB\-\-force\fR (or \fB\-f\fR) is specified then always do a slower, full update check even if unnecessary\.
|
If \fB\-\-force\fR (or \fB\-f\fR) is specified then always do a slower, full update check even if unnecessary\.
|
||||||
.
|
.
|
||||||
.IP "\(bu" 4
|
.IP "\(bu" 4
|
||||||
\fBupdate\-reset\fR: Fetches and resets Homebrew and all tap repositories using \fBgit\fR(1) to their latest \fBorigin/master\fR\. Note this will destroy all your uncommitted or committed changes\.
|
\fBupdate\-reset\fR [\fIrepositories\fR]: Fetches and resets Homebrew and all tap repositories (or the specified \fBrepositories\fR) using \fBgit\fR(1) to their latest \fBorigin/master\fR\. Note this will destroy all your uncommitted or committed changes\.
|
||||||
.
|
.
|
||||||
.IP "\(bu" 4
|
.IP "\(bu" 4
|
||||||
\fBupgrade\fR [\fIinstall\-options\fR] [\fB\-\-cleanup\fR] [\fB\-\-fetch\-HEAD\fR] [\fB\-\-ignore\-pinned\fR] [\fB\-\-display\-times\fR] [\fIformulae\fR]: Upgrade outdated, unpinned brews (with existing install options)\.
|
\fBupgrade\fR [\fIinstall\-options\fR] [\fB\-\-cleanup\fR] [\fB\-\-fetch\-HEAD\fR] [\fB\-\-ignore\-pinned\fR] [\fB\-\-display\-times\fR] [\fIformulae\fR]: Upgrade outdated, unpinned brews (with existing install options)\.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user