Commit Graph

32217 Commits

Author SHA1 Message Date
Augie Fackler
af74c9973b osx: override default exclude filter for pkgbuild
To quote `man 1 pkgbuild`:

     --filter filter-expression
                 By default, --root will include the entire contents of the
                 given root-path in the package payload, except for any .svn
                 or CVS directories, and any .DS_Store files. You can override
                 these default filters by specifying one or more --filter
                 options. Each filter-expression is an re_format(7)
                 ``extended'' expression: any path in the root which matches
                 any of the given expressions will be excluded from the pack-
                 age payload. (Note that specifying even one --filter inhibits
                 the default filters, so you must respecify the default fil-
                 ters if you still want them to be used.)

It turns out the default filter these days *also* includes .git and
.hg. Notice how that filter expression is a regular expression?  That
(presumably unintentionally) prevents a file named "chg" or "_hg" from
getting included in the distribution. Many many thanks to spectral@
for trying to include a _hg file which led us to figure this bug out.

Bug filed with Apple for this as rdar://problem/32437369, mentioning
both the gap in documentation and the wrong defaults.
2017-05-26 20:03:05 -04:00
Augie Fackler
ffe8032044 osx: update Mac packaging tests for bdiff.so install location change 2017-05-26 20:05:59 -04:00
Pierre-Yves David
11f26a2c51 strip: use the 'writenewbundle' function to get bundle on disk
This will ensure the backup bundle use the best available logic (eg: includes
relevant caches so that we loose less of them on strip.)
2017-05-05 18:15:42 +02:00
Pierre-Yves David
41d67dfdab perfphases: add 'perfphases' command
This commands benchmark the time spend computing the data in a repository.
2017-05-23 02:23:07 +02:00
Martin von Zweigbergk
6f7738b741 match: remove support for excludes from matcher class
The support is now provided by differencematcher() and still available
via the match() function.
2017-05-16 22:15:42 -07:00
Martin von Zweigbergk
8d0d310985 match: handle excludes using new differencematcher
As I've said on earlier patches, I'm hoping to use more composition of
simpler matchers instead of the single complex matcher we currently
have. This extracts a first new matcher that composes two other
matchers. It matches if the first matcher matches but the second does
not. As such, we can use it for excludes, which this patch also
does. We'll remove the now-unncessary code for excludes in the next
patch.
2017-05-16 16:36:48 -07:00
Martin von Zweigbergk
2724c60601 match: override matchfn() the usual way in subdirmatcher 2017-05-25 09:52:56 -07:00
Martin von Zweigbergk
cb783946fc match: make matchfn a method on the class
This makes it easier to override in subclasses, so they don't have to
assign the attribute with a lambda.
2017-05-25 09:52:49 -07:00
Boris Feld
f7e21a1d7c util: raise ParseError when parsing dates (BC)
d46a7814be5f refactored util.parsedate in order to raise ValueError instead
of Abort for using with ui.configwith. It causes several problems, putting
arbitrary bytes in ValueError can cause issues with Python 3. Moreover, we
added a function to convert ValueError exceptions back to Abort.

A better approach would be to make parsedate raises ParseError, removing
the convert function and update configwith to also catch ParseError.

The side-effect is that error message when giving an invalid date in CLI
change from:

  abort: invalid date: 'foo bar'

to:

  hg: parse error: invalid date: 'foo bar'

I'm not sure if it's an acceptable change, I found personally the error
message more clear but more verbose too.
2017-05-24 17:50:17 +02:00
Martin von Zweigbergk
de3c23309e match: fix visitdir for roots of includes
I'm hoping to rewrite the matcher so excludes are handled by
composition of one matcher with another matcher where the second
matcher has only includes. For that to work, we need to make
visitdir() to return 'all' for directory 'foo' for a '-I foo' matcher.
2017-05-16 14:31:21 -07:00
Martin von Zweigbergk
605d9dfcea match: make subdirmatcher extend basematcher
This makes the subdirmatcher not depend on the main matcher, giving us
more freedom to modify that (specifically, it will lose it _always
field in a while).
2017-05-17 23:02:42 -07:00
Martin von Zweigbergk
5e75aba9b0 match: make basematcher._files a @propertycache
This will make it easier to override in subclasses (otherwise the
function @propertycache object will be replaced by the
super-constructor call)..
2017-05-19 10:17:08 -07:00
Martin von Zweigbergk
c9664eeaa0 match: extract base class for matchers
We will soon start splitting up the current matcher class into more
specialized classes, so we'll want a base class for all the things
that don't vary much between different matchers.
2017-05-17 23:45:13 -07:00
Martin von Zweigbergk
7f477af2bf debugwalk: also print matcher representation
This will make the effect of coming patches clearer.
2017-05-22 11:08:52 -07:00
Pierre-Yves David
c1ca9ad6ee transaction: run _writejournal unfiltered
The function use the length of the repository, something affected by filtering.
It seems better to use the unfiltered length here.

