Thu, 06 Jul 2017 14:33:18 -0700 sparse: move pruning of temporary includes into core
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 06 Jul 2017 14:33:18 -0700] rev 33321
sparse: move pruning of temporary includes into core This was our last method on the custom repo type, meaning we could remove that custom type and inline the 2 lines of code into reposetup(). As part of the move, instead of wrapping merge.update() from the sparse extension, we inline the function call. The ported function now no-ops if sparse isn't enabled, making it safe to always call. The call site in update() may not be the most appropriate. But it matches the previous behavior, which is the safest thing to do. It can be improved later.
Thu, 06 Jul 2017 17:41:45 -0700 sparse: move function for resolving sparse matcher into core
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 06 Jul 2017 17:41:45 -0700] rev 33320
sparse: move function for resolving sparse matcher into core As part of the move, the function arguments changed so revs are passed as a list instead of *args. This allows us to use keyword arguments properly. Since the plan is to integrate sparse into core and have it enabled by default, we need to prepare for a sparse matcher to always be obtained and operated on. As part of the move, we inserted code that returns an always matcher if sparse isn't enabled. Some callers in the sparse extension take this into account and conditionally perform matching depending on whether the special always matcher is seen. I /think/ this may have sped up some operations where the extension is installed but no sparse config is activated. One thing I'm ensure of in this code is whether os.path.dirname() is semantically correct. os.posixpath.dirname() (which is exported as pathutil.dirname) might be a better choise because all patterns should be using posix directory separators (/) instead of Windows (\). There's an inline comment that implies Windows was tested. So hopefully it won't be a problem. We can improve this in a follow-up. I've added a TODO to track it.
Thu, 06 Jul 2017 17:39:24 -0700 match: move matchers from sparse into core
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 06 Jul 2017 17:39:24 -0700] rev 33319
match: move matchers from sparse into core The sparse extension contains some matcher types that are generic and can exist in core. As part of the move, the classes now inherit from basematcher. always(), files(), and isexact() have been dropped because they match the default implementations in basematcher.
Thu, 06 Jul 2017 16:01:36 -0700 sparse: clean up config signature code
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 06 Jul 2017 16:01:36 -0700] rev 33318
sparse: clean up config signature code Before, 0 was being used as the default signature value and we cast the int to a string. We also handled I/O exceptions manually. The new code uses cfs.tryread() so we always feed data into the hasher. The empty string does hash and and should be suitable for input into a cache key. The changes made the code simple enough that the separate checksum function could be inlined.
Thu, 06 Jul 2017 16:11:56 -0700 sparse: move config signature logic into core
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 06 Jul 2017 16:11:56 -0700] rev 33317
sparse: move config signature logic into core This is a pretty straightforward port. It will be cleaned up in a subsequent commit.
Thu, 06 Jul 2017 17:31:33 -0700 sparse: remove custom hash matcher
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 06 Jul 2017 17:31:33 -0700] rev 33316
sparse: remove custom hash matcher With the recent change to always use repr(), this function was functionally identical to the version in fsmonitor it was replacing. So remove it.
Thu, 06 Jul 2017 16:37:36 -0700 sparse: override __repr__ in matchers
Martin von Zweigbergk <martinvonz@google.com> [Thu, 06 Jul 2017 16:37:36 -0700] rev 33315
sparse: override __repr__ in matchers sparse.py in FB's hg-experimental repo switched to using __repr__ for non-sparse matchers soon after hg core started overriding __repr__ in the matchers in match.py (because the core matchers also stopped having "includepat" and other attributes that sparse used to depend on). Let's finish that migration by implementing __repr__ in the sparse matchers as well. That also lets us remove the special handling of them in _hashmatcher().
Thu, 06 Jul 2017 14:17:02 -0700 tests: fix reference to undefined variable
Martin von Zweigbergk <martinvonz@google.com> [Thu, 06 Jul 2017 14:17:02 -0700] rev 33314
tests: fix reference to undefined variable The delaypush() function had a reference to "repo" that was clearly supposed to be "pushop.repo". Instead of just fixing that, let's extract "pushop.repo.ui" to a variable, since that's the only piece of the repo that's needed in the function. I have not looked into why I saw a different result in the test to start with, but that's for another patch anyway.
Tue, 01 Dec 2015 09:19:54 -0800 shelve: don't reimplement mergestate.unresolved()
Martin von Zweigbergk <martinvonz@google.com> [Tue, 01 Dec 2015 09:19:54 -0800] rev 33313
shelve: don't reimplement mergestate.unresolved()
Mon, 23 Nov 2015 09:37:12 -0800 summary: don't reimplment mergestate.unresolved()
Martin von Zweigbergk <martinvonz@google.com> [Mon, 23 Nov 2015 09:37:12 -0800] rev 33312
summary: don't reimplment mergestate.unresolved()
Tue, 01 Dec 2015 09:26:33 -0800 mergestate: implement unresolvedcount() in terms of unresolved()
Martin von Zweigbergk <martinvonz@google.com> [Tue, 01 Dec 2015 09:26:33 -0800] rev 33311
mergestate: implement unresolvedcount() in terms of unresolved() This simplifies the method slightly. It does create a full list of paths while doing so, but it's not a lot of data anyway (besides, I would think references to strings are no larger than (references to?) True).
Tue, 01 Dec 2015 09:26:10 -0800 mergestate: make unresolved() use iteritems()
Martin von Zweigbergk <martinvonz@google.com> [Tue, 01 Dec 2015 09:26:10 -0800] rev 33310
mergestate: make unresolved() use iteritems() mergestate.unresolved() is a generator, so it seems better for it to rely on iteritems() than items(), although it also seems unlikely for it to make a noticeable difference.
Fri, 30 Jun 2017 23:58:59 -0700 changegroup: don't fail on empty changegroup (API)
Martin von Zweigbergk <martinvonz@google.com> [Fri, 30 Jun 2017 23:58:59 -0700] rev 33309
changegroup: don't fail on empty changegroup (API) I don't know why applying an empty changegroup should be an error. It seems harmless. I suspect the check was there to find code that creates empty changegroups just because that would be wasteful. Let's use develwarn() for that instead, so we catch any such cases that run with our test runner, but we still allow others to generate empty changegroups if they want to. We have run into this check at Google once or twice and had to work around it, but I'm changing this not so much because of that, but because it seems like it shouldn't be an error. I also changed the message slightly to be more modern ("changelog group" -> "changegroup") and more generic ("received" -> "applied").
Sat, 01 Jul 2017 00:00:09 -0700 changegroup: remove option to allow empty changegroup (API)
Martin von Zweigbergk <martinvonz@google.com> [Sat, 01 Jul 2017 00:00:09 -0700] rev 33308
changegroup: remove option to allow empty changegroup (API) No caller sets the "emptyok" option, so let's remove it.
Fri, 30 Jun 2017 23:58:31 -0700 strip: don't allow empty changegroup in bundle1
Martin von Zweigbergk <martinvonz@google.com> [Fri, 30 Jun 2017 23:58:31 -0700] rev 33307
strip: don't allow empty changegroup in bundle1 Applying an empty changegroup has been an error since the beginning. The only exception was strip, which would allow to apply an empty changegroup from the temporary bundle. However, the emptyok=True option was only set for bundle1 bundles. In other words, temporary bundle2 bundles would fail if they were empty. Bundle2 has now been used enough that it seems safe to say that we simply don't create bundle2 bundles with empty changegroups. That also suggests that we never create bundle1 bundles with empty changegroups (i.e. empty bundle1 bundles, since bundle1 is just a changegroup), because, AFAICT, the code leading up to the application of the bundle is the same for bundle1 and bundle2. Therefore, let's stop passing emptyok=True, so we more clearly get the same behavior for bundle1 and bundle2.
Thu, 08 Jun 2017 22:49:21 -0700 match: minor cleanups to patternmatcher and includematcher
Martin von Zweigbergk <martinvonz@google.com> [Thu, 08 Jun 2017 22:49:21 -0700] rev 33306
match: minor cleanups to patternmatcher and includematcher The "patterns"/"include" in "patternspat"/"includepat" is redundant, so drop it. Also a "_" prefix since it's "private". Inline the "pm"/"im" variables.
Thu, 06 Jul 2017 17:18:50 +0200 py3: fix test-diff-newlines.t to be compatible with py3
Boris Feld <boris.feld@octobus.net> [Thu, 06 Jul 2017 17:18:50 +0200] rev 33305
py3: fix test-diff-newlines.t to be compatible with py3
Thu, 06 Jul 2017 14:48:16 -0700 sparse: move some temporary includes functions into core
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 06 Jul 2017 14:48:16 -0700] rev 33304
sparse: move some temporary includes functions into core Functions for reading and writing the tempsparse file have been moved. prunetemporaryincludes() will be moved separately because it is non-trivial.
Thu, 06 Jul 2017 12:24:55 -0700 sparse: move config file writing into core
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 06 Jul 2017 12:24:55 -0700] rev 33303
sparse: move config file writing into core The code was refactored during the move to be more procedural instead of using string formatting. This has the benefit of not writing empty sections, which changed tests.
Thu, 06 Jul 2017 12:20:53 -0700 localrepo: add sparse caches
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 06 Jul 2017 12:20:53 -0700] rev 33302
localrepo: add sparse caches The sparse extension maintains caches for the sparse files to a signature and a signature to a matcher. This allows the sparse matchers to be resolved quickly, which is apparently something that can occur in loops. This patch ports the sparse caches to the localrepo class pretty much as-is. There is potentially room to improve the caching mechanism. But that can be done as a follow-up. The default invalidatecaches() now clears the relevant sparse cache. invalidatesignaturecache() has been moved to sparse.py.
Thu, 06 Jul 2017 12:26:04 -0700 sparse: move active profiles function into core
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 06 Jul 2017 12:26:04 -0700] rev 33301
sparse: move active profiles function into core Also includes some light formatting changes.
Thu, 06 Jul 2017 12:15:14 -0700 sparse: move resolving of sparse patterns for rev into core
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 06 Jul 2017 12:15:14 -0700] rev 33300
sparse: move resolving of sparse patterns for rev into core This method is reasonably well-contained and simple to move. As part of the move, some light formatting was performed. A "working copy" reference in an error message was changed to "working directory." The biggest change was to _refreshoncommit() in sparse.py. It was previously checking for the existence of an attribute on the repo instance. Since the moved function now returns empty data if sparse isn't enabled, we unconditionally call the new function. However, we do have to protect another method call in that function. This will all be unhacked eventually.
Thu, 06 Jul 2017 12:06:37 -0700 sparse: variable to track if sparse is enabled
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 06 Jul 2017 12:06:37 -0700] rev 33299
sparse: variable to track if sparse is enabled Currently, the sparse extension sniffs repo instances for attributes defined by the sparse extension to determine if sparse is enabled. As we move code away from repo instances, these checks will be a bit more brittle. We introduce a module-level variable to track whether sparse is enabled as a temporary workaround.
Thu, 06 Jul 2017 12:14:12 -0700 sparse: move profile reading into core
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 06 Jul 2017 12:14:12 -0700] rev 33298
sparse: move profile reading into core One more step towards weaning off methods on repo instances and moving code to core. While this function is only used once and is simple, it needs to exist on its own so Facebook can monkeypatch it to enable simplecache integration.
Thu, 06 Jul 2017 12:14:03 -0700 sparse: move config parsing into core
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 06 Jul 2017 12:14:03 -0700] rev 33297
sparse: move config parsing into core This patch marks the beginning of moving code from the sparse extension into core. The goal is to move as much of the functionality as possible into core, where it will be an experimental feature. The extension will likely continue to exist to enable the feature and provide UI elements. As part of the move, the repo method was converted to a module function. It doesn't need to exist on repos. An error message was also updated to reflect that an error isn't necessarily from the .hg/sparse file. The API should be updated later to pass in a filename so the error can be more descriptive. Copyright of the added file was copied from the sparse extension.
Thu, 06 Jul 2017 10:58:45 -0700 sparse: use vfs.tryread()
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 06 Jul 2017 10:58:45 -0700] rev 33296
sparse: use vfs.tryread() vfs.exists() followed by a file read is an anti-pattern because it incurs an extra stat() to test for file presence. vfs.tryread() returns empty string on missing file and avoids the stat().
Sat, 01 Jul 2017 11:56:39 -0700 sparse: refactor sparsechecksum()
Gregory Szorc <gregory.szorc@gmail.com> [Sat, 01 Jul 2017 11:56:39 -0700] rev 33295
sparse: refactor sparsechecksum() This was relying on garbage collection to close the opened file, which is a bug. Both callers simply called into self.vfs to resolve the path. So refactor to use the vfs layer. While we're here, rename the method to reflect it is internal and to break anyone relying on the old behavior.
Thu, 06 Jul 2017 10:57:26 -0700 sparse: document config file format
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 06 Jul 2017 10:57:26 -0700] rev 33294
sparse: document config file format This was previously undocumented. Seems useful to have.
Sat, 01 Jul 2017 10:29:27 -0700 sparse: rename command to debugsparse
Gregory Szorc <gregory.szorc@gmail.com> [Sat, 01 Jul 2017 10:29:27 -0700] rev 33293
sparse: rename command to debugsparse Sparse checkout is still highly experimental and not protected by BC guarantees yet. We also haven't had a discussion on the UX. To discourage use, we rename the sparse command to debugsparse.
Thu, 06 Jul 2017 10:54:23 -0700 sparse: remove reference to simplecache
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 06 Jul 2017 10:54:23 -0700] rev 33292
sparse: remove reference to simplecache This is a 3rd party extension authored by Facebook. References in core are not appropriate. It will be possible to restore this code/optimization via monkeypatching. So Facebook won't lose any functionality. The removed code is important for performance. So add a comment tracking it.
(0) -30000 -10000 -3000 -1000 -300 -100 -50 -30 +30 +50 +100 +300 +1000 +3000 +10000 tip