113 Commits

Author SHA1 Message Date
Mike McQuaid
fe8a0569ca update: always reset to origin/master.
Do a reset to `origin/master` and then stash but don't pop the stash
after running update (unless you were on a branch). This may be mildly
more annoying for Homebrew developers but means it's easier for our
users who don't understand Git (and particularly when they don't
understand that every tap is a separate Git repository).

Closes Homebrew/homebrew#45825.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-12-07 13:37:27 +00:00
Xu Cheng
48950f2cc0 centralize the logic of handling homebrew- in Tap.fetch
Closes Homebrew/homebrew#46537.

Signed-off-by: Xu Cheng <xucheng@me.com>
2015-12-03 13:46:59 +08:00
Alex Dunn
745ec8f7c9 cmd/update: check before tapping
Follow-up to ea6c8f7e2dc8f1adf8df9065468d0b37047d4a46
2015-11-09 07:30:02 -08:00
Xu Cheng
82689d81f7 use Tap#install 2015-11-09 15:34:20 +08:00
Xu Cheng
ffbb1828a2 update: always rescue formula loading
Closes Homebrew/homebrew#45676.

Signed-off-by: Xu Cheng <xucheng@me.com>
2015-11-04 20:44:28 +08:00
Mike McQuaid
8ea9903a99 update: use git stash silently.
There's been a few issues where users have been confused about these
errors. They may have modified stuff but we probably don't care about
telling them that unless we're debugging other issues.

Closes Homebrew/homebrew#45373.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-10-27 10:45:23 -06:00
Martin Afanasjew
7044bf7bbf update: report tap updates and improve wording
Closes Homebrew/homebrew#43468.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-10-16 09:12:29 +01:00
Martin Afanasjew
0114a26483 update: highlight installed formulae in report
Closes Homebrew/homebrew#44335.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-10-15 08:55:47 +01:00
Vlad Shablinsky
e04a463f11 update: allow updating from local branch
Closes Homebrew/homebrew#44893.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-10-14 14:01:27 +01:00
Xu Cheng
3b520cf195 cache taps
There are plenty of IO operations inside Tap object, and it will be more
when implementing formula alias reverse look up(e.g. list all of alias
names for a formula). So let's cache them.

Some benchmark:

$ time brew info $(brew ruby -e 'puts Formula.tap_names') > /dev/null
Before: 6.40s user 2.42s system 96% cpu 9.134 total
After: 4.75s user 0.77s system 97% cpu 5.637 total

Closes Homebrew/homebrew#44377.

Signed-off-by: Xu Cheng <xucheng@me.com>
2015-09-30 16:25:30 +08:00
Xu Cheng
e66cb91702 update: add permissions check
Closes Homebrew/homebrew#42048

Closes Homebrew/homebrew#44434.

Signed-off-by: Xu Cheng <xucheng@me.com>
2015-09-30 13:54:04 +08:00
Misty De Meo
520b8496d4 Fix brew update for taps with non-master branches
Fixes Homebrew/homebrew#43865.
2015-09-19 00:52:23 -07:00
Mike McQuaid
b1ff9c42d6 update: fix when HEAD doesn't exist.
e.g. when it's a detached `HEAD` through checking out a commit rather
than a branch.
2015-09-11 11:00:27 +01:00
Dan Martinez
8374374168 Improve description searching and add a cache.
Closes Homebrew/homebrew#42281.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-09-08 15:23:37 +01:00
Josh Hagins
f431e543a5 update: explicitly no-ff merge and rebase.
This overrides user configuration which may do otherwise.

Closes Homebrew/homebrew#41570.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-09-07 12:05:20 +01:00
Xu Cheng
03f7e19ca6 update: ensure git is installed 2015-09-02 15:24:53 +08:00
Xu Cheng
3458b99d6e update: secure formula loading in rename
For update, all formula loading need to be secured by `rescue`.
Otherwise it's easy to crash `brew update` for vasty reasons, e.g.
new Formula DSL.

Closes Homebrew/homebrew#43353.

Signed-off-by: Xu Cheng <xucheng@me.com>
2015-08-28 17:15:18 +08:00
Martin Afanasjew
1288e3110d update: always report changes to branch 'master'
If the user's working copy is *not* on the 'master' branch, the revision
recorded after the update to the 'master' branch is not the one of the
updated 'master' branch but that of whatever the user's current branch
is. This tends to be not very helpful.

This change records the revision *after* the update to the 'master'
branch, but *before* switching back to the user's current branch prior
to the update, effectively causing the report to show changes to the
'master' branch.

