Commit Graph

4 Commits

Author SHA1 Message Date
Jack O'Connor 724dd92d03 add a test case for escaping *'s in our globs 2016-04-19 11:10:07 -04:00
Jack O'Connor c6e41fde5f rewrite the cache to be asynchronous
We've been seeing "Task X took Y seconds" warnings in our tests for a
long time, especially on Windows. Running git commands synchronously
blocks other tasks from running, like display redrawing. It's bad
practice in an async program.

One of the barriers to async-ifying the cache code earlier was that many
commands relied on having exclusive ownership of the index file while
they were running. For example, 1) read a tree into the index, 2) merge
another tree into some subdirectory, 3) write out the result. If any
other git commands ran in the middle of that, it would screw up the
result. So we need to rewrite every cache function to use its own
temporary index file, if we want them to run in parallel.

The reason I'm finally getting around to this now, is that I'm trying to
reduce the number of git commands that run in a no-op sync. One of the
optimizations I'm going to want to do, is to reuse the index file from
the last sync, so that we don't need a `read-tree` and an `update-index`
just to set us up for `diff-files`. But the plumbing to do that right is
pretty much the same as what we should be doing to run every git command
with its own index anyway. So let's just bite the bullet and do that
now, and then reusing index files will be easy after that.
2015-11-27 20:18:57 -05:00
Jack O'Connor 5c90e55558 make pick and executable into tree operations
Summary:
Note that while `files` is still supported (until after we release all
these features -- then we can finally get rid of it!), it no longer
unions with `pick`. Instead, `pick` applies *first*, and only what
remains is elligible for `files`. One test has been updated to account
for this change.

Test Plan: Additional tests in `test_rules.py`.

Reviewers: sean

Differential Revision: https://phabricator.buildinspace.com/D201
2015-03-05 00:39:24 -05:00
Jack O'Connor 333fbd64e7 create glob.py
Summary:
For operations on git trees, we'll need a way to expand globs that
doesn't touch the filesystem. Having played with git's native globbing
before, it's not great. (I don't think ** is allowed to be empty, for
example.) This creates a new `peru.glob` module, which can convert path
globs into regexes.

Test Plan: Tons of test cases.

Reviewers: sean

Differential Revision: https://phabricator.buildinspace.com/D190
2015-03-05 00:19:15 -05:00