FUJIWARA Katsunori <foozy@lares.dti.ne.jp> [Fri, 09 Jun 2017 12:58:18 +0900] rev 32748
vfs: create copy at renaming to avoid file stat ambiguity if needed
In order to fix
issue5418,
bff5ccbe5ead made vfs.rename(checkambig=True)
omit advancing mtime of renamed file, if renamed file is owned by
another (EPERM is raised in this case).
But this omission causes rewinding mtime at restoration in such
situation, and makes avoiding file stat ambiguity difficult, because
ExactCacheValidationPlan assumes that mtime should be advanced, if a
file is changed in same ctime.
https://www.mercurial-scm.org/wiki/ExactCacheValidationPlan
Ambiguity of file stat also requires
issue5584 to be fixed with other
than file stat, but "hash of file", "generation ID" and so on were
already rejected ideas (please see original RFC linked from "Outline
of issue" in ExactCacheValidationPlan page).
This omission occurs:
- only for non append-only files (dirstate, bookmarks, and phaseroots), and
- only if previous transaction is rollbacked by another user
The latter means "sharing a repository clone via group permission".
This is reasonable usecase, but not ordinary for many users, IMHO.
"hg rollback" itself has been deprecated since Mercurial 2.7, too.
Therefore, increasing the cost at rollbacking previous transaction
executed by another a little seems reasonable, for avoidance of file
stat ambiguity.
This patch does:
- create copy of (already renamed) source file, if advancing mtime
fails for EPERM
- rename from copied file to destination file, and
- advance mtime of renamed file, which is now owned by current user
This patch also factors "self.join(src)" out to reduce redundancy.
FUJIWARA Katsunori <foozy@lares.dti.ne.jp> [Fri, 09 Jun 2017 12:58:18 +0900] rev 32747
vfs: factor out "rename and avoid ambiguity" to reuse
This makes subsequent patch simple.
FUJIWARA Katsunori <foozy@lares.dti.ne.jp> [Fri, 09 Jun 2017 12:58:17 +0900] rev 32746
util: make filestat.avoidambig() return whether ambiguity is avoided or not
Gregory Szorc <gregory.szorc@gmail.com> [Fri, 09 Jun 2017 10:42:19 -0700] rev 32745
debugcommands: issue warning when repo has secret changesets (
issue5589)
This seems like a prudent thing to do. As the inline comment says,
we may want to make this abort once the functionality is stabilized
as part of `hg bundle`. Let's save that debate for another day.
Gregory Szorc <gregory.szorc@gmail.com> [Fri, 09 Jun 2017 10:41:13 -0700] rev 32744
streamclone: consider secret changesets (BC) (
issue5589)
Previously, a repo containing secret changesets would be served via
stream clone, transferring those secret changesets. While secret
changesets aren't meant to imply strong security (if you really
want to keep them secret, others shouldn't have read access to the
repo), we should at least make an effort to protect secret changesets
when possible.
After this commit, we no longer serve stream clones for repos
containing secret changesets by default. This is backwards
incompatible behavior. In case anyone is relying on the behavior,
we provide a config option to opt into the old behavior.
Note that this defense is only beneficial for remote repos
accessed via the wire protocol: if a client has access to the
files backing a repo, they can get to the raw data and see secret
revisions.
Yuya Nishihara <yuya@tcha.org> [Fri, 09 Jun 2017 21:33:15 +0900] rev 32743
json: pass formatting options recursively
This bug was introduced in
654e9a1c8a6c. It's okay to escape <>, but is
unnecessary for command output.
Yuya Nishihara <yuya@tcha.org> [Sun, 23 Apr 2017 13:40:18 +0900] rev 32742
json: avoid extra string manipulation of dict keys
A key must be string per JSON spec, and that's also true for template dicts.
Yuya Nishihara <yuya@tcha.org> [Fri, 09 Jun 2017 21:45:22 +0900] rev 32741
test-obsolete: include <> in user field to check JSON escapes
I found json() filter doesn't pass formatting options recursively. That's
why <> are escaped.
Yuya Nishihara <yuya@tcha.org> [Fri, 09 Jun 2017 21:28:22 +0900] rev 32740
templatefilers: correct filename in header comment
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 08 Jun 2017 20:28:13 -0700] rev 32739
repoview: remove special casing of "requirements"
At the time this code was introduced (
3a6ddacb7198), the inline comment
was true. This changed in
e3a928bd1cd4. The proxy is no longer needed.
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 07 Jun 2017 19:32:16 +0100] rev 32738
bookmarks: move variable initialization earlier
Since we no longer set '_clean = False' during the initialization loop, we can
move the attribute assignment earlier in the function for clarity.
(no speed improvement expected or measured ;-) )
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 07 Jun 2017 19:13:09 +0100] rev 32737
bookmarks: directly use base dict 'setitem'
The bmstore '__setitem__' method is setting an extra flag that is not needed
during initialization. Skipping the method will allow further cleanup and yield
some speedup as a side effect.
Before:
! wall 0.009120 comb 0.010000 user 0.010000 sys 0.000000 (best of 312)
After:
! wall 0.007874 comb 0.010000 user 0.010000 sys 0.000000 (best of 360)
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 07 Jun 2017 19:22:39 +0100] rev 32736
bookmarks: rely on exception for malformed lines
Since we already have an exception context open, for other thing, we can
simplify the code a bit and rely on exception handling for invalid lines.
Speed is not the main motivation for this changes. However as I'm in the middle
of benchmarking things we can see a small positive impact.
Before:
! wall 0.009358 comb 0.000000 user 0.000000 sys 0.000000 (best of 303)
After:
! wall 0.009173 comb 0.010000 user 0.010000 sys 0.000000 (best of 310)
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 07 Jun 2017 22:26:43 +0100] rev 32735
bookmarks: explicitly convert to 'node' during initialization
We know the content of the file is supposed to be full hex. So we can do the
translation ourselves and directly check if the node is known.
As nice side effect we now have proper error handling for invalid node value.
Before:
! wall 0.021580 comb 0.020000 user 0.020000 sys 0.000000 (best of 134)
After:
! wall 0.009342 comb 0.010000 user 0.010000 sys 0.000000 (best of 302)
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 07 Jun 2017 19:21:02 +0100] rev 32734
bookmarks: prefetch 'lookup' outside of the loop
Skipping the attribute lookup up raise a significant speedup.
Example on a repository with about 4000 bookmarks.
Before:
! wall 0.026027 comb 0.020000 user 0.020000 sys 0.000000 (best of 112)
After:
! wall 0.021580 comb 0.020000 user 0.020000 sys 0.000000 (best of 134)
(This is also in its own changeset to clarify the perf win from another coming
changesets)
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 07 Jun 2017 18:22:11 +0100] rev 32733
perf: add a perfbookmarks command
A new command dedicated to benchmark of bookmark initialization.
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 23 May 2017 02:27:41 +0200] rev 32732
perfphases: add a flag to also include file access time
The flag purges all phases data so we'll have to read the file from disk again.
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 07 Jun 2017 17:31:30 +0100] rev 32731
perf: have a generic "clearstorecache" function
There are multiple places where we will want to purge some store cache. So we
promote the existing _clearobsstore function to a something reusable.
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 08 Jun 2017 23:23:37 -0700] rev 32730
localrepo: move filtername to __init__
This is obviously an instance attribute, not a type attribute. The
modern Python style is to use __init__ for defining these.
This exposes statichttprepo as inheriting from localrepository
without calling its __init__. As a result, its __init__ defines
a lot of variables that methods on localrepository's methods need.
But factoring the common bits into a separate class is for another
day.
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 08 Jun 2017 21:54:30 -0700] rev 32729
obsolete: move obsstore creation logic from localrepo
This code has more to do with obsolete.py than localrepo.py. Let's
move it there.
Martin von Zweigbergk <martinvonz@google.com> [Thu, 08 Jun 2017 22:18:17 -0700] rev 32728
match: allow pats to be None
match.match already interprets "!bool(patterns)" as matching
everything (but includes and excludes still apply). We might as well
allow None, which lets us simplify some callers a bit.
I originally wrote this patch while trying to change
match.match(patterns=[]) to mean to match no patterns. This patch is
one step towards that goal. I'm not sure it'll be worth the effort to
go all the way there, but I think this patch still makes sense on its
own.
Augie Fackler <augie@google.com> [Tue, 06 Jun 2017 11:16:38 -0400] rev 32727
tests: add a test for installing hg with pip in a virtualenv
Since we're doing so much clever junk in our setup.py, let's have a
test that exercises it.
Thanks to Matt Harbison for testing this on Windows and verifying that
installenv/*/hg would work as a way to work around bin being called
Scripts on Windows.
Augie Fackler <augie@google.com> [Tue, 06 Jun 2017 11:16:10 -0400] rev 32726
hghave: add check for virtualenv
Augie Fackler <augie@google.com> [Tue, 06 Jun 2017 11:02:30 -0400] rev 32725
setup: introduce dummy copies of setuptools flags
Since we're filtering out some egg gunk, we need to emulate these
flags which disable eggs so that pip still works.
Augie Fackler <augie@google.com> [Tue, 06 Jun 2017 10:09:48 -0400] rev 32724
extensions: catch uisetup and extsetup failures and don't let them break hg
Otherwise users of the patience diff extension will be unable to run
anything at all in hg 4.3 until they figure out what's broken.
Augie Fackler <augie@google.com> [Tue, 06 Jun 2017 10:03:16 -0400] rev 32723
tests: add test demonstrating how broken third-party extensions can get
I intend to fix this, but will do the fix as a separate change to make
the behavior change obvious. This was inspired by some users having
the patience diff extension, which broke when we moved bdiff.so so
thoroughly the users can't even run 'hg debuginstall'.
Augie Fackler <augie@google.com> [Thu, 08 Jun 2017 10:44:53 -0400] rev 32722
extensions: move wrapfilecache function from fsmonitor
It makes more sense to put this in core, so other extensions can
trivially get access to it without having to rely on importing
fsmonitor.
Koen Van Hoof <koen.van_hoof@nokia.com> [Wed, 26 Apr 2017 16:05:22 +0200] rev 32721
chmod: create a new file when flags are set on a hardlinked file
For performance reasons we have several repositories where the files in the working
directory of 1 repo are hardlinks to the files of the other repo
When an update in one repo results in a chmod of a such a file, the hardlink
has to be deleted and replaced by a regular file to make sure that the change
does not happen in the other repo
Siddharth Agarwal <sid0@fb.com> [Wed, 07 Jun 2017 21:17:24 -0700] rev 32720
run-tests: make --restart work with output dir
Siddharth Agarwal <sid0@fb.com> [Wed, 07 Jun 2017 21:17:06 -0700] rev 32719
run-tests: output coverage to output dir
There do not appear to be any tests for this, and I've never used either of
these options before, but this works.