Closes Homebrew/homebrew#42074.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-08-27 13:53:28 +01:00
Baptiste Fontaine
e779be1453 update: #each.map is redundant 2015-08-25 09:45:21 +02:00
Xu Cheng
a88c40b8c8 core file style update 2015-08-22 13:15:33 +08:00
Xu Cheng
62d1636144 update: only update renamed when necessary 2015-08-20 20:12:02 +08:00
Vlad Shablinsky
e4480cf6bf update: add formula renames to report 2015-08-20 19:55:35 +08:00
Baptiste Fontaine
8ba0fb9fcf unnecessary calls to .select simplified
These are minor perf optimizations.

Closes Homebrew/homebrew#43028.

Signed-off-by: Baptiste Fontaine <batifon@yahoo.fr>
2015-08-18 00:18:22 +02:00
Xu Cheng
3c45e1e81d update: only compute tapd_basename when necessary 2015-08-15 18:32:22 +08:00
Vlad Shablinsky
f88f2b7054 update tabs only if core formula installed
Closes Homebrew/homebrew#42745.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-08-10 16:09:26 +01:00
Vlad Shablinsky
0b854adbf4 update: fix load_tap_migrations 2015-08-10 16:09:26 +01:00
Vlad Shablinsky
6b0927944a update: handle renames on update 2015-08-10 13:57:59 +01:00
Xu Cheng
3c8a19777d update: handle more exceptions
Closes Homebrew/homebrew#42558.

Signed-off-by: Xu Cheng <xucheng@me.com>
2015-08-07 13:42:31 +08:00
Xu Cheng
09e0bcf1fc update: loading core files at the beginning
This should help to prevent similar situation of Homebrew/homebrew#42553 happening in the
future.
2015-08-06 22:51:36 +08:00
BrewTestBot
13d544e11e Core files style updates.
Closes Homebrew/homebrew#42354.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-08-03 13:22:35 +01:00
Xu Cheng
a9b9c5ade7 Tap: allow enumerate non-git taps
Also add a `Tap#git?` method to indicate whether the tap is a git
repository.

Closes Homebrew/homebrew#42264.

Signed-off-by: Xu Cheng <xucheng@me.com>
2015-07-30 21:28:52 +08:00
Mike McQuaid
151890148c update: fix --rebase 2015-07-09 23:50:55 +01:00
Mike McQuaid
b11ae2abdc update: stash save/pop uncommitted changes.
Also:
- return to your previous branch after `brew update`.

Closes Homebrew/homebrew#38568.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-07-09 12:33:31 +01:00
Xu Cheng
44383fecb8 (un)tap/update/readall: use Tap class 2015-06-11 15:28:29 +08:00
Xu Cheng
023230cb6a update: only display version changed formulae
Closes Homebrew/homebrew#40090.

Signed-off-by: Xu Cheng <xucheng@me.com>
2015-06-02 17:24:05 +08:00
Jack Nagel
efd52da101 Remove dead code 2015-05-27 21:57:41 -04:00
Xu Cheng
171c3dd2d9 tap/untap/update/prune: remove obsolete method, add migrate_taps 2015-05-27 13:53:40 +08:00
Jack Nagel
fef8b0871d Remove obsolete nil guard
This was added in 3a7a3619f7016c75c3e53e944221bf7f6354a63b to make the
tests pass, but this method is now stubbed out in the tests, so we can
assume $? will be non-nil.
2014-09-18 21:56:48 -05:00
Jack Nagel
56dd575f96 Pass command and arg list into ErrorDuringExecution constructor 2014-09-18 20:32:50 -05:00
Jack Nagel
f40650ecd0 Set the remote config manually
See 5cd6b35 and 8eefd4e.
2014-08-12 01:46:12 -05:00
Jack Nagel
b160cc9bb6 Handle tap file renames that remove a file from the formula directory 2014-07-31 15:58:03 -05:00
Jack Nagel
87850d00cd Remove obsolete hacks from updater report 2014-07-26 20:11:53 -05:00
Jack Nagel
2b90995c3e Only populate the report with formula paths 2014-07-26 20:11:53 -05:00
Jack Nagel
197a12c900 Switch from backticks to Utils.popen_read 2014-07-26 20:11:53 -05:00
Jack Nagel
802775078c Separate reading and parsing the diff 2014-07-26 20:11:53 -05:00
Jack Nagel
6baf357f8c update: remove unused rename detection
Right now this code only produces false positives. When we have real
support for renames, we can implement it more carefully.

Closes Homebrew/homebrew#31126.
2014-07-25 12:28:05 -05:00
Jack Nagel
2cf116464d update: simplify diff parsing 2014-07-25 12:25:58 -05:00
Jack Nagel
44254aa9cf Remove redundant "which git" guards
There is always a git executable on PATH due to the git wrapper in
Library/Contributions/cmd. The wrapper will notify the user if there is
not a real git installed.
2014-07-06 14:10:52 -05:00
Jack Nagel
2d83c08592 Make tap_ref match similar code in update 2014-07-06 13:12:01 -05:00
Jack Nagel
f8fb74ff76 Escape paths in regexps 2014-07-06 11:25:56 -05:00