Yuya Nishihara <yuya@tcha.org> [Sat, 27 May 2017 17:44:26 +0900] rev 32581
formatter: add nullformatter
This can be used as a placeholder variable.
Yuya Nishihara <yuya@tcha.org> [Sat, 27 May 2017 17:40:18 +0900] rev 32580
formatter: add helper to create a formatter optionally backed by file
To make things simple, openformatter() and maybereopen() have no support
for a plain object API. Callers must use the "with" statement.
Unlike cmdutil.makefileobj(), append mode ('ab') isn't supported by these
functions. This is because JSON output can't be simply concatenated. Perhaps
cmdutil.export() will have to build a {filename: [revs...]} map first and
write revs per file.
Yuya Nishihara <yuya@tcha.org> [Sun, 18 Jan 2015 18:04:44 +0900] rev 32579
formatter: add option to redirect output to file object
Commands like 'export' have --output=OUTFILESPEC option, so we need a way
to write formatter output optionally to a file.
Kevin Bullock <kbullock+mercurial@ringworld.org> [Thu, 01 Jun 2017 12:24:16 -0500] rev 32578
merge with i18n
Wagner Bruna <wbruna@softwareexpress.com.br> [Wed, 31 May 2017 20:42:58 -0300] rev 32577
i18n-pt_BR: synchronized with
a0e46f6b248b
Kyle Lippincott <spectral@google.com> [Fri, 26 May 2017 13:24:07 -0700] rev 32576
zsh_completion: install as _hg not hg
The contrib/zsh_completion file itself says to name it _hg.
With a name like `hg`, if the user has a line like `autoload ${^fpath}/*(N-.:t)`
in their zshrc, it will create a shell function named `hg` that will hide the
actual hg command and make hg unusable.
Separately from that though, the underscore prefix makes it actually work. The
zsh man page states:
The convention for autoloaded functions used in completion is that they
start with an underscore
This does not seem to just be a "convention", though. With the ill-advised line
removed from my zshrc and the file named
`/usr/local/share/zsh/site-functions/hg` (without the underscore), these
completions did not seem to get loaded and the ones from the zsh installation
were loaded instead. If I renamed them to be
`/usr/local/share/zsh/site-functions/_hg`, however, they were loaded.
I manually tested the above statement by starting a new zsh instance with the
file in `/usr/local/share/zsh/site-functions` with the following names:
- As `hg`, `which _hg_labels` did not show anything
- As `_hg`, `which _hg_labels` showed the expected function.
Augie Fackler <augie@google.com> [Fri, 26 May 2017 20:03:05 -0400] rev 32575
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.
Wagner Bruna <wbruna@softwareexpress.com.br> [Wed, 31 May 2017 19:24:00 -0300] rev 32574
bugzilla: fix typo in help text
Wagner Bruna <wbruna@softwareexpress.com.br> [Wed, 31 May 2017 19:23:23 -0300] rev 32573
help: fix typos
FUJIWARA Katsunori <foozy@lares.dti.ne.jp> [Wed, 31 May 2017 23:44:33 +0900] rev 32572
win32mbcs: avoid unintentional failure at colorization
Since
176ed32dc159, pycompat.bytestr() wrapped by win32mbcs returns
unicode object, if an argument is not byte-str object. And this causes
unexpected failure at colorization.
pycompat.bytestr() is used to convert from color effect "int" value to
byte-str object in color module. Wrapped pycompat.bytestr() returns
unicode object for such "int" value, because it isn't byte-str.
If this returned unicode object is used to colorize non-ASCII byte-str
in cases below, UnicodeDecodeError is raised at an operation between
them.
- colorization uses "ansi" color mode, or
Even though this isn't default on Windows, user might use this
color mode for third party pager.
- ui.write() is buffered with labeled=True
Buffering causes "ansi" color mode internally, regardless of
actual color mode. With "win32" color mode, extra escape sequences
are omitted at writing data out.
For example, with "win32" color mode, "hg status" doesn't fail for
non-ASCII filenames, but "hg log" does for non-ASCII text, because
the latter implies buffered formatter.
There are many "color effect" value lines in color.py, and making them
byte-str objects isn't suitable for fixing on stable. In addition to
it, pycompat.bytestr will be used to get byte-str object from any
types other than int, too.
To resolve this issue, this patch does:
- replace pycompat.bytestr in checkwinfilename() with newly added
hook point util._filenamebytestr, and
- make win32mbcs reverse-wrap util._filenamebytestr
(this is a replacement of
176ed32dc159)
This patch does two things above at same time, because separately
applying the former change adds broken revision (from point of view of
win32mbcs) to stable branch.
"_" prefix is added to "filenamebytestr", because it is win32mbcs
specific hook point.
Martin von Zweigbergk <martinvonz@google.com> [Wed, 31 May 2017 10:35:10 -0700] rev 32571
tests: fix typo in "flagprocesor"
Kostia Balytskyi <ikostia@fb.com> [Tue, 30 May 2017 06:22:14 -0700] rev 32570
contrib: remove unnecessary debug output from editmergeps.ps1
Kostia Balytskyi <ikostia@fb.com> [Tue, 30 May 2017 06:17:51 -0700] rev 32569
contrib: fix a bug preventing editmergeps.ps1 from running unknonw editors
'$ executable' is not a way to run executable in powershell, '& executable'
is instead. Found this when testing with regular Windows notepad.
Kostia Balytskyi <ikostia@fb.com> [Tue, 30 May 2017 06:02:31 -0700] rev 32568
contrib: make editmergeps use -NoNewWindow option in Start-Process cmdlet
Running 'Start-Process -Wait "vim" "+10" "filename"' from PowerShell
actually spawns a separate cmd window to run vim in. This looks ugly
and in most cases not what user wants. During my initial testing I was
using the Cmder app, which made me not notice this (it captures new
windows as new tabs).
Kostia Balytskyi <ikostia@fb.com> [Tue, 30 May 2017 05:56:48 -0700] rev 32567
contrib: run editmergeps.ps1 from the same location as editmergeps.bat
This change is needed for cases when user does not put editmergeps.bat
directly into PATH, but rather uses 'merge-tools.editmergeps.executable'
config option to provide a full path to editmergeps.bat. In such cases,
editmergeps.ps1 cannot be run simply by name, it needs a full path. In
BATCH file %~dp0 stands for the directory in which the original file
is located.
Yuya Nishihara <yuya@tcha.org> [Sun, 21 May 2017 16:57:32 +0900] rev 32566
help: pass commands module by argument
This removes import cycle.
Stanislau Hlebik <stash@fb.com> [Mon, 29 May 2017 06:06:13 -0700] rev 32565
copies: introduce getdstfctx
Previously `c2` may had an incorrect linkrev because getsrcfctx set wrong
_descendantrev. getsrcfctx() sets descendant rev equals to srcctx.rev() (see
_makegetfctx()), but for `c2` descendant rev should be dstctx. While we were
lucky it didn't broke copytracing it made it significantly slower in some
cases. Besides it broke some external extensions, for example remotefilelog.
Stanislau Hlebik <stash@fb.com> [Mon, 29 May 2017 05:58:08 -0700] rev 32564
copies: rename getfctx to getsrcfctx
In the next patch we'll use getdstfctx. Let's rename getfctx to getsrcfctx in
this patch.
Stanislau Hlebik <stash@fb.com> [Mon, 29 May 2017 05:57:25 -0700] rev 32563
copies: remove msrc and mdst parameters
This function already has lots of parameters. And we can get manifests from
contexts. So let's get msrc and mdst parameters from srcctx and dstctx.
Stanislau Hlebik <stash@fb.com> [Mon, 29 May 2017 05:57:03 -0700] rev 32562
copies: add dstctx parameter
Add parameter with destination context
Stanislau Hlebik <stash@fb.com> [Mon, 29 May 2017 05:56:17 -0700] rev 32561
copies: rename ctx to srcctx
In the next diff we'll pass new dstctx parameter. Let's rename ctx to srcctx in
this patch.
Stanislau Hlebik <stash@fb.com> [Mon, 29 May 2017 05:52:15 -0700] rev 32560
copies: rename m2 to mdst
Small refactoring to rename m2 to more clearer mdst.
Stanislau Hlebik <stash@fb.com> [Mon, 29 May 2017 05:52:15 -0700] rev 32559
copies: rename m1 to msrc
Small refactoring that renames `m1` parameter name to a more clearer name
`msrc`.
Gregory Szorc <gregory.szorc@gmail.com> [Fri, 26 May 2017 13:27:21 -0700] rev 32558
transaction: delete callbacks after use
Before this change, localrepository instances that performed multiple
transactions would leak transaction objects. This could occur when
running `hg convert`. When running `hg convert`, the leak would be
~90 MB per 10,000 changesets as measured with the Mercurial repo itself.
The leak I tracked down involved the "validate" closure from
localrepository.transaction(). It appeared to be keeping a
reference to the original transaction via __closure__. __del__
semantics and a circular reference involving the repo object
may have also come into play.
Attempting to refactor the "validate" closure proved to be
difficult because the "tr" reference in that closure may
reference an object that isn't created until transaction.__init__
is called. And the "validate" closure is passed as an argument to
transaction.__init__. Plus there is a giant warning comment in
"validate" about how hacky it is. I did not want to venture into
the dragon den.
Anyway, we've had problems with transactions causing leaks before.
The solution then (
14e683d6b273) is the same as the solution in this
patch: drop references to callbacks after they are called. This
not only breaks cycles in core Mercurial but can help break cycles
in extensions that accidentally introduce them.
While I only tracked down a leak due to self.validator, since this is
the 2nd time I've tracked down leaks due to transaction callbacks I
figure enough is enough and we should prevent the class of leak from
occurring regardless of the variable. That's why all callback variables
are now nuked.
Martin von Zweigbergk <martinvonz@google.com> [Fri, 19 May 2017 13:16:15 -0700] rev 32557
match: remove special-casing of always-matching patterns in patternmatcher
This moves the optimization for patterns that match everything to the
caller, so we can remove it from patternmatcher.
Note that we need to teach alwaysmatcher to use relative paths now in
cases like "hg files .." from inside mercurial/, because while it
still matches everything, paths should be printed relative to the
working directory.
Martin von Zweigbergk <martinvonz@google.com> [Fri, 19 May 2017 12:47:45 -0700] rev 32556
match: move normalize() call out of matcher constructors
By passing in the result of the normalize() call, we prepare for
moving the special handling of patterns that always match out of the
patternmatcher.
It also lets us remove many of the arguments from the matcher, because
they were passed only the the normalize function (we could have
removed the arguments by binding them to the function instead of
moving the normalize() call out).
Martin von Zweigbergk <martinvonz@google.com> [Fri, 19 May 2017 11:58:16 -0700] rev 32555
match: drop support for empty pattern list in patternmatcher
Since the caller now deals with empty pattern lists, we can drop that
support in the patternmatcher. It now gets the more logical behavior
of matching nothing when no patterns are given (although there is no
in-core caller that will pass no patterns).
Martin von Zweigbergk <martinvonz@google.com> [Sat, 20 May 2017 23:49:14 -0700] rev 32554
match: optimize visitdir() for when no explicit files are listed
In patternmatcher, we used to say that all directories should be
visited if no explicit files were listed, because the case of empty
_files usually implied that no patterns were given (which in turns
meant that everything should match). However, this made e.g. "hg files
-r . rootfilesin:." slower than necessary, because that also ended
up with an empty list in _files. Now that patternmatcher does not
handle includes, the only remaining case where its _files/_fileset
fields will be empty is when it's matching everything. We can
therefore treat the always-case specially and stop treating the empty
_files case specially. This makes the case mentioned above faster on
treemanifest repos.
Martin von Zweigbergk <martinvonz@google.com> [Fri, 19 May 2017 11:50:01 -0700] rev 32553
match: handle everything-matching using new alwaysmatcher
Having a special matcher that always matches seems to make more sense
than making one of the other matchers handle the case. For now, we
just use this new matcher when no patterns were provided.
Martin von Zweigbergk <martinvonz@google.com> [Fri, 26 May 2017 13:08:30 -0700] rev 32552
match: add __repr__ for subdirmatcher
Should at least be useful for debugging. Would matter for correctness
too if fsmonitor or Facebook's sparse extension worked with subrepos
(which I don't know if they do).
Augie Fackler <raf@durin42.com> [Sun, 28 May 2017 21:31:29 -0400] rev 32551
tests: make test-manifest.py portable to Python 3
Lots of b prefixes here, and https://bugs.python.org/
issue29714 means
that this test is still very broken on Python 3.6 and 3.6.1, but 3.6.2
should things (based on testing using tip of the 3.6 branch from git).
#cleanup-only
Augie Fackler <raf@durin42.com> [Mon, 29 May 2017 00:00:02 -0400] rev 32550
cleanup: rename all iteritems methods to items and add iteritems alias
Due to a quirk of our module importer setup on Python 3, all calls and
definitions of methods named iteritems() get rewritten at import
time. Unfortunately, this means there's not a good portable way to
access these methods from non-module-loader'ed code like our unit
tests. This change fixes that, which also unblocks test-manifest.py
from passing under Python 3.
We don't presently define any itervalues methods, or we'd need to give
those similar treatment.
Augie Fackler <raf@durin42.com> [Sun, 28 May 2017 15:51:07 -0400] rev 32549
help: work around textwrap.dedent() only working on strings
Augie Fackler <raf@durin42.com> [Sun, 28 May 2017 15:43:06 -0400] rev 32548
server: write out pid using bytes IO instead of str IO
Augie Fackler <raf@durin42.com> [Sun, 28 May 2017 13:28:41 -0400] rev 32547
help: convert dict to strkwargs
Augie Fackler <raf@durin42.com> [Sun, 28 May 2017 13:42:16 -0400] rev 32546
util: use sysstr.join instead of bytes.join in textwrap wrapper
Augie Fackler <raf@durin42.com> [Sun, 28 May 2017 15:42:05 -0400] rev 32545
tests: port test extension in test-help.t to python 3
The changes required herein suggest to me that we should probably
accept ascii-safe unicode strings for command name, flag name, etc.
Augie Fackler <raf@durin42.com> [Sun, 28 May 2017 15:51:26 -0400] rev 32544
doc: port check-seclevel.py to be Python 2/3 portable
Yuya Nishihara <yuya@tcha.org> [Sun, 28 May 2017 23:54:31 +0900] rev 32543
match: define exactmatcher.matchfn statically
This should eliminate the reference cycle, self.matchfn -> self.exact -> self.
Yuya Nishihara <yuya@tcha.org> [Sun, 28 May 2017 23:51:30 +0900] rev 32542
match: remove override of prefix() from differencematcher
It's exactly the same as basematcher.prefix().
Yuya Nishihara <yuya@tcha.org> [Sat, 27 May 2017 18:52:46 +0900] rev 32541
cat: do not start pager if output will be written to file
Yuya Nishihara <yuya@tcha.org> [Sat, 27 May 2017 18:50:05 +0900] rev 32540
cat: pass filename template as explicit argument
I'll move the handling of the '-' filename to commands.cat().
Yuya Nishihara <yuya@tcha.org> [Thu, 25 May 2017 21:28:08 +0900] rev 32539
cmdutil: extract function checking if pattern should be taken as stdin/out
This will be used in commands.cat().
Yuya Nishihara <yuya@tcha.org> [Thu, 25 May 2017 21:25:49 +0900] rev 32538
cmdutil: drop deprecated hack to pass file object to makefileobj() (API)
All callers pass a string 'pat' or None.
Yuya Nishihara <yuya@tcha.org> [Mon, 29 May 2017 21:57:51 +0900] rev 32537
encoding: make sure "wide" variable never be referenced from other modules
Better to not expose (maybe-) unicode objects.
Augie Fackler <raf@durin42.com> [Sun, 28 May 2017 21:29:58 -0400] rev 32536
manifest: use itertools.chain() instead of + for Python 3 compat
This is all pure-Python code, so I'm not too worried about perf here,
but we can come back and fix it should it be a problem.
With this change, the manifest code passes most unit tests on Python 3
(once the tests are corrected with many b prefixes. I've got a little
more to sort out there and then I'll mail that change too.
Augie Fackler <raf@durin42.com> [Sun, 28 May 2017 21:29:15 -0400] rev 32535
manifest: fix some pure-Python parser bits to work on Python 3
Augie Fackler <raf@durin42.com> [Sun, 28 May 2017 18:08:36 -0400] rev 32534
tests: make test-manifest finish importing in Python 3
The test is still broken, but now it executes.