Augie Fackler <augie@google.com> [Wed, 17 Jan 2018 21:45:15 -0500] rev 35876
lsprof: use native string when peeking in __dict__
# skip-blame just an r prefix on a string literal
Differential Revision: https://phab.mercurial-scm.org/D1895
Augie Fackler <augie@google.com> [Wed, 17 Jan 2018 21:44:15 -0500] rev 35875
dirstate: use native strings when peeking in __dict__
# skip-blame because we're just adding a prefix on a string prefix
Differential Revision: https://phab.mercurial-scm.org/D1894
Augie Fackler <augie@google.com> [Wed, 17 Jan 2018 21:43:46 -0500] rev 35874
context: use native string when peeking in __dict__
# skip-blame because we're just adding a prefix on a string constant
Differential Revision: https://phab.mercurial-scm.org/D1893
Augie Fackler <augie@google.com> [Wed, 17 Jan 2018 21:42:56 -0500] rev 35873
bundlerepo: use native str when peeking in __dict__
# skip-blame since it's just a string constant prefix
Differential Revision: https://phab.mercurial-scm.org/D1892
Augie Fackler <augie@google.com> [Wed, 17 Jan 2018 20:41:51 -0500] rev 35872
transaction: fix hg version check when loading journal
Differential Revision: https://phab.mercurial-scm.org/D1891
Augie Fackler <augie@google.com> [Wed, 17 Jan 2018 20:38:10 -0500] rev 35871
branchmap: make error messages consistent between Python 2 and 3
Differential Revision: https://phab.mercurial-scm.org/D1890
Augie Fackler <augie@google.com> [Wed, 17 Jan 2018 20:37:17 -0500] rev 35870
tests: bytestring-ify all the adhoc extensions in test-strip.t
# skip-blame because we're just adding b''
Differential Revision: https://phab.mercurial-scm.org/D1889
Augie Fackler <augie@google.com> [Wed, 17 Jan 2018 20:09:52 -0500] rev 35869
filemerge: fix regular expression pattern to be bytes
# skip-blame just a bytes prefix
Differential Revision: https://phab.mercurial-scm.org/D1888
Augie Fackler <augie@google.com> [Wed, 17 Jan 2018 20:09:10 -0500] rev 35868
tags: explicitly grab list of dict keys
Differential Revision: https://phab.mercurial-scm.org/D1887
Augie Fackler <augie@google.com> [Wed, 17 Jan 2018 20:08:40 -0500] rev 35867
commands: replace map() with list comprehension
This will work identically on Python 2 and 3.
Differential Revision: https://phab.mercurial-scm.org/D1886
Augie Fackler <augie@google.com> [Wed, 17 Jan 2018 20:07:53 -0500] rev 35866
commands: rewrite legacy ternary operator hack using modern syntax
Differential Revision: https://phab.mercurial-scm.org/D1885
Augie Fackler <augie@google.com> [Wed, 17 Jan 2018 20:07:25 -0500] rev 35865
strip: use %d for known-int string interpolation
Differential Revision: https://phab.mercurial-scm.org/D1884
Augie Fackler <augie@google.com> [Thu, 18 Jan 2018 10:22:41 -0500] rev 35864
strip: use in-place revset formatspec instead of %-formatting ourselves
Caught by Yuya during review of D1884.
Differential Revision: https://phab.mercurial-scm.org/D1905
Augie Fackler <augie@google.com> [Wed, 17 Jan 2018 19:11:51 -0500] rev 35863
tests: get run-tests to reliably hand shellquote a string and not a bytes
Differential Revision: https://phab.mercurial-scm.org/D1883
Augie Fackler <augie@google.com> [Thu, 01 Feb 2018 14:59:38 -0500] rev 35862
revsetlang: fix a doctest example on Python 3
# skip-blame because it's just some bytes prefixes
Differential Revision: https://phab.mercurial-scm.org/D1964
Augie Fackler <augie@google.com> [Thu, 01 Feb 2018 14:28:45 -0500] rev 35861
merge with stable
Augie Fackler <raf@durin42.com> [Wed, 04 Apr 2018 10:35:09 -0400] rev 35860
Added signature for changeset 7de7bd407251
Augie Fackler <raf@durin42.com> [Wed, 04 Apr 2018 10:35:09 -0400] rev 35859
Added tag 4.5.3 for changeset 7de7bd407251
Matt Harbison <matt_harbison@yahoo.com> [Sun, 01 Apr 2018 01:27:18 -0400] rev 35858
server: ensure the incoming request falls under the prefix value
Prior to this, the first test asserted in wsgiref.validate.check_environ()
saying PATH didn't start with '/', but the second test served up the repo. The
assertion was just added in this cycle (though the value of PATH is still wrong
without the assertion). Allowing access to the repo at any URL outside of the
prefix is a long standing bug. This also affected hgwebdir, at least when used
via --subrepo.
Paths are not being canonicalized, so accesses to things like 'foo/../bar' will
get tossed out here, unless the prefix also matches.
Martin von Zweigbergk <martinvonz@google.com> [Thu, 15 Mar 2018 22:35:07 -0700] rev 35857
rebase: on abort, don't strip commits that didn't need rebased (issue5822)
I clearly missed adding this condition in 78496ac30025 (rebase: allow
rebase even if some revisions need no rebase (BC) (issue5422),
2017-05-11). Perhaps I should have opted for the "revdone" solution I
mentioned there...
Differential Revision: https://phab.mercurial-scm.org/D2879
Martin von Zweigbergk <martinvonz@google.com> [Thu, 15 Mar 2018 21:40:51 -0700] rev 35856
rebase: avoid defining two lists with the same contents
In abort(), there's "dstates" and "rebased" that are identical, which
they seem to have been since 0806823370d8 (rebase: properly calculate
descendant set when aborting (issue3332), 2012-03-22). Let's
de-duplicate. I don't know what "dstates" means, but "rebased" makes
sense (it's the list of rebased revisions), so let's pick that.
Differential Revision: https://phab.mercurial-scm.org/D2878
Martin von Zweigbergk <martinvonz@google.com> [Thu, 15 Mar 2018 21:51:33 -0700] rev 35855
tests: demonstrate aborted rebase strips commits that didn't need rebasing
I haven't verified, but this has probably been broken ever since I
added the feature in 78496ac30025 (rebase: allow rebase even if some
revisions need no rebase (BC) (issue5422), 2017-05-11).
Differential Revision: https://phab.mercurial-scm.org/D2877
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 12 Mar 2018 13:15:00 -0700] rev 35854
hgweb: garbage collect on every request
There appears to be a cycle in localrepository or hgweb that
is preventing repositories from being garbage collected when
hgwebdir dispatches to hgweb. Every request creates a new
repository instance and then leaks that object and other referenced
objects. A periodic GC to find cycles will eventually collect the
old repositories. But these don't run reliably and rapid requests
to hgwebdir can result in rapidly increasing memory consumption.
With the Firefox repository, repeated requests to raw-file URLs
leak ~100 MB per hgwebdir request (most of this appears to be
cached manifest data structures). WSGI processes quickly grow
to >1 GB RSS.
Breaking the cycles in localrepository is going to be a bit of
work.
Because we know that hgwebdir leaks localrepository instances, let's
put a band aid on the problem in the form of an explicit gc.collect()
on every hgwebdir request.
As the inline comment states, ideally we'd do this in a finally
block for the current request iff it dispatches to hgweb. But
_runwsgi() returns an explicit value. We need the finally to run
after generator exhaustion. So we'd need to refactor _runwsgi()
to "yield" instead of "return." That's too much change for a patch
to stable. So we implement this hack one function above and run
it on every request.
The performance impact of this change should be minimal. Any
impact should be offset by benefits from not having hgwebdir
processes leak memory.
Yuya Nishihara <yuya@tcha.org> [Sun, 11 Mar 2018 20:10:38 +0900] rev 35853
amend: abort if unresolved merge conflicts found (issue5805)
It was checked by repo.commit() before e8a7c1a0565a "cmdutil: remove the
redundant commit during amend."
Kevin Bullock <kbullock@ringworld.org> [Tue, 06 Mar 2018 13:19:54 -0600] rev 35852
Added signature for changeset 8bba684efde7
Kevin Bullock <kbullock@ringworld.org> [Tue, 06 Mar 2018 13:19:52 -0600] rev 35851
Added tag 4.5.2 for changeset 8bba684efde7
Kevin Bullock <kbullock+mercurial@ringworld.org> [Tue, 06 Mar 2018 13:17:07 -0600] rev 35850
merge with security patches
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 18 Feb 2018 17:20:38 -0800] rev 35849
hgweb: always perform permissions checks on protocol commands (BC) (SEC)
Previously, the HTTP request handling code would only perform
permissions checking on a wire protocol command if that wire protocol
command defined its permissions / operation type. This meant that
commands (possibly provided by extensions) not defining their
operation type would bypass permissions check. This could lead
to exfiltration of data from servers and mutating repositories that
were supposed to be read-only.
This security issue has been present since the permissions table
was introduced by d3147b4e3e8a in 2008.
This commit changes the behavior of the HTTP server to always
perform permissions checking for protocol requests. If an
explicit permission for a wire protocol command is not defined,
the server assumes the command can be used for writing and
governs access accordingly.
.. bc::
Wire protocol commands not defining their operation type in
``wireproto.PERMISSIONS`` are now assumed to be used for
"push" operations and access control to run those commands
is now enforced accordingly.
Gregory Szorc <gregory.szorc@gmail.com> [Tue, 20 Feb 2018 18:55:58 -0800] rev 35848
wireproto: check permissions when executing "batch" command (BC) (SEC)
For as long as the "batch" command has existed (introduced by
bd88561afb4b and first released as part of Mercurial 1.9), that command
(like most wire commands introduced after 2008) lacked an entry in
the hgweb permissions table. And since we don't verify permissions if
an entry is missing from the permissions table, this meant that
executing a command via "batch" would bypass all permissions
checks.
The security implications are significant: a Mercurial HTTP server
would allow writes via "batch" wire protocol commands as long as
the HTTP request were processed by Mercurial and the process running
the Mercurial HTTP server had write access to the repository. The
Mercurial defaults of servers being read-only and the various web.*
config options to define access control were bypassed.
In addition, "batch" could be used to exfiltrate data from servers
that were configured to not allow read access.
Both forms of permissions bypass could be mitigated to some extent
by using HTTP authentication. This would prevent HTTP requests from
hitting Mercurial's server logic. However, any authenticated request
would still be able to bypass permissions checks via "batch" commands.
The easiest exploit was to send "pushkey" commands via "batch" and
modify the state of bookmarks, phases, and obsolescence markers.
However, I suspect a well-crafted HTTP request could trick the server
into running the "unbundle" wire protocol command, effectively
performing a full `hg push` to create new changesets on the remote.
This commit plugs this gaping security hole by having the "batch"
command perform permissions checking on each sub-command that is
being batched. We do this by threading a permissions checking
callable all the way to the protocol handler. The threading is a
bit hacky from a code perspective. But it preserves API compatibility,
which is the proper thing to do on the stable branch.
One of the subtle things we do is assume that a command with an
undefined permission is a "push" command. This is the safest thing to
do from a security perspective: we don't want to take chances that
a command could perform a write even though the server is configured
to not allow writes.
As the test changes demonstrate, it is no longer possible to bypass
permissions via the "batch" wire protocol command.
.. bc::
The "batch" wire protocol command now enforces permissions of
each invoked sub-command. Wire protocol commands must define
their operation type or the "batch" command will assume they
can write data and will prevent their execution on HTTP servers
unless the HTTP request method is POST, the server is configured
to allow pushes, and the (possibly authenticated) HTTP user is
authorized to perform a push.
Gregory Szorc <gregory.szorc@gmail.com> [Tue, 20 Feb 2018 18:54:27 -0800] rev 35847
wireproto: declare operation type for most commands (BC) (SEC)
The permissions model of hgweb relies on a dictionary to declare
the operation associated with each command - either "pull" or
"push." This dictionary was established by d3147b4e3e8a in 2008.
Unfortunately, we neglected to update this dictionary as new
wire protocol commands were introduced.
This commit defines the operations of most wire protocol commands
in the permissions dictionary. The "batch" command is omitted because
it is special and requires a more complex solution.
Since permissions checking is skipped unless a command has an entry in
this dictionary (this security issue will be addressed in a subsequent
commit), the practical effect of this change is that various wire
protocol commands now HTTP 401 if web.deny_read or web.allow-pull,
etc are set to deny access. This is reflected by test changes. Note
how various `hg pull` and `hg push` operations now fail before
discovery. (They fail during the initial "capabilities" request.)
This change fixes a security issue where built-in wire protocol
commands would return repository data even if the web config were
configured to deny access to that data.
I'm on the fence as to whether we should HTTP 401 the capabilities
request. On one hand, it can expose repository metadata and can tell
callers things like what version of Mercurial the server is running.
On the other hand, a client may need to know the capabilities in order
to authenticate in a follow-up request. It appears that Mercurial
clients handle the HTTP 401 on *any* protocol request, so we should
be OK sending a 401 for "capabilities." But if this causes problems,
it should be possible to allow "capabilities" to always work.
.. bc::
Various read-only wire protocol commands now return HTTP 401
Unauthorized if the hgweb configuration denies read/pull access to
the repository.
Previously, various wire protocol commands would still work and
return data if read access was disabled.
Gregory Szorc <gregory.szorc@gmail.com> [Tue, 20 Feb 2018 18:53:39 -0800] rev 35846
wireproto: move command permissions dict out of hgweb_mod
The operation type associated with wire protocol commands is supposed
to be defined in a dictionary so it can be used for permissions
checking.
Since this metadata is closely associated with wire protocol commands
themselves, it makes sense to define it in the same module where
wire protocol commands are defined.
This commit moves hgweb_mod.perms to wireproto.PERMISSIONS and
updates most references in the code to use the new home. The old
symbol remains an alias for the new symbol. Tests pass with the
code pointing at the old symbol. So this should be API compatible
for extensions.
As part of the code move, we split up the assignment to the dict
so it is next to the @wireprotocommand. This reinforces that a
@wireprotocommand should have an entry in this dict.
In the future, we'll want to declare permissions as part of the
@wireprotocommand decorator. But this isn't appropriate for the
stable branch.
Gregory Szorc <gregory.szorc@gmail.com> [Tue, 20 Feb 2018 19:09:01 -0800] rev 35845
tests: comprehensively test HTTP server permissions checking
We didn't have test coverage for numerous web.* config options. We
add that test coverage.
Included in the tests are tests for custom commands. We have commands
that are supposedly read-only and perform writes and a variation of
each that does and does not define its operation type in
hgweb_mod.perms.
The tests reveal a handful of security bugs related to permissions
checking. Subsequent commits will address these security bugs.
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 18 Feb 2018 10:40:49 -0800] rev 35844
tests: extract HTTP permissions tests to own test file
We're about to implement a lot more coverage of the permissions
mechanism. In preparation for that, establish a new test file
to hold permissions checks.
As part of this, we inline the important parts of the "req" helper
function.
Kevin Bullock <kbullock@ringworld.org> [Tue, 06 Mar 2018 13:08:00 -0600] rev 35843
Added signature for changeset 369aadf7a326
Kevin Bullock <kbullock@ringworld.org> [Tue, 06 Mar 2018 13:07:58 -0600] rev 35842
Added tag 4.5.1 for changeset 369aadf7a326
Jun Wu <quark@fb.com> [Tue, 13 Feb 2018 11:35:32 -0800] rev 35841
revlog: resolve lfs rawtext to vanilla rawtext before applying delta
This happens when a LFS delta base gets a non-LFS delta from another client.
In that case, the LFS delta base needs to be converted to non-LFS version
before applying the delta.
Differential Revision: https://phab.mercurial-scm.org/D2069
Jun Wu <quark@fb.com> [Tue, 13 Feb 2018 11:35:32 -0800] rev 35840
revlog: do not use delta for lfs revisions
This is similar to what we have done for changegroups. It is needed to make
sure the delta application code path can assume deltas are always against
vanilla (ex. non-LFS) rawtext so the next fix becomes possible.
Differential Revision: https://phab.mercurial-scm.org/D2068
Jun Wu <quark@fb.com> [Tue, 06 Feb 2018 19:08:25 -0800] rev 35839
changegroup: do not delta lfs revisions
There is no way to distinguish whether a delta base is LFS or non-LFS.
If the delta is against LFS rawtext, and the client trying to apply it has
the base revision stored as fulltext, the delta (aka. bundle) will fail to
apply.
This patch forbids using delta for LFS revisions in changegroup so bad
deltas won't be transmitted.
Note: this does not solve the problem entirely. It solves LFS delta applying
to non-LFS base. But the other direction: non-LFS delta applying to LFS base
is not solved yet.
Differential Revision: https://phab.mercurial-scm.org/D2067
Jun Wu <quark@fb.com> [Tue, 06 Feb 2018 16:08:57 -0800] rev 35838
lfs: add a test showing bundle application could be broken
When a bundle containing LFS delta uses non-LFS delta-base, or vice-versa,
the bundle will fail to apply.
Differential Revision: https://phab.mercurial-scm.org/D2066
Yuya Nishihara <yuya@tcha.org> [Sun, 04 Mar 2018 14:53:57 -0500] rev 35837
test-annotate: set stdin and stdout to binary to get CR unmodified
Yuya Nishihara <yuya@tcha.org> [Sun, 04 Mar 2018 13:19:05 -0500] rev 35836
test-annotate: rewrite sed with some python
I hope this will fix the test failure seen on FreeBSD and Windows.
Matt Harbison <matt_harbison@yahoo.com> [Sat, 03 Mar 2018 22:29:24 -0500] rev 35835
test-subrepo: glob away an unstable hash
This is the instability mentioned at the beginning of the series. I don't like
hiding it, but I don't want to sit on a fix for a user reported problem while
trying to figure this out.
The instability seems related to the cset with a .hgsub with a remote URL.
(There's very little existing remote URL subrepo testing.)
Matt Harbison <matt_harbison@yahoo.com> [Thu, 01 Mar 2018 11:37:00 -0500] rev 35834
subrepo: activate clone pooling to enable sharing with remote URLs
This is the easiest way to ensure that repositories with remote subrepo
references can share the subrepos, consistent with how local subrepos can be
shared.
Matt Harbison <matt_harbison@yahoo.com> [Thu, 01 Mar 2018 11:13:00 -0500] rev 35833
subrepo: don't attempt to share remote sources (issue5793)
Untangling _abssource() to resolve the new subrepo relative to the shared
parent's share path, and then either sharing from there (if it exists), or
cloning to that location and then sharing, is probably more than should be
attempted on stable. Absolute subrepo references are discouraged, so for now,
this resumes the behavior prior to 68e0bcb90357 of cloning the absolute subrepo
locally.
Matt Harbison <matt_harbison@yahoo.com> [Wed, 28 Feb 2018 00:29:27 -0500] rev 35832
test-subrepo: demonstrate problems with subrepo sharing and absolute paths
This affects remote paths in .hgsub, as well as clone pooling from a remote
source.
For reasons unknown, there are stability issues with the relative-path.t tests.
If run as a single test, it is stable. If run with --loop, or with -jX for X>1,
the hash of the parent repo changes. I'm seeing this on both Windows and Fedora
26. I added an `hg log --debug`, and the manifest hash changes, but I have no
idea why.
Yuya Nishihara <yuya@tcha.org> [Wed, 21 Feb 2018 21:14:05 +0900] rev 35831
annotate: do not poorly split lines at CR (issue5798)
mdiff and lines(text) take only LF as a line separator, but str.splitlines()
breaks our assumption. Use mdiff.splitnewlines() consistently.
It's hard to read \r in tests, so \r is replaced with [CR]. I had to wrap
sed by a shell function to silence check-code warning.
Gregory Szorc <gregory.szorc@gmail.com> [Fri, 23 Feb 2018 17:57:04 -0800] rev 35830
setup: only allow Python 3 from a source checkout (issue5804)
People are running `pip install Mercurial` with Python 3 and that
is working because not everything performs a Python version
compatibility check.
Modern versions of pip do recognize the "python_requires" keyword
(https://packaging.python.org/tutorials/distributing-packages/#python-requires)
which we set if using setuptools. But this isn't set nor recognized
everywhere.
To prevent people from accidentally installing Mercurial with Python
3 until Python 3 is officially supported, have setup.py fail when
run with Python 3. But don't fail if we're running from a source
checkout, as we don't want to anger Mercurial developers hacking
on Python 3 nor Mercurial's test automation running from source
checkouts. People running setup.py from source checkouts could still
fall through a Python 3 crack. But at least the
`pip install Mercurial` attempt will get nipped in the bud.
Josef 'Jeff' Sipek <jeffpc@josefsipek.net> [Wed, 21 Feb 2018 16:51:09 -0500] rev 35829
help: fix wording describing SSH requirements
Anton Shestakov <av6@dwimlabs.net> [Thu, 22 Feb 2018 15:18:44 +0800] rev 35828
graphlog: document what "_" and "*" mean
Documenting "*" should've been a part of 9b3f95d9783d, but I somehow didn't
notice that the symbols are explained in the command's help text.
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 18 Feb 2018 16:19:26 -0800] rev 35827
tests: expand test coverage for updating phases
Consolidating the tests demonstrated that there are behavior
differences when pushing phases between bundle1 and bundle2.
A reason for this is the behavior of legacy pushes where the client
queries the state of phases and then conditionally updates phases
after an "unbundle" is processed. This behavior is expected.
The tests were incomplete because they only tested the case of a
publishing repo. In this commit, we add a variant for a non-publishing
repo. We still see some differences between the legacy and bundle2
exchanges. But they are less pronounced.
The behavior of not firing a pushkey hook when phases are updated as
part of changegroup application feels weird to me. I'm not sure if
this is a feature or a bug. By the time the "pushkey" or "phases"
bundle2 part is applied, the phases have already been moved on
a publishing repository. We fire the "pushkey" hook regardless,
even though it would be a no-op. This is the part that feels the
most buggy.
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 18 Feb 2018 10:00:34 -0800] rev 35826
tests: consolidate test-push-http.t and test-push-http-bundle1.t
These tests were initially copies of each other. Now that we have
#testcases support in .t tests, we can consolidate them.
The changes to test-push-http.t reflect the differences between that
file and test-push-http-bundle1.t.
The variances in phases push behavior are the biggest differences.
The test will be updated in a subsequent commit to make the differences
more clear and to expand test coverage. For now, let's just port
the differences verbatim to get the tests consolidated.
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 18 Feb 2018 08:52:57 -0800] rev 35825
tests: port value-less unbundle capability test to test-push-http.t
This test is present in test-push-http-bundle1.t. Let's add it to
test-push-http.t to further unify the tests.
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 18 Feb 2018 08:49:18 -0800] rev 35824
tests: add phase testing to test-push-http-bundle1.t
test-push-http.t and test-push-http-bundle1.t were initially copies.
Now that we have support for inline test variants, we can combine them.
One of the variances between the tests is testing of phase moving.
We add the missing code to test-push-http-bundle1.t.
Jun Wu <quark@fb.com> [Fri, 16 Feb 2018 13:25:39 -0800] rev 35823
date: fix parsing months
Thanks nemo for discovering this on #mercurial IRC channel.
Test Plan:
Add a test. It fails before this patch:
```
+ hg: parse error: invalid date: 'Feb 2018'
+ hg: parse error: invalid date: 'Apr 2018'
+ hg: parse error: invalid date: 'Jun 2018'
+ hg: parse error: invalid date: 'Sep 2018'
+ hg: parse error: invalid date: 'Nov 2018'
```
Differential Revision: https://phab.mercurial-scm.org/D2289
Anton Shestakov <av6@dwimlabs.net> [Tue, 13 Feb 2018 18:12:26 +0800] rev 35822
tests: allow age to go up to triple digits in test-shelve.t
We started to glob the age of shelved changes in 51934fc796c0, which says that
sometimes tests run slow and `hg shelve --list` says "2s" instead of "1s".
However in some instances, like [1], tests run so slow that the age goes up to
double digits ("13s" in that case). When that happens, `hg shelve --list`
output has less white spaces after the age, so let's glob the spaces too. We
probably won't ever need to handle triple digits there, but I went ahead and
left only 2 required white spaces in total.
[1]: https://buildd.debian.org/status/fetch.php?pkg=mercurial&arch=sparc64&ver=4.5-1&stamp=1518360804&raw=0
Matt Harbison <matt_harbison@yahoo.com> [Tue, 06 Feb 2018 23:53:37 -0500] rev 35821
fileset: don't abort when running copied() on a revision with a removed file
It looks like AND with any status-y fileset would trigger this, as added() and
removed() also failed. The 4.5-rc revision is a convenient test case, but the
merge isn't necessary.
Augie Fackler <raf@durin42.com> [Thu, 01 Feb 2018 14:13:41 -0500] rev 35820
Added signature for changeset d334afc585e2
Augie Fackler <raf@durin42.com> [Thu, 01 Feb 2018 14:13:40 -0500] rev 35819
Added tag 4.5 for changeset d334afc585e2
Augie Fackler <augie@google.com> [Thu, 01 Feb 2018 14:11:18 -0500] rev 35818
merge with i18n
Wagner Bruna <wbruna@softwareexpress.com.br> [Wed, 31 Jan 2018 19:41:34 -0200] rev 35817
i18n-pt_BR: synchronized with 373fb3f5922c
Matt Harbison <matt_harbison@yahoo.com> [Sun, 28 Jan 2018 14:08:59 -0500] rev 35816
revset: evaluate filesets against each revision for 'file()' (issue5778)
After f2aeff8a87b6, the fileset was evaluated to a set of files against the
working directory, and then those files were applied against each revision. The
result was nonsense. For example, `hg log -r 'file("set:exec()")'` on the
Mercurial repo listed revision 0 because it has the `hg` script, which is
currently +x. But that bit wasn't applied until revision 280 (which
'contains()' properly indicates).
This technique was borrowed from checkstatus(), which services adds(),
modifies(), and removes(), so it seems safe enough. The 'r:' case is explicitly
assigned to wdirrev, freeing up rev=None to mean "re-evaluate at each revision".
The distinction is important to avoid behavior changes with `hg log set:...`
(test-largefiles-misc.t and test-fileset-generated.t drop current log output
without this). I'm not sure what the right behavior for that is (1fd352aa08fc
explicitly enabled this behavior for graphlog), but the day before the release
isn't the time to experiment.
Matt Harbison <matt_harbison@yahoo.com> [Wed, 31 Jan 2018 23:01:44 -0500] rev 35815
test-bookmarks-pushpull: stabilize for Windows
Anton Shestakov <av6@dwimlabs.net> [Thu, 01 Feb 2018 16:46:12 +0800] rev 35814
makefile: add Ubuntu Artful docker targets (.deb and ppa)
Artful Aardvark was released on 2017-10-19 and will be supported until 2018-07.
Boris Feld <boris.feld@octobus.net> [Wed, 31 Jan 2018 16:31:34 +0100] rev 35813
bundle2: fix the formatting of the stream part requirements
Use the same pre-encoded normalization as bundlespecs for the stream v2 part
requirements. As it touch the wire protocol, it needs to change before the
release.
This was spotted by Gregory Szorc.
Differential Revision: https://phab.mercurial-scm.org/D1950
Boris Feld <boris.feld@octobus.net> [Mon, 29 Jan 2018 10:28:10 +0100] rev 35812
streamclone: extract requirements formatting
It will be reused for the formatting of the requirements of the stream v2 part
requirement and later for the stream v2 requirements.
Differential Revision: https://phab.mercurial-scm.org/D1949
Boris Feld <boris.feld@octobus.net> [Tue, 30 Jan 2018 22:27:45 +0100] rev 35811
bookmarks: fix pushkey compatibility mode (issue5777)
The namespace used for the compatibility mode was missing a trailing 's'.
Jun Wu <quark@fb.com> [Tue, 30 Jan 2018 20:32:48 -0800] rev 35810
lazymanifest: avoid reading uninitialized memory
I got errors running tests with clang UBSAN [1] enabled. One of them is:
```
--- test-dirstate.t
+++ test-dirstate.t.err
@@ -85,9 +85,115 @@
$ echo "[extensions]" >> .hg/hgrc
$ echo "dirstateex=../dirstateexception.py" >> .hg/hgrc
$ hg up 0
- abort: simulated error while recording dirstateupdates
- [255]
+ mercurial/cext/manifest.c:781:13: runtime error: load of value 190, which is not a valid value for type 'bool'
+ #0 0x7f668a8cf748 in lazymanifest_diff mercurial/cext/manifest.c:781
+ #1 0x7f6692fc1dc4 in call_function Python-2.7.11/Python/ceval.c:4350
+ .......
+ SUMMARY: UndefinedBehaviorSanitizer: invalid-bool-load mercurial/cext/manifest.c:781:13 in
+ [1]
$ hg log -r . -T '{rev}\n'
1
$ hg status
- ? a
```
While the code is not technically wrong, but switching the condition would
make clang UBSAN happy. So let's do it.
The uninitialized memory could come from, for example, `lazymanifest_copy`
allocates `self->maxlines` items but only writes the first `self->lines`
items.
[1]: https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html
Test Plan:
Run `test-dirstate.t` with UBSAN and it no longer reports the issue.
Differential Revision: https://phab.mercurial-scm.org/D1948
Martin von Zweigbergk <martinvonz@google.com> [Fri, 26 Jan 2018 11:42:47 -0800] rev 35809
unamend: fix command summary line
Before this patch, the docstring started with a newline, which led the
summary line (shown in e.g. `hg help -c`) to be blank.
Differential Revision: https://phab.mercurial-scm.org/D1943
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 29 Jan 2018 13:30:29 -0800] rev 35808
configitems: traverse sections deterministically
Otherwise output can be non-deterministic if there are warnings
for multiple sections.
Differential Revision: https://phab.mercurial-scm.org/D1947
Matt Harbison <matt_harbison@yahoo.com> [Mon, 29 Jan 2018 21:42:18 -0500] rev 35807
lfs: don't require the .hglfs file to be tracked to control the policy
The .hgignore file doesn't need to be tracked, nor does the git equivalent of
this file. I'm still a little concerned about the effects of forgetting to
commit this file. But the fact that conversions maintain the hashes if only the
normal vs external storage changes, should make this less risky.
Augie Fackler <augie@google.com> [Sat, 27 Jan 2018 21:50:04 -0500] rev 35806
tests: add a pattern to fix --pure tests
Test Plan:
ran all tests with and without --pure, everything passed on gcc112.
Differential Revision: https://phab.mercurial-scm.org/D1946
Boris Feld <boris.feld@octobus.net> [Fri, 26 Jan 2018 16:01:42 +0100] rev 35805
streamclone: add a comment about non-publishing being broken with v1
This change was suggested by Gregory Szorc.
Boris Feld <boris.feld@octobus.net> [Fri, 26 Jan 2018 15:51:07 +0100] rev 35804
streamclone: move requirement update into consumev2
This change was suggested by Gregory Szorc.
Boris Feld <boris.feld@octobus.net> [Wed, 24 Jan 2018 21:44:31 +0100] rev 35803
streamclone: use readexactly when reading stream v2
Yuya Nishihara pointed out that it is safer.
Boris Feld <boris.feld@octobus.net> [Wed, 24 Jan 2018 21:37:48 +0100] rev 35802
streamclone: rename '_emit' to '_emit2' for clarity
This change was suggested by Gregory Szorc.
Yuya Nishihara <yuya@tcha.org> [Tue, 23 Jan 2018 21:14:36 +0900] rev 35801
help: do not suggest "update --clean ." to cancel uncommitted merge
Follows up 41ef02ba329b.
Matt Harbison <matt_harbison@yahoo.com> [Wed, 24 Jan 2018 22:26:28 -0500] rev 35800
minifileset: note the unsupported file pattern when raising a parse error
This was useful in debugging, because I stupidly quoted it out of habit from the
command line. This isn't a great example that clearly shows the problem, but I
don't know how to improve it. The problem *is* obvious once a complex statement
or a clearly bogus string is used.
Matt Harbison <matt_harbison@yahoo.com> [Tue, 23 Jan 2018 21:29:45 -0500] rev 35799
lfs: don't automatically exclude '.hg*' files from external tracking
The only reasons I did this in the first place was because tracking externally
seems like it would always be a mistake, and the eol extension does the same
thing. Yuya and Jun thought it might be better to not do this[1], so I'll defer
to them on this. If a problem with say, .hgtags or .hgeol does arise, it can be
added back without breaking existing repos.
[1] https://www.mercurial-scm.org/pipermail/mercurial-devel/2018-January/110371.html
Matt Harbison <matt_harbison@yahoo.com> [Tue, 23 Jan 2018 20:50:02 -0500] rev 35798
lfs: rename {oid} to {lfsoid}
Per Yuya, for consistency with {lfspointer}. It might be slightly confusing for
there to be {lfsoid} and {lfspointer.oid}. But preventing ambiguity seems more
important, and the latter is controlled by the git-lfs spec.
Matt Harbison <matt_harbison@yahoo.com> [Mon, 22 Jan 2018 17:47:40 -0500] rev 35797
lfs: rename {pointer} to {lfspointer}
Per Martin von Zweigbergk's suggestion to keep this unambiguous, for when it is
migrated to {files} and friends.
Augie Fackler <raf@durin42.com> [Mon, 22 Jan 2018 18:08:50 -0500] rev 35796
Added signature for changeset 27b6df1b5adb
Augie Fackler <raf@durin42.com> [Mon, 22 Jan 2018 18:08:49 -0500] rev 35795
Added tag 4.5-rc for changeset 27b6df1b5adb
Augie Fackler <augie@google.com> [Mon, 22 Jan 2018 17:53:02 -0500] rev 35794
merge with stable to begin 4.5 freeze
# no-check-commit because it's a clean merge
Gregory Szorc <gregory.szorc@gmail.com> [Sat, 20 Jan 2018 22:55:42 -0800] rev 35793
bundle2: increase payload part chunk size to 32kb
Bundle2 payload parts are framed chunks. Esentially, we obtain
data in equal size chunks of size `preferedchunksize` and emit those
to a generator. That generator is fed into a compressor (which can
be the no-op compressor, which just re-emits the generator). And
the output from the compressor likely goes to a file descriptor
or socket.
What this means is that small chunk sizes create more Python objects
and Python function calls than larger chunk sizes. And as we know,
Python object and function call overhead in performance sensitive
code matters (at least with CPython).
This commit increases the bundle2 part payload chunk size from 4k
to 32k. Practically speaking, this means that the chunks we feed
into a compressor (implemented in C code) or feed directly into a
file handle or socket write() are larger. It's possible the chunks
might be larger than what the receiver can handle in one logical
operation. But at that point, we're in C code, which is much more
efficient at dealing with splitting up the chunk and making multiple
function calls than Python is.
A downside to larger chunks is that the receiver has to wait for that
much data to arrive (either raw or from a decompressor) before it
can process the chunk. But 32kb still feels like a small buffer to
have to wait for. And in many cases, the client will convert from
8 read(4096) to 1 read(32768). That's happening in Python land. So
we cut down on the number of Python objects and function calls,
making the client faster as well. I don't think there are any
significant concerns to increasing the payload chunk size to 32kb.
The impact of this change on performance significant. Using `curl`
to obtain a stream clone bundle2 payload from a server on localhost
serving the mozilla-unified repository:
before: 20.78 user; 7.71 system; 80.5 MB/s
after: 13.90 user; 3.51 system; 132 MB/s
legacy: 9.72 user; 8.16 system; 132 MB/s
bundle2 stream clone generation is still more resource intensive than
legacy stream clone (that's likely because of the use of a
util.chunkbuffer). But the throughput is the same. We might
be in territory we're this is effectively a benchmark of the
networking stack or Python's syscall throughput.
From the client perspective, `hg clone -U --stream`:
before: 33.50 user; 7.95 system; 53.3 MB/s
after: 22.82 user; 7.33 system; 72.7 MB/s
legacy: 29.96 user; 7.94 system; 58.0 MB/s
And for `hg clone --stream` with a working directory update of
~230k files:
after: 119.55 user; 26.47 system; 0:57.08 wall
legacy: 126.98 user; 26.94 system; 1:05.56 wall
So, it appears that bundle2's stream clone is now definitively faster
than legacy stream clone!
Differential Revision: https://phab.mercurial-scm.org/D1932
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 22 Jan 2018 12:23:47 -0800] rev 35792
bundle2: always advertise client support for stream parts
Previously, enabling of stream clone over bundle2 was a server-side
only change. And clients would only advertise bundle2 support for
stream clones if an experimental config option was set.
This situation wasn't forward compatible because in the future
(when the feature is enabled on servers by default), an old client
would send a request to the server but it wouldn't send its own
bundle2 capability support for stream parts. Servers would have to
infer that clients not sending this capability were old Mercurial
clients that only sent the capability if the feature was
explicitly enabled. Implicit and inferred behavior makes implementing
servers hard. It's much better to be explicit about client features.
We should either make the config option for bundle2 stream clones
disable the feature client-side as well (so a server doesn't see
a request from a client not advertising stream support). Or we
should always advertise stream support if a client is willing
to accept stream parts.
Since I anticipating stabilizing stream clone support in bundle2
quickly, I think it's safe to always advertise client support
in the bundle2 capabilities. So this commit changes things to
do that.
Because capabilities now vary between client and server, we had
to create variations of the variable substitutions for those
strings.
Differential Revision: https://phab.mercurial-scm.org/D1931
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 22 Jan 2018 12:22:01 -0800] rev 35791
exchange: don't send stream data when server.uncompressed is set
Previously, bundle2 stream support would send out data even though
the streaming clone feature was disabled. This commit changes
the part handler to respect the server config.
Differential Revision: https://phab.mercurial-scm.org/D1930
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 22 Jan 2018 12:21:15 -0800] rev 35790
bundle2: don't advertise stream bundle2 capability when feature disabled
The server.uncompressed config option can be used to disable streaming
clones. While the top-level capability to advertise streaming clone
support isn't advertised when this option is set, we were still sending
the bundle2-level capabilities advertising support for stream parts.
It makes sense to not advertise that support when streaming clones
are globally disabled.
If the structure of the new code seems a bit odd, it is because we'll
have to further tweak the behavior in commit(s) ahead.
Differential Revision: https://phab.mercurial-scm.org/D1929
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 22 Jan 2018 12:19:45 -0800] rev 35789
tests: add more testing around server.uncompressed
We already have testing for server.uncompressed in test-http*.t.
However, it doesn't cover the new bundle2 use case. And, we don't
have comprehensive testing of advertised capabilities.
We add tests to test-clone-uncompressed.t that demonstrate
behavior for both legacy and bundle2 configurations.
If you look closely, the bundle2 capabilities are advertising
stream support when it isn't enabled. That's a bug.
In addition, while the client is smart enough to not request
a stream clone when the server doesn't have the feature enabled,
the getbundle wire protocol command is still sending stream
clone data. This doesn't match the behavior of the legacy
stream_out wire protocol command. That's also a bug. Tests
have been added.
While I was here, I also changed how the PID is recorded in
$DAEMON_PIDS. If we kill a process, the PID formerly in
$DAEMON_PIDS no longer exists. So we should replace that file
instead of appending to it.
Differential Revision: https://phab.mercurial-scm.org/D1928
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 22 Jan 2018 12:19:49 -0800] rev 35788
bundle2: move version of stream clone into part name
I don't like having version numbers as part parameters. It means
that parts can theoretically vary wildly in their generation and
processing semantics. I think that a named part should have consistent
behavior over time. In other words, if you need to introduce new
functionality or behavior, that should be expressed by inventing
a new bundle2 part, not adding functionality to an existing part.
This commit applies this advice to the just-introduced stream clone
via bundle2 feature.
The "version" part parameter is removed. The name of the bundle2 part
is now "stream2" instead of "stream" with "version=v2".
Differential Revision: https://phab.mercurial-scm.org/D1927
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 22 Jan 2018 12:12:29 -0800] rev 35787
exchange: send bundle2 stream clones uncompressed
Stream clones don't compress well. And compression undermines
a point of stream clones which is to trade significant CPU
reductions by increasing size.
Building upon our introduction of metadata to communicate bundle
information back to callers of exchange.getbundlechunks(), we add
an attribute to the bundler that communicates whether the bundle is
best left uncompressed. We return this attribute as part of the bundle
metadata. And the wire protocol honors it when determining whether
to compress the wire protocol response.
The added test demonstrates that the raw result from the wire
protocol is not compressed. It also demonstrates that the server
will serve stream responses when the feature isn't enabled. We'll
address that in another commit.
The effect of this change is that server-side CPU usage for bundle2
stream clones is significantly reduced by removing zstd compression.
For the mozilla-unified repository:
before: 37.69 user 8.01 system
after: 27.38 user 7.34 system
Assuming things are CPU bound, that ~10s reduction would translate to
faster clones on the client. zstd can decompress at >1 GB/s. So the
overhead from decompression on the client is small in the grand scheme
of things. But if zlib compression were being used, the overhead would
be much greater.
Differential Revision: https://phab.mercurial-scm.org/D1926
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 22 Jan 2018 12:38:04 -0800] rev 35786
tests: update test to work with Git 2.16
It looks like Git 2.16 removed the "..." from some strings.
Glob over those characters in the test output.
Differential Revision: https://phab.mercurial-scm.org/D1935
Gregory Szorc <gregory.szorc@gmail.com> [Sat, 20 Jan 2018 13:41:57 -0800] rev 35785
exchange: return bundle info from getbundlechunks() (API)
We generally want a mechanism to pass information about the
generated bundle back to callers (in addition to the byte stream).
Ideally we would return a bundler from this function and have the
caller code to an interface. But the bundling APIs are not great
and getbundlechunks() is the best API we have for obtaining bundle
contents in a unified manner.
We change getbundlechunks() to return a dict that we can use to
communicate metadata.
We populate that dict with the bundle version number to demonstrate
some value.
.. api::
exchange.getbundlechunks() now returns a 2-tuple instead of just
an iterator.
Differential Revision: https://phab.mercurial-scm.org/D1925
Gregory Szorc <gregory.szorc@gmail.com> [Sat, 20 Jan 2018 15:26:31 -0800] rev 35784
exchange: make stream bundle part deterministic
repo.requirements is a set. We need to sort it so the part
content is deterministic.
Differential Revision: https://phab.mercurial-scm.org/D1924
Gregory Szorc <gregory.szorc@gmail.com> [Sat, 20 Jan 2018 13:54:36 -0800] rev 35783
bundle2: specify what capabilities will be used for
We currently assume there is a symmetric relationship of bundle2
capabilities between client and server. However, this may not always be
the case.
We need a bundle2 capability to advertise bundle2 streaming clone support
on servers to differentiate it from the existing, legacy streaming clone
support.
However, servers may wish to disable streaming clone support. If bundle2
capabilities were the same between client and server, a client (which
may also be a server) that has disabled streaming clone support would
not be able to perform a streaming clone itself!
This commit introduces a "role" argument to bundle2.getrepocaps() that
explicitly defines the role being performed. This will allow us (and
extensions) to alter bundle2 capabilities depending on the operation
being performed.
Differential Revision: https://phab.mercurial-scm.org/D1923
Gregory Szorc <gregory.szorc@gmail.com> [Sat, 20 Jan 2018 15:43:02 -0800] rev 35782
wireproto: don't compress errors from getbundle()
Errors should be small. There's no real need to compress them.
Truth be told, there's no good reason to not compress them either.
But leaving them uncompressed makes it easier to test failures
by looking at the raw HTTP response. This makes it easier for us
to write tests. It may make it easier for people writing their
own clients.
Differential Revision: https://phab.mercurial-scm.org/D1922
Gregory Szorc <gregory.szorc@gmail.com> [Sat, 20 Jan 2018 16:08:07 -0800] rev 35781
tests: teach get-with-headers.py some new tricks
We add the ability to specify arbitrary HTTP request headers and
to save the HTTP response body to a file. These will be used in
upcoming commits.
Differential Revision: https://phab.mercurial-scm.org/D1921
Gregory Szorc <gregory.szorc@gmail.com> [Sat, 20 Jan 2018 14:59:08 -0800] rev 35780
tests: use argparse in get-with-headers.py
I'm about to add another flag and I don't want to deal with this
organic, artisanal argument parser.
Differential Revision: https://phab.mercurial-scm.org/D1920
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 21 Jan 2018 17:11:31 -0800] rev 35779
convert: use a collections.deque
This function was doing a list.pop(0) on a list whose length
was the number of revisions to convert. Popping an early element
from long lists is not an efficient operation.
collections.deque supports efficient inserts and pops at both
ends. So we switch to that data structure.
When converting the mozilla-unified repository, which has 445,748
revisions, this change makes the "sorting..." step of
`hg convert --sourcesort` significantly faster:
before: ~59.2s
after: ~1.3s
Differential Revision: https://phab.mercurial-scm.org/D1934
Martin von Zweigbergk <martinvonz@google.com> [Sat, 20 Jan 2018 23:21:59 -0800] rev 35778
repair: invalidate volatile sets after stripping
Matt Harbison reported that some tests were broken on Windows after
1a09dad8b85a (evolution: report new unstable changesets,
2018-01-14). The failures were exactly as seen in this patch. The
failures actually seemed correct, which made me wonder why they didn't
fail the same way on Linux. It turned out to be a cache invalidation
problem.
The new orphan mentioned in the test case actually does get created
when we're re-applying the temporary bundle that's created while
stripping. However, without the invalidation, it appears that there
was already an orphan before applying the temporary bundle.
The warnings about unknown working parent appear because the
aformentioned changeset means that we're now accessing the dirstate
while it's invalid.
We may want to suppress these messages that happen in the intermediate
strip state, but they're technically correct (although confusing to
the user), so I think just fixing the cache invalidation is fine for
now.
I haven't figured out why the caches seemed to get correctly
invalidated on Windows.
Differential Revision: https://phab.mercurial-scm.org/D1933
Matt Harbison <matt_harbison@yahoo.com> [Sun, 21 Jan 2018 13:54:05 -0500] rev 35777
subrepo: handle 'C:' style paths on the command line (issue5770)
If you think 'C:' and 'C:\' are equivalent paths, see the inline comment before
proceeding.
The problem here was that several commands that take a URL argument (incoming,
outgoing, pull, and push) will use that value to set 'repo._subtoppath' on the
repository object after command specific manipulation of it, but before
converting it to an absolute path. When an operation is performed on a relative
subrepo, subrepo._abssource() will posixpath.join() this value with the relative
subrepo path. That adds a '/' after the drive letter, changing how it is
evaluated by abspath()/realpath() in vfsmod.vfs(..., realpath=True) as the
subrepo is instantiated.
I initially tried sanitizing the path in url.localpath(), because url.isabs()
only checks that it starts with a drive letter. By the sample behavior, this is
clearly not an absolute path. (Though the comment in isabs() is weasely- this
style path can't be joined either.) But not everything funnels through there,
and it required explicitly calling localpath() in hg.parseurl() and assigning to
url.path to fix. But then tests failed with urls like 'a#0'.
Next up was sanitizing the path in the url constructor. That caused doctest
failures, because there are drive letter tests, so those got expanded in system
specific ways. Yuya correctly pointed out that util.url is a parser, and
shouldn't be substituting the path too.
Rather than fixing every command call site, just convert it in the common
subrepo location. I don't see any sanitizing on the path config options, so I
fixed those too. Note that while the behavior is fixed here, there are still
places where 'comparing with C:' gets printed out, and that's not great for
debugging purposes. (Specifically I saw it in `hg incoming -B C:`, without
subrepos.) While clone will write out an absolute default path, I wonder what
would happen if a user edited that path to be 'C:'. (I don't think supporting
relative paths in .hgrc is a sane thing to do, but while we're poking holes in
things...)
Since this is such an oddball case, it still leaks through in places, and there
seems to be a lot of duplicate url parsing, maybe the url parsing should be
moved to dispatch, and provide the command with a url object? Then we could
convert this to an absolute path once, and not have to worry about it in the
rest of the code.
I also checked '--cwd C:' on the command line, and it was previously working
because os.chdir() will DTRT.
Finally, one other note from the url.localpath() experimenting. I don't see any
cases where 'self._hostport' can hold a drive letter. So I'm wondering if that
is wrong/old code.
Matt Harbison <matt_harbison@yahoo.com> [Mon, 22 Jan 2018 00:39:42 -0500] rev 35776
dummysmtpd: don't die on client connection errors
The connection refused error in test-patchbomb-tls.t[1] is sporadic, but one of
the more often seen errors on Windows. I added enough logging to a file and
dumped it out at the end to make the following observations:
- The listening socket is successfully created and bound to the port, and the
"listening at..." message is always logged.
- Generally, the following is the entire log output, with the "accepted ..."
message having been added after `sslutil.wrapserversocket`:
listening at localhost:$HGPORT
$LOCALIP ssl error
accepted connect
accepted connect
$LOCALIP from=quux to=foo, bar
$LOCALIP ssl error
- In the cases that fail, asyncore.loop() in the run() method is exiting, but
not with an exception.
- In the cases that fail, the following is logged right after "listening ...":
Traceback (most recent call last):
File "c:\\Python27\\lib\\asyncore.py", line 83, in read
obj.handle_read_event()
File "c:\\Python27\\lib\\asyncore.py", line 443, in handle_read_event
self.handle_accept()
File "../tests/dummysmtpd.py", line 80, in handle_accept
conn = sslutil.wrapserversocket(conn, ui, certfile=self._certfile)
File "..\\mercurial\\sslutil.py", line 570, in wrapserversocket
return sslcontext.wrap_socket(sock, server_side=True)
File "c:\\Python27\\lib\\ssl.py", line 363, in wrap_socket
_context=self)
File "c:\\Python27\\lib\\ssl.py", line 611, in __init__
self.do_handshake()
File "c:\\Python27\\lib\\ssl.py", line 840, in do_handshake
self._sslobj.do_handshake()
error: [Errno 10054] $ECONNRESET$
- If the base class handler is overridden completely, the the first "ssl
error" line is replaced by the stacktrace, but the other lines are
unchanged. The client behaves no differently, whether or not the server
stacktraced.
In general, `./run-tests.py --local -j9 -t9000 test-patchbomb-tls.t
--runs-per-test 20` would show the issue after a run or two. With this change,
`./run-tests.py --local -j9 -t9000 test-patchbomb-tls.t --loop` ran 800 times
without a hiccup. This makes me wonder if the other connection refused messages
that bubble up on occasion are caused by a similar issue. It seems a bit
drastic to kill the whole server on account of a single communication failure
with a client.
# no-check-commit because of handle_error()
[1] https://buildbot.mercurial-scm.org/builders/Win7%20x86_64%20hg%20tests/builds/421/steps/run-tests.py%20%28python%202.7.13%29/logs/stdio
André Sintzoff <andre.sintzoff@gmail.com> [Sun, 21 Jan 2018 15:39:48 +0100] rev 35775
cext: define MIN macro only if it is not yet defined
MIN macro is defined in <sys/param.h> on macOS Sierra. Therefore as
HAVE_BSD_STATFS is defined in osutil.c, 'MIN' macro redefined warning is
emitted.
Anton Shestakov <av6@dwimlabs.net> [Sun, 21 Jan 2018 14:47:45 +0800] rev 35774
copyright: update to 2018
January seems to be a good month to do this.
Anton Shestakov <av6@dwimlabs.net> [Sun, 21 Jan 2018 14:46:26 +0800] rev 35773
tests: glob copyright years in test-extension.t
Other tests already do this.
Matt Harbison <matt_harbison@yahoo.com> [Sat, 20 Jan 2018 14:21:40 -0500] rev 35772
test-sshserver: stabilize for Windows
Matt Harbison <matt_harbison@yahoo.com> [Sat, 20 Jan 2018 14:02:05 -0500] rev 35771
test-branch-change: stabilize for Windows
Matt Harbison <matt_harbison@yahoo.com> [Sat, 20 Jan 2018 13:57:11 -0500] rev 35770
test-sparse: make the '.hg' exclusion filter Windows compatible
Matt Harbison <matt_harbison@yahoo.com> [Fri, 19 Jan 2018 19:20:50 -0500] rev 35769
lfs: rename {lfsattrs} to {pointer}
This seems more descriptive.
Matt Harbison <matt_harbison@yahoo.com> [Fri, 19 Jan 2018 21:29:31 -0500] rev 35768
lfs: expand the user facing documentation
Boris Feld <boris.feld@octobus.net> [Thu, 18 Jan 2018 00:50:12 +0100] rev 35767
streamclone: also stream caches to the client
When stream clone is used over bundle2, relevant cache files are also streamed.
This is expected to be a massive performance win for clone since no important
cache will have to be recomputed.
Some performance numbers:
(All times are wall-clock times in seconds, 2 attempts per case.)
# Mozilla-Central
## Clone over ssh over lan
V1 streaming: 234.3 239.6
V2 streaming: 248.4 243.7
## Clone over ssh over Internet
V1 streaming: 175.5 110.9
V2 streaming: 109.1 111.0
## Clone over HTTP over lan
V1 streaming: 105.3 105.6
V2 streaming: 112.7 111.4
## Clone over HTTP over internet
V1 streaming: 105.6 114.6
V2 streaming: 226.7 225.9
## Hg tags
V1 streaming (no cache): 1.084 1.071
V2 streaming (cache): 0.312 0.325
## Hg branches
V1 streaming (no cache): 14.047 14.148
V2 streaming (with cache): 0.312 0.333
# Pypy
## Clone over ssh over internet
V1 streaming: 29.4 30.1
V2 streaming: 31.2 30.1
## Clone over http over internet
V1 streaming: 29.7 29.7
V2 streaming: 75.2 72.9
(since ssh and lan are not affected, there seems to be an issue with how we
read/write the http stream on connection with latency, unrelated to the format)
## Hg tags
V1 streaming (no cache): 1.752 1.664
V2 streaming (with cache): 0.274 0.260
## Hg branches
V1 streaming (no cache): 4.469 4.728
V2 streaming (with cache): 0.318 0.321
# Private repository:
* 500K revision revisions
* 11K topological heads
* 28K branch heads
## hg tags
no cache: 1543.332
with cache: 4.900
## hg branches
no cache: 91.828
with cache: 2.955
Boris Feld <boris.feld@octobus.net> [Wed, 17 Jan 2018 17:46:49 +0100] rev 35766
caches: make 'cachetocopy' available in scmutil
For more code to use this information, we need it to be more publicly available.
Boris Feld <boris.feld@octobus.net> [Thu, 18 Jan 2018 00:50:02 +0100] rev 35765
streamclone: add support for cloning non append-only file
The phaseroots are stored in a non append-only file in the repository. We
include them in the stream too. Since they are not append-only, we have to
keep a copy around while we hold the lock to be able to stream them later.
Since phase get exchanged within the stream we can skip requesting them
independently.
As a side effect, this will fixes issue5648 once the feature is enabled by
default.
Boris Feld <boris.feld@octobus.net> [Thu, 18 Jan 2018 02:28:44 +0100] rev 35764
streamclone: tests phase exchange during stream clone
We add a test dedicated to phases. As reported in issue 5648 stream from a non publishing
server is currently broken (does not preserve the phase). We'll fix it with 'v2'
support in the next changesets.
Boris Feld <boris.feld@octobus.net> [Wed, 17 Jan 2018 16:41:44 +0100] rev 35763
streamclone: add support for bundle2 based stream clone
The feature put to use the various bits introduced previously. If the server
supports it, the client will request its stream clone through bundle2 instead of
the legacy 'stream_out' commands. The bundle2 version use the better 'v2'
version of stream bundles.
The 'v2' format is not finalized yet. Now that there are some code running it,
we can start working on it again.
Performance numbers are available at the end of this series.
Boris Feld <boris.feld@octobus.net> [Wed, 17 Jan 2018 14:13:46 +0100] rev 35762
pull: preindent some code
Next changesets will add support for using stream cloning with bundle2. We
introduce indentation change first for clarity.
Boris Feld <boris.feld@octobus.net> [Wed, 17 Jan 2018 16:32:05 +0100] rev 35761
pull: reorganize bundle2 argument bundling
We are about to add the ability to use stream bundle with bundle2. Before doing
so, we need to gather some code that will not be used in the bundle2 case. There
is no behavior change within this changeset.
Boris Feld <boris.feld@octobus.net> [Wed, 17 Jan 2018 16:38:32 +0100] rev 35760
clone: allow bundle2's stream clone with 'server.disablefullbundle'
The previous check was a bit too strict and would not recognize a get bundle
not requesting changegroup.
Boris Feld <boris.feld@octobus.net> [Wed, 17 Jan 2018 16:36:23 +0100] rev 35759
bundle2: add support for a 'stream' parameter to 'getbundle'
This parameter can be used to request a stream bundle.
Boris Feld <boris.feld@octobus.net> [Wed, 17 Jan 2018 16:35:22 +0100] rev 35758
bundle2: add a 'stream' part handler for stream cloning
The part contains the necessary arguments and payload to handle a stream bundle
v2. It will be put to use in later changesets.
Boris Feld <boris.feld@octobus.net> [Thu, 18 Jan 2018 00:45:27 +0100] rev 35757
streamclone: rework canperformstreamclone
There is code about bundle2 laying around in `canperformstreamclone` but not
put to any uses. As we discovered with the previous patch, streambundle 'v1'
won't work on bundle2 because they are readline based. So we jump to 'v2' as
the first expected supported version.
Boris Feld <boris.feld@octobus.net> [Thu, 18 Jan 2018 00:48:56 +0100] rev 35756
streamclone: define first iteration of version 2 of stream format
(This patch is based on a first draft from Gregory Szorc, with deeper rework)
Version 1 of the stream clone format was invented many years ago and suffers
from a few deficiencies:
1) Filenames are stored in store-encoded (on filesystem) form rather than in
their internal form. This makes future compatibility with new store
filename encodings more difficult.
2) File entry "headers" consist of a newline of the file name followed by the
string file size. Converting strings to integers is avoidable overhead. We
can't store filenames with newlines (manifests have this limitation as
well, so it isn't a major concern). But the big concern here is the
necessity for readline(). Scanning for newlines means reading ahead and
that means extra buffer allocations and slicing (in Python) and this makes
performance suffer.
3) Filenames aren't compressed optimally. Filenames should be compressed well
since there is a lot of repeated data. However, since they are scattered
all over the stream (with revlog data in between), they typically fall
outside the window size of the compressor and don't compress.
4) It can only exchange stored based content, being able to exchange caches
too would be nice.
5) It is limited to a stream-based protocol and isn't suitable for an on-disk
format for general repository reading because the offset of individual file
entries requires scanning the entire file to find file records.
As part of enabling streaming clones to work in bundle2, #2 proved to have a
significant negative impact on performance. Since bundle2 provides the
opportunity to start fresh, Gregory Szorc figured he would take the
opportunity to invent a new streaming clone data format.
The new format devised in this series addresses #1, #2, and #4. It punts on #3
because it was complex without yielding a significant gain and on #5 because
devising a new store format that "packs" multiple revlogs into a single
"packed revlog" is massive scope bloat. However, this v2 format might be
suitable for streaming into a "packed revlog" with minimal processing. If it
works, great. If not, we can always invent stream format when it is needed.
This patch only introduces the bases of the format. We'll get it usable through
bundle2 first, then we'll extend the format in future patches to bring it to its
full potential (especially #4).
Gregory Szorc <gregory.szorc@gmail.com> [Fri, 19 Jan 2018 22:52:35 +0100] rev 35755
util: implement varint functions
This will be useful in an incoming version-2 of the stream format.
Boris Feld <boris.feld@octobus.net> [Fri, 19 Jan 2018 20:51:35 +0100] rev 35754
util: move 'readexactly' in the util module
This function is used in multiple place, having it in util would be better.
(existing caller will be migrated in another series)
Matt Harbison <matt_harbison@yahoo.com> [Fri, 19 Jan 2018 19:13:11 -0500] rev 35753
lfs: separate a debug message from the subsequent abort message
Siddharth Agarwal <sid0@fb.com> [Fri, 19 Jan 2018 14:25:09 -0800] rev 35752
sshserver: add a couple of tests for argument parsing
I noticed that we didn't have any unit tests covering wire protocol argument
parsing.
Augie Fackler <augie@google.com> [Fri, 19 Jan 2018 16:28:11 -0500] rev 35751
merge with stable
Joerg Sonnenberger <joerg@bec.de> [Fri, 12 Jan 2018 10:59:58 +0100] rev 35750
wireproto: split streamres into legacy and modern case
A couple of commands currently require transmission of uncompressed
frames with the old MIME type. Split this case from streamres into
a new streamres_legacy class. Streamline the remaining code accordingly.
Add a new flag to streamres to request uncompressed streams. This is
useful for sending data that is already compressed like a pre-built
bundle. Expect clients to support uncompressed data. For older clients,
zlib will still be used.
Differential Revision: https://phab.mercurial-scm.org/D1862
Martin von Zweigbergk <martinvonz@google.com> [Fri, 19 Jan 2018 12:33:03 -0800] rev 35749
localrepo: run cache-warming transaction callback before report callback
See in-code comment for details.
Differential Revision: https://phab.mercurial-scm.org/D1918
Martin von Zweigbergk <martinvonz@google.com> [Fri, 19 Jan 2018 11:35:55 -0800] rev 35748
scmutil: 0-pad transaction report callback category
Before this patch, the transaction name was '%2i-txnreport', which
means the first one would be ' 0-txnreport'. It seems more intuitive
for sorting purposes (the callbacks are called in lexicographical
order) to make it 0-padded.
Differential Revision: https://phab.mercurial-scm.org/D1917
Boris Feld <boris.feld@octobus.net> [Wed, 17 Jan 2018 16:01:06 +0100] rev 35747
stream: add a test showing we also clone bookmarks
Bookmarks are not stored in `.hg/store`. We need to make sure they are cloned
with `--stream`.
Pulkit Goyal <7895pulkit@gmail.com> [Fri, 19 Jan 2018 18:45:20 +0530] rev 35746
branch: allow changing branch name to existing name if possible
With the functionality added in previous patch we can change branches of a
revision but not everytime even if it's possible to do so. For example cosider
the following case:
o 3 added a (foo)
o 2 added b (foo)
o 1 added c (bar)
o 0 added d (bar)
Here if I want to change the branch of rev 2,3 to bar, it was not possible and
it will say, "a branch with same name exists".
This patch allows us to change branch of 2,3 to bar. The underlying logic for
changing branch finds the changesets from the revs passed which have no parents
in revs. We only support revsets which have only one such root, so to support
this we check whether the parent of the root has the same name as that of the
new name and if so, we can use the new name to change branches.
Differential Revision: https://phab.mercurial-scm.org/D1913
Pulkit Goyal <7895pulkit@gmail.com> [Sun, 15 Oct 2017 23:08:45 +0530] rev 35745
branch: add a --rev flag to change branch name of given revisions
This patch adds a new --rev flag to hg branch which can be used to change branch
of revisions. This is motivated from topic extension where you can change topic
on revisions but this one has few restrictions which are:
1) You cannot change branch name in between the stack
2) You cannot change branch name and set it to an existing name
3) You cannot change branch of non-linear set of commits
4) You cannot change branch of merge commits.
Tests are added for the same.
.. feature::
An experimental flag `--rev` to `hg branch` which can be used to change
branch of changesets.
Differential Revision: https://phab.mercurial-scm.org/D1074
Yuya Nishihara <yuya@tcha.org> [Tue, 16 Jan 2018 23:50:01 +0900] rev 35744
templater: fix crash by empty group expression
'exp' may be None because of '(group None)' node. The error message is copied
from revset.py.
Yuya Nishihara <yuya@tcha.org> [Tue, 16 Jan 2018 21:46:17 +0900] rev 35743
log: fix typo in comment about _matchfiles()
Hollis Blanchard <hollis_blanchard@mentor.com> [Thu, 18 Jan 2018 13:33:21 -0800] rev 35742
sparse: --include 'dir1/dir2' should not include 'dir1/*'
In 2015 there was a workaround added (f39bace2d6cad32907c0d7961b3c0dbd64a1b7ad)
to sparse in the hg-experimental repo. That workaround:
a) no longer seems to be needed, since its testcase passes even with the code
removed, and
b) caused a new problem: --include 'dir1/dir2' ended up including dir1/*
too. (--include 'glob:dir1/dir2' is a user-level workaround.)
Remove the offending code, and add a testcase for situation B.
Yuya Nishihara <yuya@tcha.org> [Sun, 14 Jan 2018 13:29:15 +0900] rev 35741
fileset: add kind:pat operator
":" isn't taken as a symbol character but an infix operator so we can write
e.g. "path:'foo bar'" as well as "'path:foo bar'". An invalid pattern kind
is rejected in the former form as we know a kind is specified explicitly.
The binding strength is copied from "x:y" range operator of revset. Perhaps
it can be adjusted later if we want to parse "foo:bar()" as "(foo:bar)()",
not "foo:(bar())". We can also add "kind:" postfix operator if we want.
One possible confusion is that the scope of the leading "set:" vs "kind:pat"
operator. The former is consumed by a matcher so applies to the whole fileset
expression:
$ hg files 'set:foo() or kind:bar or baz'
^^^^^^^^^^^^^^^^^^^^^^^^
Whereas the scope of kind:pat operator is narrow:
$ hg files 'set:foo() or kind:bar or baz'
^^^
Yuya Nishihara <yuya@tcha.org> [Sun, 14 Jan 2018 13:33:56 +0900] rev 35740
minifileset: unify handling of symbol and string patterns
They must be identical for fileset compatibility.
Yuya Nishihara <yuya@tcha.org> [Sun, 14 Jan 2018 13:28:20 +0900] rev 35739
fileset: move import of match module to top
Actually there was no circular import issue.
Paul Morelle <paul.morelle@octobus.net> [Sun, 14 Jan 2018 21:28:12 +0100] rev 35738
revlog: group delta computation methods under _deltacomputer object
Extracting these methods from revlog will allow changing the implementation of
the deltacomputer, by providing this interface:
__init__(self, revlog) - constructor that initialize the object from a given
revlog
buildtext(self, revinfo, fh) - builds the fulltext version of a revision from
a _revisioninfo object and the file handle to
the .d (or .i for inline mode) file.
finddeltainfo(self, revinfo, fh) - find a revision in the revlog against
which it is acceptable to build a delta,
and build the corresponding _deltainfo.
It should now be easier to write an experimental feature that would replace
_deltacomputer by another object, for example one that would know how to
parallelize the delta computation in order to quicken the storage of multiple
revisions.
Paul Morelle <paul.morelle@octobus.net> [Sun, 14 Jan 2018 14:36:22 +0100] rev 35737
revlog: refactor out _finddeltainfo from _addrevision
Splicing the code into smaller chunks should help understanding it,
and eventually override some parts in experimental branches to try
optimization.
Yuya Nishihara <yuya@tcha.org> [Fri, 19 Jan 2018 21:39:11 +0900] rev 35736
localrepo: micro-optimize __len__() to bypass repoview
Since len(changelog) isn't overridden, we don't have to validate a cache of
unfiltered changelog.
$ python -m timeit -n 10000 \
-s 'from mercurial import hg, ui; repo = hg.repository(ui.ui());' \
'len(repo)'
orig) 10000 loops, best of 3: 32.1 usec per loop
new) 10000 loops, best of 3: 1.79 usec per loop
Spotted by Jordi Gutiérrez Hermoso.
Matt Harbison <matt_harbison@yahoo.com> [Thu, 18 Jan 2018 21:18:10 -0500] rev 35735
lfs: defer registering the pre-push hook until blobs are committed
The hook searches outgoing commits for blobs, and uploads them before letting
the push occur. No reason to search for that which isn't there.
Matt Harbison <matt_harbison@yahoo.com> [Thu, 18 Jan 2018 18:04:56 -0500] rev 35734
lfs: dump the full response on httperror in debug mode
This was immensely helpful in diagnosing the 500: Internal Server Error when
using workers to upload. It's a nasty wall of html, so we really can't do
anything else with it.
Matt Harbison <matt_harbison@yahoo.com> [Thu, 18 Jan 2018 15:59:21 -0500] rev 35733
lfs: default the User-Agent header for blob transfers to 'git-lfs'
The custom User-Agent for blob transfers was added in e7bb5fc4570c. Now I've
hit another incompatibility with a server wanting the string to start with
'git' or 'git-lfs' [1]. I don't feel strongly about this either way, but a
Wireshark trace of git shows that when the Batch API is hit, the User-Agent is
'git-lfs/2.3.4'. So this would probably ensure maximum interoperability.
This still leaves the experimental knob in, just in case.
[1] https://bitbucket.org/sdorra/scm-manager/src/095a027178888bc2b819aebfae3d2c192c858030/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/web/GitUserAgentProvider.java?at=default&fileviewer=file-view-default#GitUserAgentProvider.java-117
Matt Harbison <matt_harbison@yahoo.com> [Thu, 18 Jan 2018 15:11:34 -0500] rev 35732
lfs: default to not using workers for upload/download
I ran into truncated uploads with this defaulting to on. Wojciech Lis diagnosed
it as creating keepalive connections prior to forking, and illegally
multiplexing the same connection. [1] I didn't notice a problem with the couple
of downloads I tried, but disabled both for simplicity and safety.
[1] https://www.mercurial-scm.org/pipermail/mercurial-devel/2018-January/109916.html
Matt Harbison <matt_harbison@yahoo.com> [Sun, 14 Jan 2018 17:00:24 -0500] rev 35731
lfs: add the '{lfsattrs}' template keyword to '{lfs_files}'
This provides access to the metadata dictionary contained within the tracked
pointer file. The OID is probably the most important attribute, and has its own
keyword. But we might as well have this for completeness.
I liked {pointer} better, but couldn't make it work with the singular/plural
forms.
Boris Feld <boris.feld@octobus.net> [Thu, 18 Jan 2018 16:47:14 +0100] rev 35730
debugdownload: read repository hgrc if there is one
The command does not require a repository, but will use it if there is one.
This simplifies the reading of the remote destination when testing for
largefile based url.
Matt Harbison <matt_harbison@yahoo.com> [Fri, 19 Jan 2018 00:18:45 -0500] rev 35729
test-blackbox: stabilize for Windows
This goes with 853bf7d90804.
Paul Morelle <paul.morelle@octobus.net> [Fri, 19 Jan 2018 08:35:22 +0100] rev 35728
debugdeltachain: cleanup the double call to _slicechunk
Follow-up to Yuya's review on 43154a76f3927c4f0c8c6b02be80f0069c7d8fdb:
> Nit: hasattr() isn't necessary. revlog._slicechunk() is used in the previous
> block.
hasattr() isn't necessary indeed, as we are protected by the withsparseread
option, which was introduced at the same time as revlog._slicechunk, in
e2ad93bcc084b97c48f54c179365376edb702858.
And, as Yuya noticed, _slicechunk could be called only once.
Pulkit Goyal <7895pulkit@gmail.com> [Fri, 19 Jan 2018 14:10:18 +0530] rev 35727
blackbox: don't unpack the list while passing into str.join()
The current state may result in error TypeError.
Caught using evolve-tests.
Boris Feld <boris.feld@octobus.net> [Wed, 17 Jan 2018 17:07:55 +0100] rev 35726
atomicupdate: add an experimental option to use atomictemp when updating
In some cases Mercurial truncating files when updating causes problems. It can
happens when processes are currently reading the file or with big file or on
NFS mounts.
We add an experimental option to use the atomictemp option of vfs.__call__ in
order to avoid the problem.
The localrepository.wwrite seems to assume the files are created without the
`x` flag; with atomictempfile, the new file might inherit the `x` flag from
the destination. We force remove it afterward. This code could be refactored
and the flag processing could be moved inside vfs.
This patch should be tested with
`--extra-config-opt experimental.update.atomic-file=True`
as we disabled the option by default.
Differential Revision: https://phab.mercurial-scm.org/D1882
Boris Feld <boris.feld@octobus.net> [Wed, 17 Jan 2018 16:52:13 +0100] rev 35725
write: add the possibility to pass keyword argument from batchget to vfs
We are going to pass atomictemp keyword argument from merge.baychget to
vfs.__call__. Update all the frames to accept **kwargs and pass it to the next
function.
Differential Revision: https://phab.mercurial-scm.org/D1881
Joerg Sonnenberger <joerg@bec.de> [Thu, 18 Jan 2018 12:55:19 +0100] rev 35724
blackbox: if --debug is used, also trace ui.debug() calls
Differential Revision: https://phab.mercurial-scm.org/D1880
Alex Gaynor <agaynor@mozilla.com> [Thu, 18 Jan 2018 14:43:04 +0000] rev 35723
bdiff: handle the possibility of overflow when computing allocation size
Differential Revision: https://phab.mercurial-scm.org/D1904
Tom Prince <mozilla@hocat.ca> [Tue, 02 Jan 2018 10:09:08 -0700] rev 35722
phabricator: add a template item for linking to a differential review
Differential Revision: https://phab.mercurial-scm.org/D1802
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 14 Jan 2018 11:19:45 -0800] rev 35721
githelp: don't reference 3rd party commands for `git show`
`hg show` is a Facebook-ism. Reference functionality in core.
The logic here isn't terrific. But it is better than nothing.
Differential Revision: https://phab.mercurial-scm.org/D1729
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 18 Dec 2017 21:09:08 -0800] rev 35720
githelp: improve help for "reset"
The previous help referenced a `hg reset`, which is a Facebook-ism.
We convert that to `hg update`. We also recognize --soft.
Differential Revision: https://phab.mercurial-scm.org/D1728
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 18 Dec 2017 21:02:49 -0800] rev 35719
githelp: clean up reflog help
This referenced commands that don't exist in core. The new help
isn't great since it references an experimental extension. But
it is better than nothing.
While we're here, also add test coverage.
Differential Revision: https://phab.mercurial-scm.org/D1727
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 18 Dec 2017 20:58:00 -0800] rev 35718
githelp: replace suggestion of `hg record`
`hg record` is deprecated in favor of `hg commit --interactive`.
Differential Revision: https://phab.mercurial-scm.org/D1726
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 18 Dec 2017 20:56:01 -0800] rev 35717
githelp: remove reference to tweakdefaults
This is a Facebook-ism.
Differential Revision: https://phab.mercurial-scm.org/D1725
Gregory Szorc <gregory.szorc@gmail.com> [Fri, 22 Dec 2017 18:38:29 -0700] rev 35716
githelp: recommend `hg import` for `git am`
This referenced a third party extension. It doesn't feel appropriate
to do that from a core extension. Reference `hg import` instead.
Differential Revision: https://phab.mercurial-scm.org/D1724
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 18 Dec 2017 20:51:20 -0800] rev 35715
githelp: improve help for `git add`
The old code was referencing record and crecord, which are
deprecated. `hg commit --interactive` is the preferred mechanism
to use.
In addition, there was duplicate code in this function. It has
been removed.
Tests have been added to cover this function.
Differential Revision: https://phab.mercurial-scm.org/D1723
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 18 Dec 2017 20:44:59 -0800] rev 35714
githelp: vendor Facebook authored extension
This commit vendors the Facebook-authored "githelp" extension. This
extension provides a "githelp" command that can be used to try to
convert a `git` command to its Mercurial equivalent. This functionality
is useful for Git users learning Mercurial.
The extension was copied from the
repository at revision 32ceeccb832c433b36e9af8196814b8e5a526775. The
following modifications were made:
* The "testedwith" value has been changed to match core's conventions.
* Support for a custom footer has been removed, as it is Facebook
specific. The feature is useful. But the implementation wasn't
appropriate for core.
* A test referencing "tweakdefaults" has been removed.
* Imports changed to match Mercurial's style convention.
* Double newlines in test removed.
* Pager activation changed to ui.pager().
* Initial line of githelp.py changed to add description of file.
The removal of the custom footer code was the only significant
source change. The rest were mostly cosmetic.
There are still some Facebook-isms in the extension. I'll address
these as follow-ups.
.. feature:: githelp extension
The "githelp" extension provides the ``hg githelp`` command. This
command attempts to convert a ``git`` command to its Mercurial
equivalent. The extension can be useful to Git users new to
Mercurial.
Differential Revision: https://phab.mercurial-scm.org/D1722
Pulkit Goyal <7895pulkit@gmail.com> [Thu, 18 Jan 2018 19:40:17 +0530] rev 35713
merge: use public interface ms.localctx instead of ms._local
Boris Feld <boris.feld@octobus.net> [Tue, 16 Jan 2018 14:28:57 +0100] rev 35712
bookmarks: display the obsfate of hidden revision we create a bookmark on
Display the same message we added recently to the filtered error message
create a bookmark on an hidden revision.
Differential Revision: https://phab.mercurial-scm.org/D1870
Boris Feld <boris.feld@octobus.net> [Tue, 16 Jan 2018 14:08:54 +0100] rev 35711
update: display the obsfate of hidden revision we update to
Display the same message we added recently to the filtered error message when
updating to a hidden obsolete changeset.
Differential Revision: https://phab.mercurial-scm.org/D1869
Martin von Zweigbergk <martinvonz@google.com> [Sun, 14 Jan 2018 00:02:40 -0800] rev 35710
evolution: make reporting of new unstable changesets optional
This makes it possible to turn off the reporting of unstable
changesets (e.g. "1 new orphan changesets"), just in case it's too
slow for some users. Anyone who's been using the evolve extension has
already been accepting the cost of the reporting, so this is just for
the few users who have turned on obsmarkers but not been using the
evolve extension (as I believe Facebook has).
Differential Revision: https://phab.mercurial-scm.org/D1868
Martin von Zweigbergk <martinvonz@google.com> [Sun, 14 Jan 2018 23:59:17 -0800] rev 35709
evolution: report new unstable changesets
This adds a transaction summary callback that reports the number of
new orphan, content-divergent and phase-divergent changesets.
The code for reporting it is based on the code from the evolve
extension, but simplified a bit. It simply counts the numbers for each
kind of instability before and after the transaction. That's obviously
not very efficient, but it's easy to reason about, so I'm doing this
as a first step that can make us quite confident about the test case
changes. We can optimize it later and make sure that the tests are not
affected. The code has been used in the evolve extension for a long
time and has apparently been sufficiently fast, so it doesn't seem
like a pressing issue.
Unlike the evolve extension's version of this report, this version
applies to all commands (or all transactions run as part of any
command, to be exact).
Differential Revision: https://phab.mercurial-scm.org/D1867
Martin von Zweigbergk <martinvonz@google.com> [Wed, 10 Jan 2018 14:00:23 -0800] rev 35708
transaction: register summary callbacks only at start of transaction (BC)
We currently register summary callbacks every time
localrepo.transaction() is called, so both when the transaction is
started and when a nested transaction is created. That seems a little
weirdly asymmetric, because the summary callbacks are thus not
necessarily registred at the beginning of the outermost transaction,
but they are only called when the outermost transaction closes (not
when a nested transaction closes).
I want to add another summary callback that records the repo state at
the beginning of the transaction and compares to that when the
transaction closes. However, because of the registration that happens
when a nested transaction is created, that would need to go through
extra trouble to not overwrite the callback and report the difference
from the start time of the innermost transaction to the close of the
outermost transaction.
Also, the callbacks are registered with a name based on the order they
are defined in the registersummarycallback(). For example, if both the
"new changesets %s" and the "obsoleted %i changesets" hooks are
registered, the first would be called 00-txnreport and the second
would be called 01-txnreport. That gets really weird if
registersummarycallback() gets called multiple times, because the last
one wins, and a depending on which of the two callbacks get
registered, we might hypothetically even overwrite on type of callback
with another. For example, if when the outer transaction was started,
we registered the "new changesets %s" callback first, and when the
inner transaction was started, we registered only the "obsoleted %i
changesets" callback, then only the latter message would get
printed. What makes it hypothetical is that what gets registered
depends on the transaction name, and the set of transaction names that
we match on for the former latter message is a subset of the set of
names we match on for the former. Still, that seems like a bug waiting
to happen.
That second issue could be solved independently, but the first issue
seems enough for me to consider it a bug (affecting developers, not
users), so this patch simply drops that extra registration.
Note that this affects "hg transplant" in a user-visible way. When "hg
transplant" is asked to transplant from a remote repo so it involves a
pull, then the outermost transaction name is "transplant" and an inner
transaction is created for "pull". That inner transaction is what led
us to sometimes report "new changesets %s" from "hg transplant". After
this patch, that no longer happens. That seems fine to me. We can make
it instead print the message for all "hg transplant" invocations if we
want (not just those involving a remote), but I'll leave that for
someone else to do if they think it's important.
Differential Revision: https://phab.mercurial-scm.org/D1866
Martin von Zweigbergk <martinvonz@google.com> [Sun, 14 Jan 2018 14:39:17 -0800] rev 35707
repair: filter out unknown revisions from phasecache within transaction
I'm about to add another summary report callback that needs to access
phase information. These callbacks run at the end of the transaction
and some of them failed because they tried to get the phase for
stripped commits. The solution is to filter out unknown revisions
before the transaction is closed.
Differential Revision: https://phab.mercurial-scm.org/D1865
Martin von Zweigbergk <martinvonz@google.com> [Sun, 14 Jan 2018 23:37:06 -0800] rev 35706
repair: drop unnecessary phase cache invalidation
After stripping the revlogs, we have been invalidating the phase cache
since bf7b8157c483. Later, in 8e3021fd1a44, I added a call to
phasecache.filterunknown(). I apparently didn't realize it then, but I
now think that that call made the existing phasecache.invalidate()
call unnecessary, so this patch drops it. Both the test added in
bf7b8157c483 and the entire evolve extension test suite indeed still
pass.
Differential Revision: https://phab.mercurial-scm.org/D1864
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 15 Jan 2018 15:20:02 -0800] rev 35705
wireproto: drop support for reader interface from streamres (API)
2add671bf55b and later commits overhauled support for compression
and output handling in the wire protocol.
Fast forward 14 months and all wire protocol commands except
the legacy "changegroup" and "changegroupsubset" commands feed
a generator to streamres.
I no longer think it is worth maintaining support for the old
"reader" API (which allows you to specify an object having a
read() method to obtain data).
This commit refactors the legacy wire protocol commands to feed
a generator to the streamres. We also drop support for the "reader"
argument and the code that was using it.
As part of the change, chunks over the SSH protocol have increased
in size for these commands. But these commands are really ancient,
so I doubt anyone will notice.
.. api::
wireproto.streamres.__init__ no longer accepts a "reader" argument.
Use the "gen" argument instead.
Differential Revision: https://phab.mercurial-scm.org/D1861
Pulkit Goyal <7895pulkit@gmail.com> [Mon, 08 Jan 2018 19:41:47 +0530] rev 35704
merge: add `--abort` flag which can abort the merge
Currently we don't have a good functionality to abort the merge and tell user to
do `hg update -C .` which can leads to different results if user missed the '.'
and moreover does not align with other abort functionalities like rebase, shelve
etc.
This patch adds `hg merge --abort` which will abort the ongoing merge and take
us back to the chagneset where we started from. Works in both cases when merge
resulted in conflicts and when there were no conflicts.
.. feature::
A `--abort` flag to merge command to abort the ongoing merge.
Differential Revision: https://phab.mercurial-scm.org/D1829
Phil Cohen <phillco@fb.com> [Thu, 04 Jan 2018 21:37:03 -0800] rev 35703
filemerge: only write in-memory backup during premerge
This wasn't broken, but should mirror the non-in memory case to save an extra
write.
Differential Revision: https://phab.mercurial-scm.org/D1807
Phil Cohen <phillco@fb.com> [Thu, 04 Jan 2018 21:36:58 -0800] rev 35702
filemerge: fix backing up an in-memory file to a custom location
If the user specifies a ui.origbackuppath, we used to always copy the file
there, but if the source file is in memory we must write it instead of copying.
Differential Revision: https://phab.mercurial-scm.org/D1806
Phil Cohen <phillco@fb.com> [Wed, 27 Dec 2017 17:38:28 -0600] rev 35701
rebase: don't run IMM if running rebase in a transaction
Some callers to rebase.rebase(), like `_moverelative` in `fbamend/movement.py`,
wrap the entire rebase call in a transaction. This raises havoc when IMM tries
to retry the rebase when it hits merge conflicts, because the abort will fail
the whole transaction, not the subset. It also fails at the end, losing any
conflict resolution, as @sid0 noticed.
The right long-term fix that @quark and I have discussed is to change the
restarting logic such that it doesn't abort at all, but simply switches between
IMM and non-IMM fluidly for each commit, which has other nice properties. In
the meantime this will do for now.
Differential Revision: https://phab.mercurial-scm.org/D1782
Augie Fackler <augie@google.com> [Wed, 17 Jan 2018 17:59:12 -0500] rev 35700
python3: whitelist two more passing tests
Differential Revision: https://phab.mercurial-scm.org/D1879
Boris Feld <boris.feld@octobus.net> [Fri, 12 Jan 2018 11:52:57 +0000] rev 35699
sshpeer: add support for request tracing
The new 'devel.debug.peer-request' option now also display some information
about request going through ssh peer.
Boris Feld <boris.feld@octobus.net> [Fri, 12 Jan 2018 10:41:03 +0000] rev 35698
httppeer: add support for tracing all http request made by the peer
This changeset introduces a new 'devel.debug.peer-request' config. When set to
True, debug message about request made by peer will be issued. This help to
understand what actually happens during an exchange and tracks source of
performance loss.
This changeset implement support for http peer only.
Boris Feld <boris.feld@octobus.net> [Fri, 12 Jan 2018 10:14:20 +0000] rev 35697
httppeer: move url opening in its own method
This will help adding debugging logic to request opening when investigating
Mercurial performance.
Boris Feld <boris.feld@octobus.net> [Fri, 12 Jan 2018 10:57:29 +0000] rev 35696
http: add a debug version of the push test
This will be useful to test further debugging capabilities in coming changesets.
Matt Harbison <matt_harbison@yahoo.com> [Wed, 17 Jan 2018 21:44:32 -0500] rev 35695
lfs: raise an error if the server sends an unsolicited oid
This shouldn't happen. But we shouldn't ignore it if it does, because something
else is likely to go wrong.
Matt Harbison <matt_harbison@yahoo.com> [Wed, 17 Jan 2018 20:54:05 -0500] rev 35694
lfs: correct documentation typo
Jordi Gutiérrez Hermoso <jordigh@octave.org> [Wed, 17 Jan 2018 22:12:10 -0500] rev 35693
test-convert-svn-move: sort svn checkout output
It turns out that there's no guarantee in which order svn will
traverse a directory while performing a checkout. Sorting the output
will make these tests stable.
Yuya Nishihara <yuya@tcha.org> [Sat, 13 Jan 2018 15:13:29 +0900] rev 35692
fileset: do not crash by unary negate operation
Backported from minifileset.py.
Yuya Nishihara <yuya@tcha.org> [Sat, 13 Jan 2018 15:07:37 +0900] rev 35691
fileset: make it robust for bad function calls
Before, it could crash or show cryptic message.
Yuya Nishihara <yuya@tcha.org> [Thu, 04 Jan 2018 14:20:58 +0900] rev 35690
log: build follow-log filematcher at once
We no longer need to replay copy tracing to build filematcher as we can
walk (rev, fctxs) pairs.
Yuya Nishihara <yuya@tcha.org> [Thu, 04 Jan 2018 15:20:46 +0900] rev 35689
log: allow matchfn to be non-null even if both --patch/--stat are off
This makes the next patch slightly simpler.
Yuya Nishihara <yuya@tcha.org> [Thu, 04 Jan 2018 14:37:15 +0900] rev 35688
log: replace "not pats" with matcher attribute for consistency
We use match.always() in _makelogrevset(). match.always() is identical to
"not pats" here since scmutil.matchandpats() empties pats in that case.
Yuya Nishihara <yuya@tcha.org> [Wed, 03 Jan 2018 15:58:59 +0900] rev 35687
log: follow file history across copies even with -rREV (BC) (issue4959)
Still it falls back to changelog path if glob patterns or missing paths
are specified. This will be changed later.
.. bc::
``log --follow -rREV FILE..`` now follows file history across copies and
renames.
Yuya Nishihara <yuya@tcha.org> [Wed, 03 Jan 2018 15:46:15 +0900] rev 35686
log: resolve --follow thoroughly in getlogrevs()
This makes sense because --follow isn't really an option to filter revisions,
but an option to extend revisions to be filtered.
_fileancestors() is a minimal copy of revset._follow(). They are slightly
different in that which revision the matcher sees. _fileancestors() also
uses ctx.walk() instead of ctx.manifest().walk() to show a better warning
on bad match, which will be tested later.
Yuya Nishihara <yuya@tcha.org> [Wed, 03 Jan 2018 15:13:22 +0900] rev 35685
log: extract function that processes log file patterns
We'll need a matcher to compute revs followed from the given patterns.
Yuya Nishihara <yuya@tcha.org> [Sun, 10 Dec 2017 17:28:44 +0900] rev 35684
log: resolve --follow with -rREV in cmdutil.getlogrevs()
This also fixes alias expansion. Before, reverse() could be overridden by user
alias.
This isn't processed at _logrevs() as we'll need starting revisions to parse
file patterns. See the subsequent patches for details.
Yuya Nishihara <yuya@tcha.org> [Sun, 10 Dec 2017 18:22:06 +0900] rev 35683
log: remove dead code to follow descendants if ascending revisions specified
It's been disabled since 8b4b9ee6001a "log: make -fr show complete history
from the given revs" 2015-02-06, and we've got no bug report regarding this
exact behavior. For details what the heck "followdescendants" is, please see
the issue comment:
https://bz.mercurial-scm.org/show_bug.cgi?id=4959#c72
"'rev(%d)' % startrev" can be replaced with '.' since revs are 'reversed(:.)'.
Yuya Nishihara <yuya@tcha.org> [Sun, 10 Dec 2017 16:59:54 +0900] rev 35682
log: duplicate _logrevs() dedicated for walkchangerevs()
Prepares for refactoring getlogrevs() to fix the "log -frREV PATH" issue.
I initially thought I could get rid of walkchangerevs(), but it turned out
requiring non-trivial work because of a "prepare" callback and a scanning
window. This patch makes sure that walkchangerevs() will be unaffected by
subsequent changes.
Yuya Nishihara <yuya@tcha.org> [Tue, 16 Jan 2018 21:51:27 +0900] rev 35681
update: fix crash on bare update when directaccess is enabled
'rev' may be None. An empty 'rev' string shouldn't also be passed to
unhidehashlikerevs().
Yuya Nishihara <yuya@tcha.org> [Tue, 16 Jan 2018 21:42:42 +0900] rev 35680
templater: make sure expression is terminated by '}'
This can't be ensured by the tokenize() generator since the parser stop
consuming tokens once it reached an end of an operation.
Spotted by Matt Harbison.
Boris Feld <boris.feld@octobus.net> [Fri, 14 Jul 2017 19:59:10 +0200] rev 35679
bookmark: deprecate direct update of a bookmark value
This changeset was part of an older series preventing direct update of the
bookmarks store without the change being tracked by a transaction. For some
unclear reason, this was not sent to the list. So we are sending it now.
Initial series: 3325c7dcabaa+08bf0ebc6c8e+712a85b3677f.
We want to channel all bookmarks update through 'applychanges' so let's remove
more way to work around this function.
Paul Morelle <paul.morelle@octobus.net> [Mon, 16 Oct 2017 14:32:06 +0200] rev 35678
debugdeltachain: display how many chunks would be read in sparse-read mode
Alex Gaynor <agaynor@mozilla.com> [Wed, 17 Jan 2018 21:36:18 +0000] rev 35677
bdiff: handle the possibility of an integer overflow when allocating
Differential Revision: https://phab.mercurial-scm.org/D1877
Jordi Gutiérrez Hermoso <jordigh@octave.org> [Tue, 16 Jan 2018 08:40:14 -0500] rev 35676
svnsubrepo: check if subrepo is missing when checking dirty state (issue5657)
During an hg convert command, subrepos are not checked out. However, a
manifestmerge may occur during an hg convert if there is a merge
commit, which in particular will check the dirty state of subrepos.
Before this change, the lack of a checked out subrepo would error out.
This check for svn subrepos is modelled after 2fdea636f254 for git
subrepos.
Boris Feld <boris.feld@octobus.net> [Wed, 17 Jan 2018 13:02:42 +0100] rev 35675
win32text: use 'tiprev' when appropriate
This is cleaner than the current 'len(repo) - 1' form.
Boris Feld <boris.feld@octobus.net> [Wed, 17 Jan 2018 13:01:38 +0100] rev 35674
patchbomb: use 'tiprev' when appropriate
This is cleaner than the current 'len(repo) - 1' form.
Boris Feld <boris.feld@octobus.net> [Thu, 04 May 2017 02:28:19 +0200] rev 35673
revset: use 'tiprev' when appropriate
This is cleaner than the current 'len(repo) - 1' forms
Boris Feld <boris.feld@octobus.net> [Thu, 04 May 2017 02:24:04 +0200] rev 35672
changelog: use 'tiprev()' in 'tip()'
Since 'tip()' is just a node version of 'tiprev()' we should reuse the code.
Boris Feld <boris.feld@octobus.net> [Thu, 04 May 2017 02:23:21 +0200] rev 35671
changelog: introduce a 'tiprev' method
Accessing tiprev is a common need through the code base. It is usually done
using "len(changelog) -1". That form is tedious and error-prone. For example,
it will give wrong results on filtered changelog (if the unfiltered tip is
filtered).
As a result, we introduce a simple 'tiprev()' method to provide this exact
information in a nice way.
Augie Fackler <augie@google.com> [Wed, 17 Jan 2018 15:47:38 -0500] rev 35670
contrib: add some basic scaffolding for some fuzz test targets
I'd like to get the majority of our C code covered by automated fuzz
testing. I've started with bdiff because it was already decoupled from
libpython and therefore was fairly quick to produce a working
fuzzer. The code here is a little odd because I've been having trouble
convincing libfuzzer to define a main and I threw in the towel.
This code will also work with github.com/google/oss-fuzz, and once it
lands in our main repo I intend to enable automated fuzzing in
oss-fuzz with reports going to our security alias.
Differential Revision: https://phab.mercurial-scm.org/D1875
Augie Fackler <augie@google.com> [Wed, 17 Jan 2018 15:56:12 -0500] rev 35669
formatting: enforce clang-format on all .cc files as well as .c files
As part of my upcoming fuzzer patch we're going to grow some .cc
files. They're not part of the release build (they're only used for
fuzzing, which requires clang 6 which in turn implies a working C++
compiler), so I'm not terribly worried about growing some C++ files.
Differential Revision: https://phab.mercurial-scm.org/D1874
Augie Fackler <augie@google.com> [Wed, 17 Jan 2018 15:28:38 -0500] rev 35668
hghave: add test for clang 6 and later
clang 6 includes integrated libfuzzer support, which makes fuzzer
stuff a little easier to work with.
Differential Revision: https://phab.mercurial-scm.org/D1873
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 14 Jan 2018 12:06:27 -0800] rev 35667
py3: cast error message to localstr in blackbox.py
According to the exceptions reporting mechanism, this is the #1 crasher
in the test harness for Python 3.
Since this exception is in an except block, we'll likely get a
new #1 crasher after this change. But at least we won't die
during error handling!
Differential Revision: https://phab.mercurial-scm.org/D1478
Jun Wu <quark@fb.com> [Wed, 10 Jan 2018 21:27:05 -0800] rev 35666
lfs: remove internal url in test
`test-lfs-test-server.t` refers to a FB internal domain and requires certain
implementation (ex. set error code to 404) at that endpoint. Without any
workaround, It should in theory error out like "Domain cannot be resolved".
I don't know how Matt Harbison ran the test.
This patch changes the test to only depend on `lfs-test-server`.
Unfortunately the logic has to be changed since `lfs-test-server` does not
set error code to 404 but just removes "download" from "actions".
Differential Revision: https://phab.mercurial-scm.org/D1849
Matt Harbison <matt_harbison@yahoo.com> [Sun, 14 Jan 2018 18:12:51 -0500] rev 35665
lfs: control tracked file selection via a tracked file
Since the lfs tracking policy can dramatically affect the repository, it makes
more sense to have the policy file checked in, than to rely on all developers
configuring their .hgrc properly. The inspiration for this is the .hgeol file.
The configuration lives under '[track]', so that other things can be added in
the future. Eventually, the config option should be limited to `convert` only.
If the file can't be parsed for any reason (including unrecognized elements of
the minifileset language), the commit will abort until the problem is corrected.
This seems more useful than the warning that hgeol emits, and has no effect on
reading the data, so there's no compatibility concerns.
My initial thought was to read the file and change each "key = value" line into
"((key) & (value))", so that each line could be ORed together, and make a single
pass at compiling. Unfortunately, that prevents exclusions if there's a
catchall rule. Consider what happens to a large *.c file here:
[track]
**.c = none()
** = size('>1MB')
# ((**.c) & (none())) | ((**) & (size('>1MB'))) => anything > 1MB
I also thought about having separate [include] and [exclude] sections. But that
just seems to open things up to user mistakes. Consider:
[include]
**.zip = all()
**.php = size('>10MB')
[exclude]
**.zip = all() # Who wins?
**.php = none() # Effectively 'all()' (i.e. nothing excluded), or >10MB ?
Therefore, it just compiles each key and value separately, and walks until the
key matches something. I'm not sure how to enforce just file patterns on LHS
without leaking knowledge about the minifileset here. That means this will
allow odd looking lines like this:
[track]
**.c | **.txt = none()
But that's also fewer lines to compile, so slightly more efficient? Some things
like 'none()' won't work as expected on LHS though, because that won't match, so
that line is skipped. For now, these quirks are not mentioned in the
documentation.
Jun previously expressed concern about efficiency when scaling to large repos,
so I tried avoiding 'repo[None]'. (localrepo.commit() gets repo[None] already,
but doesn't tie it to the workingcommitctx used here.) Therefore, I looked at
the passed context for 'AMR' status. But that doesn't help with the normal case
where the policy file is tracked, but clean. That requires looking up p1() to
read the file. I don't see any way to get the content of one file without first
creating the full parent context.
Matt Harbison <matt_harbison@yahoo.com> [Sun, 14 Jan 2018 01:04:45 -0500] rev 35664
lfs: move the tracked file function creation to a method
Once a commitable file format for tracked config is agreed upon, I can't see any
reason to have a config based way to control this. (Other than convert. That
will be necessary to override the file when converting to normal files. Also,
converting to lfs needs this if not splicing the file in at the beginning. So
maybe the existing config option should be `convert` specific.) Looking to
hgeol for precedent, it looks like policy that affects how items are stored are
handled only by the tracked file, while policy that affects the checkout can be
handled by either a user config or the tracked file (but the latter takes
precedence).
We probably need a transition period, so this transition policy can be
controlled by the function. Additionally, it provides a place for convert to
wrap to override the file based config.
Matt Harbison <matt_harbison@yahoo.com> [Tue, 16 Jan 2018 20:15:07 -0500] rev 35663
lfs: allow the pointer file to be viewed with `hg cat -T '{rawdata}'`
The only other interface to this data is `hg debugdata`, which requires
knowledge of the filelog revision that corresponds to the changeset. Since the
data is uninterpreted, this is an important debugging capability, and needs to
be simpler to use than that.
For non-LFS files, this displays the regular data.
Alternately, we could forego the messy function extraction in the last patch if
this template keyword can just be added unconditionally.
Matt Harbison <matt_harbison@yahoo.com> [Tue, 16 Jan 2018 19:56:00 -0500] rev 35662
cat: factor out a function that populates the formatter
This will allow extensions to add data to the templater.
Jordi Gutiérrez Hermoso <jordigh@octave.org> [Sun, 14 Jan 2018 12:07:06 -0500] rev 35661
svnsubrepo: add new method _svnmissing
This is modelled after _gitmissing from dea6efdd7ec4 and also
necessary for svn. I'm not sure exactly how this hasn't been more of a
problem for svn until now, actually.
Jordi Gutiérrez Hermoso <jordigh@octave.org> [Sun, 14 Jan 2018 12:05:28 -0500] rev 35660
svnsubrepo: decorate dirty method with annotatesubrepoerror
This function invokes svn commands which can error out in any number
of ways, so it's helpful to know in which subrepo this error happens.
Yuya Nishihara <yuya@tcha.org> [Tue, 16 Jan 2018 22:14:33 +0900] rev 35659
match: do not weirdly include explicit files excluded by -X option
Actually, this was the original behavior. Before a83a7d27911e, "log" and
"files" showed nothing if "FILE -X FILE" was specified, whereas "debugwalk"
got confused by an explicit FILE pattern. Under the hood, "log" and "files"
use m() and ctx.matches(m) respectively, and "debugwalk" uses ctx.walk(m).
I suspect dirstate.walk() goes wrong in _walkexplicit(), which seems to
blindly trust m.files().
I reckon the original "log"/"files" behavior is correct, and drop the hack
from the differencematcher.
Matt Harbison <matt_harbison@yahoo.com> [Sun, 14 Jan 2018 15:56:22 -0500] rev 35658
lfs: add the '{oid}' template keyword to '{lfs_files}'
The 'sha256:' prefix is skipped because this seems like the most convenient way
to consume it. Maybe we should also add a '{oid_type}' keyword? Then again,
that can be added in the future if a different algorithm is supported.
Matt Harbison <matt_harbison@yahoo.com> [Sun, 14 Jan 2018 15:39:10 -0500] rev 35657
lfs: convert '{lfs_files}' keyword to a hybrid list
This will allow more attributes about the file to be queried.
Boris Feld <boris.feld@octobus.net> [Sun, 10 Dec 2017 21:42:33 +0100] rev 35656
showstack: add an extension docstring
Now, running `hg help showstack` will give details on how to use the extension.
Boris Feld <boris.feld@octobus.net> [Mon, 15 Jan 2018 10:44:49 +0000] rev 35655
bookmark: run 'pushkey' hooks after bookmark move, not 'prepushkey'
This was a silly copy paste mistake.
Spotted by Mitchell Plamann from Jane Street.
Anton Shestakov <av6@dwimlabs.net> [Mon, 15 Jan 2018 19:44:18 +0800] rev 35654
hgweb: remove unused second argument of nextPageVarGet()
nextPageVarGet is a function that's used in ajaxScrollInit() to produce URL of
the next page. Before f84b01257e06, its second argument previousVal was a
number on /graph pages, and the code was simply adding 60 to it and returning
the resulting value. Now previousVal can only be a string containing changeset
hash, which can't be used the same way (and in fact isn't used in any way).
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 14 Jan 2018 20:06:56 -0800] rev 35653
dispatch: handle IOError when writing to stderr
Previously, attempts to write to stderr in dispatch.run() may lead to
an exception being thrown. This would likely be handled by Python's
default exception handler, which would print the exception and exit
1.
Code in this function is already catching IOError for stdout failures
and converting to exit code 255 (-1 & 255 == 255). Why we weren't
doing the same for stderr for the sake of consistency, I don't know.
I do know that chg and hg diverged in behavior here (as the changed
test-basic.t shows).
After this commit, we catch I/O failure on stderr and change the
exit code to 255. chg and hg now behave consistently. As a bonus,
Rust hg also now passes this test.
I'm skeptical at changing the exit code due to failures this late
in the process. I think we should consider preserving the current
exit code - assuming it is non-0. And, we may want to preserve the
exit code completely if the I/O error is EPIPE (and potentially
other special error classes). There's definitely room to tweak
behavior. But for now, let's at least prevent the uncaught exception.
Differential Revision: https://phab.mercurial-scm.org/D1860
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 14 Jan 2018 19:30:48 -0800] rev 35652
commandserver: restore cwd in case of exception
The order of the statements was also changed a bit. But it shouldn't
matter.
Differential Revision: https://phab.mercurial-scm.org/D1859
Gregory Szorc <gregory.szorc@gmail.com> [Wed, 10 Jan 2018 20:02:35 -0800] rev 35651
tests: make hg frame optional
When `hg` is a Rust binary, the `hg` frame doesn't exist because an
`hg` Python script doesn't exist.
This commit updates expected test output to make the `hg` frame
optional.
There /might/ be a way to do this more accurately with the
"(feature !)" syntax in .t files. However, I poked at it for a
few minutes and couldn't get it to work. Worst case with using
(?) is we drop the frame from output for Python `hg`. The `hg`
frame isn't terribly important. So the worst case doesn't feel that
bad. If someone wants to enlighten me on how to use "(feature !)"
for optional output based on hghave features, I'd be more than
willing to update this.
Differential Revision: https://phab.mercurial-scm.org/D1858
Matt Harbison <matt_harbison@yahoo.com> [Sat, 13 Jan 2018 22:40:33 -0500] rev 35650
test-lfs: add tests to show that hashes remain unchanged by conversions
This is a very cool feature that we should document, but I'll punt that to the
freeze. From what I can tell, git doesn't have this capability.
Matt Harbison <matt_harbison@yahoo.com> [Sat, 13 Jan 2018 22:29:18 -0500] rev 35649
test-lfs: drop an unresolved issue note, now that lfs.track=none() is a thing
Matt Harbison <matt_harbison@yahoo.com> [Sat, 13 Jan 2018 20:07:14 -0500] rev 35648
lfs: always exclude '.hg*' text files
I can't think of any problematic scenarios (though things might get interesting
with .hgtags, since every head is consulted). The eol extension explicitly
disables handling these files, and that seems reasonable here too.
Pulkit Goyal <7895pulkit@gmail.com> [Mon, 15 Jan 2018 00:16:11 +0530] rev 35647
bookmarks: calculate visibility exceptions only once
In the loop "for mark in names", the rev is same in each iteration, so it does
not makes sense to call unhidehashlikerevs multiple times. Thanks to Yuya for
spotting this.
Yuya Nishihara <yuya@tcha.org> [Sun, 10 Dec 2017 18:25:33 +0900] rev 35646
log: rewrite --follow-first -rREV like --follow for consistency (BC)
This helps fixing the "--follow -rREV PATH" issue.
.. bc::
``log --follow-first -rREV``, which is deprecated, now follows the first
parent of merge revisions from the specified ``REV`` just like
``log --follow -rREV``.
Yuya Nishihara <yuya@tcha.org> [Tue, 02 Jan 2018 17:37:01 +0900] rev 35645
log: use revsetlang.formatspec() thoroughly
This patch replaces %(val)s and %(val)r with %r (expression) and %s (string)
respectively. _matchfiles() is the exception as it takes a list of string
parameters.
"--prune REV" could take a revset expression if it were "ancestors(%(val)s)",
but this patch doesn't change the existing behavior.
Yuya Nishihara <yuya@tcha.org> [Tue, 02 Jan 2018 17:13:18 +0900] rev 35644
log: use revsetlang.formatspec() to concatenate list expression
This rewrites 'not ancestors(x) and not ...' as 'not (ancestors(x) or ...)'
so we can use '%lr'. 'isinstance(val, list)' is replaced with 'listop' to
make sure 'listop' is applied.
Yuya Nishihara <yuya@tcha.org> [Tue, 02 Jan 2018 17:00:48 +0900] rev 35643
log: simplify 'x or ancestors(x)' expression
'ancestors(x)' includes 'x'.
Yuya Nishihara <yuya@tcha.org> [Tue, 02 Jan 2018 16:58:37 +0900] rev 35642
log: make opt2revset table a module constant
Just makes it clear that the table isn't updated in _makelogrevset().
Paul Morelle <paul.morelle@octobus.net> [Sun, 14 Jan 2018 13:04:26 -0800] rev 35641
revlog: group revision info into a dedicated structure
Paul Morelle <paul.morelle@octobus.net> [Sun, 14 Jan 2018 13:01:35 -0800] rev 35640
revlog: rename 'rev' to 'base', as it is the base revision
Paul Morelle <paul.morelle@octobus.net> [Sun, 14 Jan 2018 12:59:46 -0800] rev 35639
revlog: separate diff computation from the collection of other info
Paul Morelle <paul.morelle@octobus.net> [Fri, 12 Jan 2018 18:58:44 +0100] rev 35638
revlog: introduce 'deltainfo' to distinguish from 'delta'
A 'delta' is a binary diff between two revisions, as returned by revdiff.
A 'deltainfo' is an object storing information about a delta, including
the 'delta' itself.
Formerly, it was stored in a 7-position tuple, which was less readable.
Paul Morelle <paul.morelle@octobus.net> [Fri, 12 Jan 2018 18:10:03 +0100] rev 35637
revlog: extract 'builddelta' closure function from _addrevision