Credit for finding this goes to Durham Goode.
2017-05-25 01:45:52 +02:00
Augie Fackler
5a83391bf4 bookmarks: warn about bookmark names that unambiguously resolve to a node (BC)
I just burned myself on this today because I left out the -r in my `hg
bookmark` command, which then left me confused because I didn't notice
the bookmark I created in the wrong place that was silently shadowing
the revision I was trying to check out. Let's warn the user.

This patch only enforces the check on bookmark names 4 characters long
or longer. We can tweak that if we'd like, I selected that since
that's the fewest characters shortest will use in the templater
output.

A previous version of this patch rejected such bookmarks. It was
proposed during review (and I agree) that the behavior change for a
bookmark named "cafe" or similar as history accumulated was a little
too weird, but that the warning definitely has merit.
2017-05-22 19:18:12 -04:00
Yuya Nishihara
ef50f332aa pycompat: try __bytes__() to convert object to bytestr
It should be better than using __str__() unconditionally.
2017-05-04 11:51:07 +09:00
Boris Feld
e12d51e5f8 ui: fix ui.configdate for invalid dates
d46a7814be5f introduced util._parsedate with the aim to be used in
ui.configdate but ui.configdate was using util.parsedate instead. It have the
impact of raising an AbortError in case of an invalid date instead of a
ConfigError exception. Fix ui.configdate to use the right function and add a
test for invalid dates.

Thanks to Yuya for the catch!
2017-05-23 15:44:50 +02:00
Yuya Nishihara
07ba7d360b demandimport: stop overriding __getattribute__()
Proxy __dict__ and __doc__ explicitly instead.

I'm not sure which is less evil, but this seems slightly simpler than hooking
all attribute accesses.
2017-04-28 00:01:22 +09:00
Yuya Nishihara
7cd4cd9753 demandimport: look for 'mod' suffix as alternative name for module reference
It's widely used in our codebase.
2017-04-28 23:46:16 +09:00
Yuya Nishihara
3bbb35ccf6 demandimport: insert empty line per method
_demandmod class is getting bigger, and I don't want to put more things in
a dense form.
2017-05-01 14:26:56 +09:00
Yuya Nishihara
8bad75346f demandimport: strictly compare identity of proxy object
This looks better, and __eq__() may be overridden in an undesired way.
2017-05-01 13:43:31 +09:00
Martin von Zweigbergk
2410b10b5f match: use ProgrammingError where appropriate 2017-05-23 08:49:01 -07:00
Pulkit Goyal
dfd06a1929 revlog: raise error.WdirUnsupported from revlog.node() if wdirrev is passed
When we try to run, 'hg debugrevspec 'branch(wdir())'', it throws an index error
and blows up. Lets raise the WdirUnsupported if wdir() is passed so that we can
catch that later.
2017-05-23 01:30:36 +05:30
Pulkit Goyal
b9822a4f60 revset: add support for ancestors(wdir())
This is a part of extending support for wdir() predicate.
2017-05-23 01:22:33 +05:30
Pulkit Goyal
a1d8e291f1 revset: add support for using ~ operator on wdir() predicate
We catch the WdirUnsupported exception and handles the wdir() case here.
2017-05-23 01:08:19 +05:30
Pulkit Goyal
585fe1fa03 revset: add support for p2(wdir()) to get second parent of working directory
This adds support for finding the second parent of working directory using the
p2 predicate.
2017-05-22 02:14:22 +05:30
Pulkit Goyal
3b6d2ad7cc revset: use try-except instead of if-else because of perf
For wdir(), we now raises an exception which will be raised when wdir() will be
passed, so catching that exception is better checking for wdir() using if-else.
2017-05-22 02:03:43 +05:30
Pulkit Goyal
86c7c2d2ce revset: remove redundant condition and change to else from elif
Before going to this piece of code, we already check whether n is in [0, 1, 2],
so dropping the redundant condition.
2017-05-22 01:38:00 +05:30
Pulkit Goyal
5a41587537 tests: add tests for predicates and operators which works with wdir()
This one is cluttering up the test file though.
2017-05-22 01:35:53 +05:30
Pulkit Goyal
8ed8bc3674 revset: add support for "wdir()^n"
This patch catches the WdirUnsupported exception raised, and adds support for
wdir^n which will give us the nth parent of the working directory.
2017-05-22 01:01:45 +05:30
Pulkit Goyal
ca6ae50fc1 revset: add parentheses after wdir since its a function
wdir was shown in help rather than wdir().
2017-05-22 00:54:02 +05:30
Augie Fackler
b90ae820de cmdutil: avoid redefining write() function in export if possible
Doing less work inside the loop just feels better to me.
2017-05-22 15:05:18 -04:00
Augie Fackler
cab9b6d957 cmdutil: extract closure that performs the actual export formatting
This simplifies things a little by making the actual act of turning a
revision into patch data a single function. After this, adding
formatter support to `hg export` should be much simpler.
2017-05-22 13:34:03 -04:00
Augie Fackler
c84213bcdd cmdutil: use a generator expression instead of a list comprehension 2017-05-22 13:35:22 -04:00
Augie Fackler
414ee4894d cmdutil: rename template param to export to fntemplate
It's actually a template for the filename, not a formatter template.
2017-05-20 20:15:05 -04:00
Augie Fackler
47d21819fe cmdutil: comprehensively document the interface of export
I want to make some improvements here, but in order to make future
patches easier to review I want to document the current state of the
world.
2017-05-20 17:58:04 -04:00
Durham Goode
3033fcec75 tests: hide warning from test-xdg.t
The test-xdg.t test uses the system hgrc because it unsets HGRCPATH. If the
system has an extension enabled that doesn't work with the development version
of Mercurial it prints an 'extension failed to load' warning. Let's just hide
that by piping stderr to /dev/null.
2017-05-22 15:56:47 -07:00
Jun Wu
714cce3396 policy: define C module versions individually
This allows us to bump the version for a single module without changing all
of them.
2017-05-22 22:59:40 -07:00
Pierre-Yves David
b02205e9d6 repoview: rename '_getdynamicblockers' to 'revealedrevs' (API)
Recent mailing list discussion made me realised we could clarify these. We make
the function "public" to encourage extensions to wrap it and we use a more
explicit name that mirror "hideablerevs".
2017-05-20 19:43:58 +02:00
Pierre-Yves David
2795351073 repoview: move '_getdynamicblock' next to 'hideablerevs'
There are the two functions that extensions should use to augment the hidding
logic. It seem better to have them together at the top of the file.
2017-05-20 19:43:29 +02:00
Siddharth Agarwal
dae5a54ac2 python3: allow hgloader to work with lazy loaders
Don't clobber the loader returned from find_spec.

