annotate tests/test-storage.py @ 47920:9c4204b7f3e4

tests: rely on dummyssh being the default This commit is exactly the result of running this command: sed -i -e 's! *\(-e \|--ssh \|--config ui.ssh=\)[ \"]*$PYTHON[ \"]*$\(RUN\|\)TESTDIR/dummyssh[\"]* *! !g' -e '/^[ >]*ssh *=[ "]*$PYTHON[ "]*$\(RUN\|\)TESTDIR\/dummyssh[ "]*$/d' -e 's/^\( [$] .*[^ ]\) *$/\1/' *.t *.sh Sometimes the tests can be simplified further, but I think it's preferable to do the simplification separately. Differential Revision: https://phab.mercurial-scm.org/D11245
author Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
date Mon, 02 Aug 2021 21:25:01 -0400
parents 2372284d9457
children 6000f5b25c9b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40453
diff changeset
16 from mercurial.testing import storage as storagetesting
39772
ae531f5e583c testing: add interface unit tests for file storage
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
17
40363
c3ad9ef0876c tests: don't emit false failures when sqlite3 is missing
Augie Fackler <augie@google.com>
parents: 40326
diff changeset
18 try:
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40453
diff changeset
19 from hgext import sqlitestore
40363
c3ad9ef0876c tests: don't emit false failures when sqlite3 is missing
Augie Fackler <augie@google.com>
parents: 40326
diff changeset
20 except ImportError:
c3ad9ef0876c tests: don't emit false failures when sqlite3 is missing
Augie Fackler <augie@google.com>
parents: 40326
diff changeset
21 sqlitestore = None
40326
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 try:
40453
1bf3e6041e2c tests: require SQLite 3.8.3+ as sqlitestore relies on "WITH" clause
Yuya Nishihara <yuya@tcha.org>
parents: 40363
diff changeset
24 import sqlite3
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40453
diff changeset
25
40453
1bf3e6041e2c tests: require SQLite 3.8.3+ as sqlitestore relies on "WITH" clause
Yuya Nishihara <yuya@tcha.org>
parents: 40363
diff changeset
26 if sqlite3.sqlite_version_info < (3, 8, 3):
1bf3e6041e2c tests: require SQLite 3.8.3+ as sqlitestore relies on "WITH" clause
Yuya Nishihara <yuya@tcha.org>
parents: 40363
diff changeset
27 # WITH clause not supported
1bf3e6041e2c tests: require SQLite 3.8.3+ as sqlitestore relies on "WITH" clause
Yuya Nishihara <yuya@tcha.org>
parents: 40363
diff changeset
28 sqlitestore = None
1bf3e6041e2c tests: require SQLite 3.8.3+ as sqlitestore relies on "WITH" clause
Yuya Nishihara <yuya@tcha.org>
parents: 40363
diff changeset
29 except ImportError:
1bf3e6041e2c tests: require SQLite 3.8.3+ as sqlitestore relies on "WITH" clause
Yuya Nishihara <yuya@tcha.org>
parents: 40363
diff changeset
30 pass
1bf3e6041e2c tests: require SQLite 3.8.3+ as sqlitestore relies on "WITH" clause
Yuya Nishihara <yuya@tcha.org>
parents: 40363
diff changeset
31
1bf3e6041e2c tests: require SQLite 3.8.3+ as sqlitestore relies on "WITH" clause
Yuya Nishihara <yuya@tcha.org>
parents: 40363
diff changeset
32 try:
40326
fed697fa1734 sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40323
diff changeset
33 from mercurial import zstd
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40453
diff changeset
34
40326
fed697fa1734 sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40323
diff changeset
35 zstd.__version__
fed697fa1734 sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40323
diff changeset
36 except ImportError:
fed697fa1734 sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40323
diff changeset
37 zstd = None
fed697fa1734 sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40323
diff changeset
38
39772
ae531f5e583c testing: add interface unit tests for file storage
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
39 STATE = {
ae531f5e583c testing: add interface unit tests for file storage
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
40 'lastindex': 0,
ae531f5e583c testing: add interface unit tests for file storage
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
41 'ui': uimod.ui(),
ae531f5e583c testing: add interface unit tests for file storage
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
42 'vfs': vfsmod.vfs(b'.', realpath=True),
ae531f5e583c testing: add interface unit tests for file storage
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
43 }
ae531f5e583c testing: add interface unit tests for file storage
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
44
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40453
diff changeset
45
39772
ae531f5e583c testing: add interface unit tests for file storage
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
46 def makefilefn(self):
ae531f5e583c testing: add interface unit tests for file storage
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
47 """Factory for filelog instances."""
39953
a3a9b93bff80 py3: byteify test-storage.py
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39772
diff changeset
48 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
49 STATE['lastindex'] += 1
ae531f5e583c testing: add interface unit tests for file storage
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
50 return fl
ae531f5e583c testing: add interface unit tests for file storage
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
51
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40453
diff changeset
52
39772
ae531f5e583c testing: add interface unit tests for file storage
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
53 def maketransaction(self):
40320
9b2e1b00ee94 tests: use byte literals in test-storage.py
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40056
diff changeset
54 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
55
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40453
diff changeset
56 return transaction.transaction(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40453
diff changeset
57 STATE['ui'].warn, STATE['vfs'], vfsmap, b'journal', b'undo'
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40453
diff changeset
58 )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40453
diff changeset
59
39772
ae531f5e583c testing: add interface unit tests for file storage
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
60
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40453
diff changeset
61 def addrawrevision(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40453
diff changeset
62 self,
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40453
diff changeset
63 fl,
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40453
diff changeset
64 tr,
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40453
diff changeset
65 node,
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40453
diff changeset
66 p1,
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40453
diff changeset
67 p2,
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40453
diff changeset
68 linkrev,
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40453
diff changeset
69 rawtext=None,
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40453
diff changeset
70 delta=None,
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40453
diff changeset
71 censored=False,
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40453
diff changeset
72 ellipsis=False,
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40453
diff changeset
73 extstored=False,
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40453
diff changeset
74 ):
40051
cdf61ab1f54c testing: add file storage integration for bad hashes and censoring
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39953
diff changeset
75 flags = 0
cdf61ab1f54c testing: add file storage integration for bad hashes and censoring
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39953
diff changeset
76
cdf61ab1f54c testing: add file storage integration for bad hashes and censoring
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39953
diff changeset
77 if censored:
cdf61ab1f54c testing: add file storage integration for bad hashes and censoring
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39953
diff changeset
78 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
79 if ellipsis:
cdf61ab1f54c testing: add file storage integration for bad hashes and censoring
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39953
diff changeset
80 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
81 if extstored:
cdf61ab1f54c testing: add file storage integration for bad hashes and censoring
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39953
diff changeset
82 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
83
cdf61ab1f54c testing: add file storage integration for bad hashes and censoring
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39953
diff changeset
84 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
85 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
86 elif delta is not None:
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40453
diff changeset
87 fl._revlog.addrawrevision(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40453
diff changeset
88 rawtext, tr, linkrev, p1, p2, node, flags, cachedelta=delta
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40453
diff changeset
89 )
40051
cdf61ab1f54c testing: add file storage integration for bad hashes and censoring
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39953
diff changeset
90 else:
cdf61ab1f54c testing: add file storage integration for bad hashes and censoring
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39953
diff changeset
91 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
92
cdf61ab1f54c testing: add file storage integration for bad hashes and censoring
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39953
diff changeset
93 # 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
94 # bypass hash verification.
cdf61ab1f54c testing: add file storage integration for bad hashes and censoring
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39953
diff changeset
95 fl._revlog.clearcaches()
cdf61ab1f54c testing: add file storage integration for bad hashes and censoring
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39953
diff changeset
96
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40453
diff changeset
97
39772
ae531f5e583c testing: add interface unit tests for file storage
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
98 # 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
99 # is all that is needed to register tests.
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40453
diff changeset
100 filelogindextests = storagetesting.makeifileindextests(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40453
diff changeset
101 makefilefn, maketransaction, addrawrevision
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40453
diff changeset
102 )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40453
diff changeset
103 filelogdatatests = storagetesting.makeifiledatatests(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40453
diff changeset
104 makefilefn, maketransaction, addrawrevision
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40453
diff changeset
105 )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40453
diff changeset
106 filelogmutationtests = storagetesting.makeifilemutationtests(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40453
diff changeset
107 makefilefn, maketransaction, addrawrevision
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40453
diff changeset
108 )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40453
diff changeset
109
39772
ae531f5e583c testing: add interface unit tests for file storage
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
110
40326
fed697fa1734 sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40323
diff changeset
111 def makesqlitefile(self):
fed697fa1734 sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40323
diff changeset
112 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
113 STATE['lastindex'] += 1
fed697fa1734 sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40323
diff changeset
114
fed697fa1734 sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40323
diff changeset
115 db = sqlitestore.makedb(path)
fed697fa1734 sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40323
diff changeset
116
fed697fa1734 sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40323
diff changeset
117 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
118
fed697fa1734 sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40323
diff changeset
119 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
120
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40453
diff changeset
121
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40453
diff changeset
122 def addrawrevisionsqlite(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40453
diff changeset
123 self,
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40453
diff changeset
124 fl,
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40453
diff changeset
125 tr,
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40453
diff changeset
126 node,
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40453
diff changeset
127 p1,
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40453
diff changeset
128 p2,
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40453
diff changeset
129 linkrev,
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40453
diff changeset
130 rawtext=None,
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40453
diff changeset
131 delta=None,
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40453
diff changeset
132 censored=False,
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40453
diff changeset
133 ellipsis=False,
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40453
diff changeset
134 extstored=False,
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40453
diff changeset
135 ):
40326
fed697fa1734 sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40323
diff changeset
136 flags = 0
fed697fa1734 sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40323
diff changeset
137
fed697fa1734 sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40323
diff changeset
138 if censored:
fed697fa1734 sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40323
diff changeset
139 flags |= sqlitestore.FLAG_CENSORED
fed697fa1734 sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40323
diff changeset
140
fed697fa1734 sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40323
diff changeset
141 if ellipsis | extstored:
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40453
diff changeset
142 raise error.Abort(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40453
diff changeset
143 b'support for ellipsis and extstored flags not ' b'supported'
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40453
diff changeset
144 )
40326
fed697fa1734 sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40323
diff changeset
145
fed697fa1734 sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40323
diff changeset
146 if rawtext is not None:
fed697fa1734 sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40323
diff changeset
147 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
148 elif delta is not None:
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40453
diff changeset
149 fl._addrawrevision(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40453
diff changeset
150 node, rawtext, tr, linkrev, p1, p2, storedelta=delta, flags=flags
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40453
diff changeset
151 )
40326
fed697fa1734 sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40323
diff changeset
152 else:
fed697fa1734 sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40323
diff changeset
153 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
154
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40453
diff changeset
155
40363
c3ad9ef0876c tests: don't emit false failures when sqlite3 is missing
Augie Fackler <augie@google.com>
parents: 40326
diff changeset
156 if sqlitestore is not None:
c3ad9ef0876c tests: don't emit false failures when sqlite3 is missing
Augie Fackler <augie@google.com>
parents: 40326
diff changeset
157 sqlitefileindextests = storagetesting.makeifileindextests(
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40453
diff changeset
158 makesqlitefile, maketransaction, addrawrevisionsqlite
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40453
diff changeset
159 )
40363
c3ad9ef0876c tests: don't emit false failures when sqlite3 is missing
Augie Fackler <augie@google.com>
parents: 40326
diff changeset
160 sqlitefiledatatests = storagetesting.makeifiledatatests(
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40453
diff changeset
161 makesqlitefile, maketransaction, addrawrevisionsqlite
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40453
diff changeset
162 )
40363
c3ad9ef0876c tests: don't emit false failures when sqlite3 is missing
Augie Fackler <augie@google.com>
parents: 40326
diff changeset
163 sqlitefilemutationtests = storagetesting.makeifilemutationtests(
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40453
diff changeset
164 makesqlitefile, maketransaction, addrawrevisionsqlite
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40453
diff changeset
165 )
40326
fed697fa1734 sqlitestore: file storage backend using SQLite
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40323
diff changeset
166
39772
ae531f5e583c testing: add interface unit tests for file storage
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
167 if __name__ == '__main__':
ae531f5e583c testing: add interface unit tests for file storage
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
168 silenttestrunner.main(__name__)