equal
deleted
inserted
replaced
16 from . import gitutil |
16 from . import gitutil |
17 |
17 |
18 |
18 |
19 pygit2 = gitutil.get_pygit2() |
19 pygit2 = gitutil.get_pygit2() |
20 |
20 |
21 _CURRENT_SCHEMA_VERSION = 4 |
21 _CURRENT_SCHEMA_VERSION = 5 |
22 _SCHEMA = ( |
22 _SCHEMA = ( |
23 """ |
23 """ |
24 CREATE TABLE refs ( |
24 CREATE TABLE refs ( |
25 -- node and name are unique together. There may be more than one name for |
25 -- node and name are unique together. There may be more than one name for |
26 -- a given node, and there may be no name at all for a given node (in the |
26 -- a given node, and there may be no name at all for a given node (in the |
69 p2filenode TEXT |
69 p2filenode TEXT |
70 ); |
70 ); |
71 |
71 |
72 CREATE INDEX changedfiles_nodes_idx |
72 CREATE INDEX changedfiles_nodes_idx |
73 ON changedfiles(node); |
73 ON changedfiles(node); |
|
74 |
|
75 -- Cached values to improve performance |
|
76 CREATE TABLE cache ( |
|
77 ncommits INTEGER |
|
78 ); |
|
79 INSERT INTO cache (ncommits) VALUES (NULL); |
74 |
80 |
75 PRAGMA user_version=%d |
81 PRAGMA user_version=%d |
76 """ |
82 """ |
77 % _CURRENT_SCHEMA_VERSION |
83 % _CURRENT_SCHEMA_VERSION |
78 ) |
84 ) |
396 for pos, h in enumerate(heads): |
402 for pos, h in enumerate(heads): |
397 if prog is not None: |
403 if prog is not None: |
398 prog.update(pos) |
404 prog.update(pos) |
399 _index_repo_commit(gitrepo, db, h) |
405 _index_repo_commit(gitrepo, db, h) |
400 |
406 |
|
407 db.execute( |
|
408 ''' |
|
409 UPDATE cache SET |
|
410 ncommits = (SELECT COUNT(1) FROM changelog) |
|
411 ''' |
|
412 ) |
|
413 |
401 db.commit() |
414 db.commit() |
402 if prog is not None: |
415 if prog is not None: |
403 prog.complete() |
416 prog.complete() |
404 |
417 |
405 |
418 |