This brings `hg version` down from 0.27 seconds to 0.17.
2017-05-21 13:26:17 -07:00
Siddharth Agarwal
0afdb2c4b2 init: turn on demandimport for Python 3.6 and above
This uses the new demandimport implementation for Python 3 introduced in
previous patches.

This doesn't yet enhance performance because it isn't integrated with the
custom source file loader we use on Python 3. We'll integrate the two in
upcoming patches.
2017-05-21 12:51:01 -07:00
Siddharth Agarwal
71d917f14d demandimport: add python 3 implementation
This implementation uses the new importlib finder/loader functionality
available in Python 3.5 and up.

# no-check-commit
2017-05-21 12:23:04 -07:00
Siddharth Agarwal
8ffb99bcb0 demandimport: move ignore list to __init__.py
We're going to use the same ignore list for Python 3.
2017-05-21 12:10:53 -07:00
Siddharth Agarwal
1ce1a31421 check: check modules in hgdemandimport
A few places only check modules in mercurial and hgext. Add
hgdemandimport to the list in those places.
2017-05-21 13:44:26 -07:00
Siddharth Agarwal
a41c665cd6 demandimport: move to separate package
In Python 3, demand loading is per-package. Keeping demandimport in the
mercurial package would disable demand loading for any modules in
mercurial.
2017-05-21 12:10:53 -07:00
Siddharth Agarwal
59a34a8229 import-checker: add a way to directly import certain symbols
We'll use this for the 'demandimport' symbol in an upcoming patch.
2017-05-21 12:09:01 -07:00
Siddharth Agarwal
a03b2b7cab check-code: allow skipping hasattr check in py3-only code
hasattr is safe in Python 3, and in an upcoming patch we can't use
util.safehasattr.
2017-05-21 13:34:42 -07:00
Jun Wu
610c5f87a9 profiling: allow loading profiling extension before everything else
459366b580cf makes profiler start early without loading extensions. That
makes it impossible for an extension to add customized profilers.

This patch adds a special case: if a profiler is not found but an extension
with the same name could be loaded, load that extension first, and expect it
to have a "profile" contextmanager method. This allows customized profilers
and extension setup time is still profiled.
2017-05-22 01:17:49 -07:00