Martin von Zweigbergk <martinvonz@google.com> [Fri, 18 Jun 2021 15:48:51 -0700] rev 47437
ui: add a context manager for silencing the ui (pushbuffer+popbuffer)
We often silence the ui by calling `ui.pushbuffer()` followed (a later
in the code) by `ui.popbuffer()`. These places can be identified by
the fact that they ignore the output returned from
`ui.popbuffer()`. Let's create a context manager for these cases, to
avoid repetition, and to avoid accidentally leaving the ui silent on
exceptions. I deliberately called the new function `silent()` instead
of `buffered()`, because it's just an implementation detail that it
uses `pushbuffer()` and `popbuffer()`. We could later optimize it to
not buffer the output.
Differential Revision: https://phab.mercurial-scm.org/D10884
Martin von Zweigbergk <martinvonz@google.com> [Fri, 18 Jun 2021 14:17:43 -0700] rev 47436
shelve: don't swallow errors that happen when reverting the working copy
Same reasoning as the parent commit. The code in question here comes
from
fb8065de47b0 (unshelve: silence internal revert, 2014-08-15),
which says that it was to prepare for some upcoming revert changes. I
suppose those changes have happened by now but we fixed something
about it, because I don't see any unwanted changes in tests (no
changes at all in tests, in fact).
Differential Revision: https://phab.mercurial-scm.org/D10883
Martin von Zweigbergk <martinvonz@google.com> [Fri, 18 Jun 2021 13:55:45 -0700] rev 47435
histedit: don't swallow errors that happen when updating the working copy
Commit
34165875fa5d (histedit: limit updated and merging output to
important updates, 2016-02-03) added a call to
`ui.pushbuffer(labeled=True, errors=True)`. I don't know if there was
a reason for the `errors=True` (nor the `labeled=True` bit, which I
removed in the previous commit). It seems bad to just discard the
errors, so let's not do that. By not doing that, we can also remove a
workaround for the lack of errors from `test-removeemptydirs.t`.
Differential Revision: https://phab.mercurial-scm.org/D10882
Martin von Zweigbergk <martinvonz@google.com> [Fri, 18 Jun 2021 13:44:05 -0700] rev 47434
histedit: don't record labels for output that we will discard
Differential Revision: https://phab.mercurial-scm.org/D10881
Martin von Zweigbergk <martinvonz@google.com> [Thu, 10 Jun 2021 15:56:55 -0700] rev 47433
dog-raft: work with str-keyed opts throughout
Differential Revision: https://phab.mercurial-scm.org/D10864
Martin von Zweigbergk <martinvonz@google.com> [Thu, 10 Jun 2021 15:45:22 -0700] rev 47432
cmdutil: make resolvecommitoptions() work on str-keyed opts
As with `checknotesize()`, I also changed to snake_case while at it,
to help extensions a little.
Differential Revision: https://phab.mercurial-scm.org/D10863
Martin von Zweigbergk <martinvonz@google.com> [Thu, 10 Jun 2021 14:55:10 -0700] rev 47431
cmdutil: make amend() take str-keyed opts
I couldn't think of a reasonable change to the signature here, so
unfortunately it keeps the existing one.
Differential Revision: https://phab.mercurial-scm.org/D10862
Martin von Zweigbergk <martinvonz@google.com> [Thu, 10 Jun 2021 14:47:14 -0700] rev 47430
commit: keep opts dict str-keyed a bit longer
Differential Revision: https://phab.mercurial-scm.org/D10861
Martin von Zweigbergk <martinvonz@google.com> [Thu, 10 Jun 2021 14:36:26 -0700] rev 47429
dog-raft: keep opts dict str-keyed a bit longer
Differential Revision: https://phab.mercurial-scm.org/D10860
Martin von Zweigbergk <martinvonz@google.com> [Thu, 10 Jun 2021 14:25:16 -0700] rev 47428
cmdutil: make checknotesize() work on str-keyed opts
Since this patch changes the behavior of the function, I consider it a
bonus if the signature also changes so that extensions can detect
which version they're dealing with (for the record, I don't have any
such extensions). Therefore, I also dropped an unused `ui` argument
and renamed the function to use snake_case.
Differential Revision: https://phab.mercurial-scm.org/D10859
Martin von Zweigbergk <martinvonz@google.com> [Thu, 10 Jun 2021 10:53:43 -0700] rev 47427
amend: work mostly with str-type **opts for simplicity
Differential Revision: https://phab.mercurial-scm.org/D10880
Simon Sapin <simon.sapin@octobus.net> [Tue, 15 Jun 2021 12:34:14 +0200] rev 47426
revlog: use file read caching for sidedata
The previous changeset extracted this caching logic from the revlog class into
a new class. Adding a new instance of that class allows using the same logic
for side data.
Differential Revision: https://phab.mercurial-scm.org/D10879
Simon Sapin <simon.sapin@octobus.net> [Tue, 08 Jun 2021 19:55:00 +0200] rev 47425
revlog: Extract low-level random-access file read caching logic
The `revlog` class does many things, among which fulfilling requests for
arbitrary byte slices from the revlog "data file" by reading a larger chunk
and caching it in memory, in order to reduce the number of system calls.
This extracts that logic into a new class, so that it may later also be used
for the side-data file (with another instance of that class).
The copyright notice of the new file does not include a date or author name
since such information tend not to be kept up-to-date:
https://www.linuxfoundation.org/en/blog/copyright-notices-in-open-source-software-projects/
Differential Revision: https://phab.mercurial-scm.org/D10878
Matt Harbison <matt_harbison@yahoo.com> [Fri, 11 Jun 2021 23:39:31 -0400] rev 47424
typing: disable warnings for a couple of Windows specific attributes
Differential Revision: https://phab.mercurial-scm.org/D10870
Matt Harbison <matt_harbison@yahoo.com> [Sat, 12 Jun 2021 14:50:33 -0400] rev 47423
typing: suppress a false error in mercurial/revlogutils/docket.py on py2
`ord()` wants bytes or str on py3, so I'm guessing it got confused by passing a
single byte instead of a one byte string. But this seems to work on 2.7.18
anyway.
Differential Revision: https://phab.mercurial-scm.org/D10876
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 09 Jun 2021 00:59:44 +0200] rev 47422
transaction: simplify `undo.backupfiles` file creation with a variable
This make the code shorter and clearer.
(This is an opportunity improvement while looking at something next to that.)
Differential Revision: https://phab.mercurial-scm.org/D10846
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 09 Jun 2021 00:59:04 +0200] rev 47421
transaction: narrow the error filtering when failing to rename undo file
Having inconsistent "undo" files can be quite serious so we narrow the error
filtering to the intent that the comment explain.
(This is an opportunity improvement while looking at something next to that.)
Differential Revision: https://phab.mercurial-scm.org/D10845
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 09 Jun 2021 01:13:09 +0200] rev 47420
transaction: clarify a conditionnal about version check
Let us move the short branch early.
Differential Revision: https://phab.mercurial-scm.org/D10844
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 09 Jun 2021 01:14:18 +0200] rev 47419
transaction: extract message about different version in a constants
This make the code a bit simpler and clearer.
(This is an opportunity improvement while looking at something next to that.)
Differential Revision: https://phab.mercurial-scm.org/D10843
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 09 Jun 2021 01:12:03 +0200] rev 47418
transaction: explain why some recovery failed
Right now we issue a message about failing to recover some file, but not why.
It seems useful to add some information about that.
(This is an opportunity improvement while looking at something next to that.)
Differential Revision: https://phab.mercurial-scm.org/D10842
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 07 Jun 2021 21:09:31 +0200] rev 47417
copyfiles: deal with existing file when hardlinking
If the hardlinking fails, we fallback to `shutil.copy`, but do not consider
future hardlinking doomed.
This is a slight improvement from the current situation, we still avoid
hardliking in a case we might be able to do it. However this does not have an
impact of the rest of the operation.
(This is an opportunity improvement while looking at something next to that.)
Differential Revision: https://phab.mercurial-scm.org/D10841
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 08 Jun 2021 03:40:36 +0200] rev 47416
clone: cleanup the "cleanup dir" logic used during local clone
With the previous code, there was a small windows were we could delete too much
data. This should no longer be the case.
(This is an opportunity improvement while looking at something next to that.)
Differential Revision: https://phab.mercurial-scm.org/D10840
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 09 Apr 2021 17:04:39 +0200] rev 47415
config: add an experimental option to list all known config
That option is not ready for prime-time, hence the `exp-` prefix. However, this
is a good base to start going toward completion. This is also quite useful for
developer on its own for now.
Differential Revision: https://phab.mercurial-scm.org/D10356
Matt Harbison <matt_harbison@yahoo.com> [Sat, 12 Jun 2021 00:51:34 -0400] rev 47414
revlog: byteify a few error strings
Differential Revision: https://phab.mercurial-scm.org/D10875
Matt Harbison <matt_harbison@yahoo.com> [Sat, 12 Jun 2021 00:50:03 -0400] rev 47413
revlog: fix a typo closing the wrong file
Caught by pytype as possibly being None, but the file is closed in the previous
conditional.
Differential Revision: https://phab.mercurial-scm.org/D10874
Matt Harbison <matt_harbison@yahoo.com> [Fri, 11 Jun 2021 23:57:14 -0400] rev 47412
py3: byteify the version string passed to the deprecation warning method
The other callers were already correct.
Differential Revision: https://phab.mercurial-scm.org/D10873
Matt Harbison <matt_harbison@yahoo.com> [Fri, 11 Jun 2021 23:51:27 -0400] rev 47411
urlutil: byteify several localized messages
Flagged by pytype.
Differential Revision: https://phab.mercurial-scm.org/D10872
Matt Harbison <matt_harbison@yahoo.com> [Fri, 11 Jun 2021 23:50:29 -0400] rev 47410
urlutil: use the deprecation warning function on the `ui` object
PyCharm flagged this as not existing, and I suspect a copy/paste error.
Differential Revision: https://phab.mercurial-scm.org/D10871
Simon Sapin <simon.sapin@octobus.net> [Wed, 02 Jun 2021 11:25:18 +0200] rev 47409
dirstate-v2: Store a hash of ignore patterns (.hgignore)
Later, this help extend `read_dir` caching to directories that contain ignored
files (but no unknown files). Such cache must be invalidated when ignore patterns
change since a formerly-ignored file might become unknown.
This helps the default configuration of `hg status` where unknown files must
be listed, but ignored files are not.
Differential Revision: https://phab.mercurial-scm.org/D10836
Pulkit Goyal <7895pulkit@gmail.com> [Mon, 07 Jun 2021 17:29:32 +0530] rev 47408
rhg: propogate error coming from HgError::Abort to CommandError
Differential Revision: https://phab.mercurial-scm.org/D10839