Mercurial > public > mercurial-scm > hg
annotate tests/test-storage.py @ 40326:fed697fa1734
sqlitestore: file storage backend using SQLite
This commit provides an extension which uses SQLite to store file
data (as opposed to revlogs).
As the inline documentation describes, there are still several
aspects to the extension that are incomplete. But it's a start.
The extension does support basic clone, checkout, and commit
workflows, which makes it suitable for simple use cases.
One notable missing feature is support for "bundlerepos." This is
probably responsible for the most test failures when the extension
is activated as part of the test suite.
All revision data is stored in SQLite. Data is stored as zstd
compressed chunks (default if zstd is available), zlib compressed
chunks (default if zstd is not available), or raw chunks (if
configured or if a compressed delta is not smaller than the raw
delta). This makes things very similar to revlogs.
Unlike revlogs, the extension doesn't yet enforce a limit on delta
chain length. This is an obvious limitation and should be addressed.
This is somewhat mitigated by the use of zstd, which is much faster
than zlib to decompress.
There is a dedicated table for storing deltas. Deltas are stored
by the SHA-1 hash of their uncompressed content. The "fileindex" table
has columns that reference the delta for each revision and the base
delta that delta should be applied against. A recursive SQL query
is used to resolve the delta chain along with the delta data.
By storing deltas by hash, we are able to de-duplicate delta storage!
With revlogs, the same deltas in different revlogs would result in
duplicate storage of that delta. In this scheme, inserting the
duplicate delta is a no-op and delta chains simply reference the
existing delta.
When initially implementing this extension, I did not have
content-indexed deltas and deltas could be duplicated across files
(just like revlogs). When I implemented content-indexed deltas, the
size of the SQLite database for a full clone of mozilla-unified
dropped:
before: 2,554,261,504 bytes
after: 2,488,754,176 bytes
Surprisingly, this is still larger than the bytes size of revlog
files:
revlog files: 2,104,861,230 bytes
du -b: 2,254,381,614
I would have expected storage to be smaller since we're not limiting
delta chain length and since we're using zstd instead of zlib. I
suspect the SQLite indexes and per-column overhead account for the
bulk of the differences. (Keep in mind that revlog uses a 64-byte
packed struct for revision index data and deltas are stored without
padding. Aside from the 12 unused bytes in the 32 byte node field,
revlogs are pretty efficient.) Another source of overhead is file
name storage. With revlogs, file names are stored in the filesystem.
But with SQLite, we need to store file names in the database. This is
roughly equivalent to the size of the fncache file, which for the
mozilla-unified repository is ~34MB.
Since the SQLite database isn't append-only and since delta chains
can reference any delta, this opens some interesting possibilities.
For example, we could store deltas in reverse, such that fulltexts
are stored for newer revisions and deltas are applied to reconstruct
older revisions. This is likely a more optimal storage strategy for
version control, as new data tends to be more frequently accessed
than old data. We would obviously need wire protocol support for
transferring revision data from newest to oldest. And we would
probably need some kind of mechanism for "re-encoding" stores. But
it should be doable.
This extension is very much experimental quality. There are a handful
of features that don't work. It probably isn't suitable for day-to-day
use. But it could be used in limited cases (e.g. read-only checkouts
like in CI). And it is also a good proving ground for alternate
storage backends. As we continue to define interfaces for all things
storage, it will be useful to have a viable alternate storage backend
to see how things shake out in practice.
test-storage.py passes on Python 2 and introduces no new test failures on
Python 3. Having the storage-level unit tests has proved to be insanely
useful when developing this extension. Those tests caught numerous bugs
during development and I'm convinced this style of testing is the way
forward for ensuring alternate storage backends work as intended. Of
course, test coverage isn't close to what it needs to be. But it is
a start. And what coverage we have gives me confidence that basic store
functionality is implemented properly.
Differential Revision: https://phab.mercurial-scm.org/D4928
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Tue, 09 Oct 2018 08:50:13 -0700 |
parents | 2c0aa02ecd5a |
children | c3ad9ef0876c |
rev | line source |
---|---|
39772
ae531f5e583c
testing: add interface unit tests for file storage
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
1 # This test verifies the conformance of various classes to various |
ae531f5e583c
testing: add interface unit tests for file storage
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
2 # storage interfaces. |
ae531f5e583c
testing: add interface unit tests for file storage
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
3 from __future__ import absolute_import |
ae531f5e583c
testing: add interface unit tests for file storage
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
4 |
ae531f5e583c
testing: add interface unit tests for file storage
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
5 import silenttestrunner |
ae531f5e583c
testing: add interface unit tests for file storage
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
6 |
ae531f5e583c
testing: add interface unit tests for file storage
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
7 from mercurial import ( |
40051
cdf61ab1f54c
testing: add file storage integration for bad hashes and censoring
Gregory Szorc <gregory.szorc@gmail.com>
parents:
39953
diff
changeset
|
8 error, |
39772
ae531f5e583c
testing: add interface unit tests for file storage
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
9 filelog, |
40051
cdf61ab1f54c
testing: add file storage integration for bad hashes and censoring
Gregory Szorc <gregory.szorc@gmail.com>
parents:
39953
diff
changeset
|
10 revlog, |
39772
ae531f5e583c
testing: add interface unit tests for file storage
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
11 transaction, |
ae531f5e583c
testing: add interface unit tests for file storage
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
12 ui as uimod, |
ae531f5e583c
testing: add interface unit tests for file storage
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
13 vfs as vfsmod, |
ae531f5e583c
testing: add interface unit tests for file storage
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
14 ) |
ae531f5e583c
testing: add interface unit tests for file storage
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
15 |
ae531f5e583c
testing: add interface unit tests for file storage
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
16 from mercurial.testing import ( |
ae531f5e583c
testing: add interface unit tests for file storage
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
17 storage as storagetesting, |
ae531f5e583c
testing: add interface unit tests for file storage
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
18 ) |
ae531f5e583c
testing: add interface unit tests for file storage
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
19 |
40326
fed697fa1734
sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents:
40323
diff
changeset
|
20 from hgext import ( |
fed697fa1734
sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents:
40323
diff
changeset
|
21 sqlitestore, |
fed697fa1734
sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents:
40323
diff
changeset
|
22 ) |
fed697fa1734
sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents:
40323
diff
changeset
|
23 |
fed697fa1734
sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents:
40323
diff
changeset
|
24 try: |
fed697fa1734
sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents:
40323
diff
changeset
|
25 from mercurial import zstd |
fed697fa1734
sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents:
40323
diff
changeset
|
26 zstd.__version__ |
fed697fa1734
sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents:
40323
diff
changeset
|
27 except ImportError: |
fed697fa1734
sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents:
40323
diff
changeset
|
28 zstd = None |
fed697fa1734
sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents:
40323
diff
changeset
|
29 |
39772
ae531f5e583c
testing: add interface unit tests for file storage
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
30 STATE = { |
ae531f5e583c
testing: add interface unit tests for file storage
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
31 'lastindex': 0, |
ae531f5e583c
testing: add interface unit tests for file storage
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
32 'ui': uimod.ui(), |
ae531f5e583c
testing: add interface unit tests for file storage
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
33 'vfs': vfsmod.vfs(b'.', realpath=True), |
ae531f5e583c
testing: add interface unit tests for file storage
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
34 } |
ae531f5e583c
testing: add interface unit tests for file storage
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
35 |
ae531f5e583c
testing: add interface unit tests for file storage
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
36 def makefilefn(self): |
ae531f5e583c
testing: add interface unit tests for file storage
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
37 """Factory for filelog instances.""" |
39953
a3a9b93bff80
py3: byteify test-storage.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
39772
diff
changeset
|
38 fl = filelog.filelog(STATE['vfs'], b'filelog-%d' % STATE['lastindex']) |
39772
ae531f5e583c
testing: add interface unit tests for file storage
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
39 STATE['lastindex'] += 1 |
ae531f5e583c
testing: add interface unit tests for file storage
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
40 return fl |
ae531f5e583c
testing: add interface unit tests for file storage
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
41 |
ae531f5e583c
testing: add interface unit tests for file storage
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
42 def maketransaction(self): |
40320
9b2e1b00ee94
tests: use byte literals in test-storage.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
40056
diff
changeset
|
43 vfsmap = {b'plain': STATE['vfs'], b'store': STATE['vfs']} |
39772
ae531f5e583c
testing: add interface unit tests for file storage
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
44 |
ae531f5e583c
testing: add interface unit tests for file storage
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
45 return transaction.transaction(STATE['ui'].warn, STATE['vfs'], vfsmap, |
39953
a3a9b93bff80
py3: byteify test-storage.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
39772
diff
changeset
|
46 b'journal', b'undo') |
39772
ae531f5e583c
testing: add interface unit tests for file storage
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
47 |
40051
cdf61ab1f54c
testing: add file storage integration for bad hashes and censoring
Gregory Szorc <gregory.szorc@gmail.com>
parents:
39953
diff
changeset
|
48 def addrawrevision(self, fl, tr, node, p1, p2, linkrev, rawtext=None, |
cdf61ab1f54c
testing: add file storage integration for bad hashes and censoring
Gregory Szorc <gregory.szorc@gmail.com>
parents:
39953
diff
changeset
|
49 delta=None, censored=False, ellipsis=False, extstored=False): |
cdf61ab1f54c
testing: add file storage integration for bad hashes and censoring
Gregory Szorc <gregory.szorc@gmail.com>
parents:
39953
diff
changeset
|
50 flags = 0 |
cdf61ab1f54c
testing: add file storage integration for bad hashes and censoring
Gregory Szorc <gregory.szorc@gmail.com>
parents:
39953
diff
changeset
|
51 |
cdf61ab1f54c
testing: add file storage integration for bad hashes and censoring
Gregory Szorc <gregory.szorc@gmail.com>
parents:
39953
diff
changeset
|
52 if censored: |
cdf61ab1f54c
testing: add file storage integration for bad hashes and censoring
Gregory Szorc <gregory.szorc@gmail.com>
parents:
39953
diff
changeset
|
53 flags |= revlog.REVIDX_ISCENSORED |
cdf61ab1f54c
testing: add file storage integration for bad hashes and censoring
Gregory Szorc <gregory.szorc@gmail.com>
parents:
39953
diff
changeset
|
54 if ellipsis: |
cdf61ab1f54c
testing: add file storage integration for bad hashes and censoring
Gregory Szorc <gregory.szorc@gmail.com>
parents:
39953
diff
changeset
|
55 flags |= revlog.REVIDX_ELLIPSIS |
cdf61ab1f54c
testing: add file storage integration for bad hashes and censoring
Gregory Szorc <gregory.szorc@gmail.com>
parents:
39953
diff
changeset
|
56 if extstored: |
cdf61ab1f54c
testing: add file storage integration for bad hashes and censoring
Gregory Szorc <gregory.szorc@gmail.com>
parents:
39953
diff
changeset
|
57 flags |= revlog.REVIDX_EXTSTORED |
cdf61ab1f54c
testing: add file storage integration for bad hashes and censoring
Gregory Szorc <gregory.szorc@gmail.com>
parents:
39953
diff
changeset
|
58 |
cdf61ab1f54c
testing: add file storage integration for bad hashes and censoring
Gregory Szorc <gregory.szorc@gmail.com>
parents:
39953
diff
changeset
|
59 if rawtext is not None: |
cdf61ab1f54c
testing: add file storage integration for bad hashes and censoring
Gregory Szorc <gregory.szorc@gmail.com>
parents:
39953
diff
changeset
|
60 fl._revlog.addrawrevision(rawtext, tr, linkrev, p1, p2, node, flags) |
cdf61ab1f54c
testing: add file storage integration for bad hashes and censoring
Gregory Szorc <gregory.szorc@gmail.com>
parents:
39953
diff
changeset
|
61 elif delta is not None: |
40323
2c0aa02ecd5a
testing: switch to inserting deltas
Gregory Szorc <gregory.szorc@gmail.com>
parents:
40320
diff
changeset
|
62 fl._revlog.addrawrevision(rawtext, tr, linkrev, p1, p2, node, flags, |
2c0aa02ecd5a
testing: switch to inserting deltas
Gregory Szorc <gregory.szorc@gmail.com>
parents:
40320
diff
changeset
|
63 cachedelta=delta) |
40051
cdf61ab1f54c
testing: add file storage integration for bad hashes and censoring
Gregory Szorc <gregory.szorc@gmail.com>
parents:
39953
diff
changeset
|
64 else: |
cdf61ab1f54c
testing: add file storage integration for bad hashes and censoring
Gregory Szorc <gregory.szorc@gmail.com>
parents:
39953
diff
changeset
|
65 raise error.Abort('must supply rawtext or delta arguments') |
cdf61ab1f54c
testing: add file storage integration for bad hashes and censoring
Gregory Szorc <gregory.szorc@gmail.com>
parents:
39953
diff
changeset
|
66 |
cdf61ab1f54c
testing: add file storage integration for bad hashes and censoring
Gregory Szorc <gregory.szorc@gmail.com>
parents:
39953
diff
changeset
|
67 # We may insert bad data. Clear caches to prevent e.g. cache hits to |
cdf61ab1f54c
testing: add file storage integration for bad hashes and censoring
Gregory Szorc <gregory.szorc@gmail.com>
parents:
39953
diff
changeset
|
68 # bypass hash verification. |
cdf61ab1f54c
testing: add file storage integration for bad hashes and censoring
Gregory Szorc <gregory.szorc@gmail.com>
parents:
39953
diff
changeset
|
69 fl._revlog.clearcaches() |
cdf61ab1f54c
testing: add file storage integration for bad hashes and censoring
Gregory Szorc <gregory.szorc@gmail.com>
parents:
39953
diff
changeset
|
70 |
39772
ae531f5e583c
testing: add interface unit tests for file storage
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
71 # Assigning module-level attributes that inherit from unittest.TestCase |
ae531f5e583c
testing: add interface unit tests for file storage
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
72 # is all that is needed to register tests. |
ae531f5e583c
testing: add interface unit tests for file storage
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
73 filelogindextests = storagetesting.makeifileindextests(makefilefn, |
40051
cdf61ab1f54c
testing: add file storage integration for bad hashes and censoring
Gregory Szorc <gregory.szorc@gmail.com>
parents:
39953
diff
changeset
|
74 maketransaction, |
cdf61ab1f54c
testing: add file storage integration for bad hashes and censoring
Gregory Szorc <gregory.szorc@gmail.com>
parents:
39953
diff
changeset
|
75 addrawrevision) |
39772
ae531f5e583c
testing: add interface unit tests for file storage
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
76 filelogdatatests = storagetesting.makeifiledatatests(makefilefn, |
40051
cdf61ab1f54c
testing: add file storage integration for bad hashes and censoring
Gregory Szorc <gregory.szorc@gmail.com>
parents:
39953
diff
changeset
|
77 maketransaction, |
cdf61ab1f54c
testing: add file storage integration for bad hashes and censoring
Gregory Szorc <gregory.szorc@gmail.com>
parents:
39953
diff
changeset
|
78 addrawrevision) |
39772
ae531f5e583c
testing: add interface unit tests for file storage
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
79 filelogmutationtests = storagetesting.makeifilemutationtests(makefilefn, |
40051
cdf61ab1f54c
testing: add file storage integration for bad hashes and censoring
Gregory Szorc <gregory.szorc@gmail.com>
parents:
39953
diff
changeset
|
80 maketransaction, |
cdf61ab1f54c
testing: add file storage integration for bad hashes and censoring
Gregory Szorc <gregory.szorc@gmail.com>
parents:
39953
diff
changeset
|
81 addrawrevision) |
39772
ae531f5e583c
testing: add interface unit tests for file storage
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
82 |
40326
fed697fa1734
sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents:
40323
diff
changeset
|
83 def makesqlitefile(self): |
fed697fa1734
sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents:
40323
diff
changeset
|
84 path = STATE['vfs'].join(b'db-%d.db' % STATE['lastindex']) |
fed697fa1734
sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents:
40323
diff
changeset
|
85 STATE['lastindex'] += 1 |
fed697fa1734
sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents:
40323
diff
changeset
|
86 |
fed697fa1734
sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents:
40323
diff
changeset
|
87 db = sqlitestore.makedb(path) |
fed697fa1734
sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents:
40323
diff
changeset
|
88 |
fed697fa1734
sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents:
40323
diff
changeset
|
89 compression = b'zstd' if zstd else b'zlib' |
fed697fa1734
sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents:
40323
diff
changeset
|
90 |
fed697fa1734
sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents:
40323
diff
changeset
|
91 return sqlitestore.sqlitefilestore(db, b'dummy-path', compression) |
fed697fa1734
sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents:
40323
diff
changeset
|
92 |
fed697fa1734
sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents:
40323
diff
changeset
|
93 def addrawrevisionsqlite(self, fl, tr, node, p1, p2, linkrev, rawtext=None, |
fed697fa1734
sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents:
40323
diff
changeset
|
94 delta=None, censored=False, ellipsis=False, |
fed697fa1734
sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents:
40323
diff
changeset
|
95 extstored=False): |
fed697fa1734
sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents:
40323
diff
changeset
|
96 flags = 0 |
fed697fa1734
sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents:
40323
diff
changeset
|
97 |
fed697fa1734
sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents:
40323
diff
changeset
|
98 if censored: |
fed697fa1734
sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents:
40323
diff
changeset
|
99 flags |= sqlitestore.FLAG_CENSORED |
fed697fa1734
sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents:
40323
diff
changeset
|
100 |
fed697fa1734
sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents:
40323
diff
changeset
|
101 if ellipsis | extstored: |
fed697fa1734
sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents:
40323
diff
changeset
|
102 raise error.Abort(b'support for ellipsis and extstored flags not ' |
fed697fa1734
sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents:
40323
diff
changeset
|
103 b'supported') |
fed697fa1734
sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents:
40323
diff
changeset
|
104 |
fed697fa1734
sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents:
40323
diff
changeset
|
105 if rawtext is not None: |
fed697fa1734
sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents:
40323
diff
changeset
|
106 fl._addrawrevision(node, rawtext, tr, linkrev, p1, p2, flags=flags) |
fed697fa1734
sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents:
40323
diff
changeset
|
107 elif delta is not None: |
fed697fa1734
sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents:
40323
diff
changeset
|
108 fl._addrawrevision(node, rawtext, tr, linkrev, p1, p2, |
fed697fa1734
sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents:
40323
diff
changeset
|
109 storedelta=delta, flags=flags) |
fed697fa1734
sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents:
40323
diff
changeset
|
110 else: |
fed697fa1734
sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents:
40323
diff
changeset
|
111 raise error.Abort(b'must supply rawtext or delta arguments') |
fed697fa1734
sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents:
40323
diff
changeset
|
112 |
fed697fa1734
sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents:
40323
diff
changeset
|
113 sqlitefileindextests = storagetesting.makeifileindextests( |
fed697fa1734
sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents:
40323
diff
changeset
|
114 makesqlitefile, maketransaction, addrawrevisionsqlite) |
fed697fa1734
sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents:
40323
diff
changeset
|
115 sqlitefiledatatests = storagetesting.makeifiledatatests( |
fed697fa1734
sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents:
40323
diff
changeset
|
116 makesqlitefile, maketransaction, addrawrevisionsqlite) |
fed697fa1734
sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents:
40323
diff
changeset
|
117 sqlitefilemutationtests = storagetesting.makeifilemutationtests( |
fed697fa1734
sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents:
40323
diff
changeset
|
118 makesqlitefile, maketransaction, addrawrevisionsqlite) |
fed697fa1734
sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents:
40323
diff
changeset
|
119 |
39772
ae531f5e583c
testing: add interface unit tests for file storage
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
120 if __name__ == '__main__': |
ae531f5e583c
testing: add interface unit tests for file storage
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
121 silenttestrunner.main(__name__) |