Mercurial > hg
annotate tests/test-contrib-dumprevlog.t @ 39548:7ce9dea3a14a
localrepo: move repo creation logic out of localrepository.__init__ (API)
It has long bothered me that local repository creation is handled as
part of localrepository.__init__. Upcoming changes I want to make
around how repositories are initialized and instantiated will make
the continued existence of repository creation code in
localrepository.__init__ even more awkward.
localrepository instances are almost never constructed directly:
instead, callers are supposed to go through hg.repository() to obtain
a handle on a repository. And hg.repository() calls
localrepo.instance() to return a new repo instance.
This commit teaches localrepo.instance() to handle the create=True
logic. Most of the code for repo construction has been moved to a
standalone function. This allows extensions to monkeypatch the function
to further customize freshly-created repositories.
A few calls to localrepo.localrepository.__init__ that were passing
create=True were converted to call localrepo.instance().
.. api:: local repo creation moved out of constructor
``localrepo.localrepository.__init__`` no longer accepts a
``create`` argument to create a new repository. New repository
creation is now performed as part of ``localrepo.instance()``
and the bulk of the work is performed by
``localrepo.createrepository()``.
Differential Revision: https://phab.mercurial-scm.org/D4534
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Tue, 11 Sep 2018 13:46:59 -0700 |
parents | f1186c292d03 |
children | 5abc47d4ca6b |
rev | line source |
---|---|
37407
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
1 #require reporevlogstore |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
2 |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
3 $ CONTRIBDIR="$TESTDIR/../contrib" |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
4 |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
5 $ hg init repo-a |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
6 $ cd repo-a |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
7 |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
8 $ echo this is file a > a |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
9 $ hg add a |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
10 $ hg commit -m first |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
11 |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
12 $ echo adding to file a >> a |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
13 $ hg commit -m second |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
14 |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
15 $ echo adding more to file a >> a |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
16 $ hg commit -m third |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
17 $ hg verify |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
18 checking changesets |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
19 checking manifests |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
20 crosschecking files in changesets and manifests |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
21 checking files |
39489
f1186c292d03
verify: make output less confusing (issue5924)
Meirambek Omyrzak <meirambek77@gmail.com>
parents:
37407
diff
changeset
|
22 checked 3 changesets with 3 changes to 1 files |
37407
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
23 |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
24 Dumping revlog of file a to stdout: |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
25 $ $PYTHON "$CONTRIBDIR/dumprevlog" .hg/store/data/a.i |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
26 file: .hg/store/data/a.i |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
27 node: 183d2312b35066fb6b3b449b84efc370d50993d0 |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
28 linkrev: 0 |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
29 parents: 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
30 length: 15 |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
31 -start- |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
32 this is file a |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
33 |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
34 -end- |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
35 node: b1047953b6e6b633c0d8197eaa5116fbdfd3095b |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
36 linkrev: 1 |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
37 parents: 183d2312b35066fb6b3b449b84efc370d50993d0 0000000000000000000000000000000000000000 |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
38 length: 32 |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
39 -start- |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
40 this is file a |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
41 adding to file a |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
42 |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
43 -end- |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
44 node: 8c4fd1f7129b8cdec6c7f58bf48fb5237a4030c1 |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
45 linkrev: 2 |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
46 parents: b1047953b6e6b633c0d8197eaa5116fbdfd3095b 0000000000000000000000000000000000000000 |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
47 length: 54 |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
48 -start- |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
49 this is file a |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
50 adding to file a |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
51 adding more to file a |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
52 |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
53 -end- |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
54 |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
55 Dump all revlogs to file repo.dump: |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
56 |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
57 $ find .hg/store -name "*.i" | sort | xargs $PYTHON "$CONTRIBDIR/dumprevlog" > ../repo.dump |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
58 $ cd .. |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
59 |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
60 Undumping into repo-b: |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
61 |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
62 $ hg init repo-b |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
63 $ cd repo-b |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
64 $ $PYTHON "$CONTRIBDIR/undumprevlog" < ../repo.dump |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
65 .hg/store/00changelog.i |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
66 .hg/store/00manifest.i |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
67 .hg/store/data/a.i |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
68 $ cd .. |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
69 |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
70 Rebuild fncache with clone --pull: |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
71 |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
72 $ hg clone --pull -U repo-b repo-c |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
73 requesting all changes |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
74 adding changesets |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
75 adding manifests |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
76 adding file changes |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
77 added 3 changesets with 3 changes to 1 files |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
78 new changesets de1da620e7d8:46946d278c50 |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
79 |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
80 Verify: |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
81 |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
82 $ hg -R repo-c verify |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
83 checking changesets |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
84 checking manifests |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
85 crosschecking files in changesets and manifests |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
86 checking files |
39489
f1186c292d03
verify: make output less confusing (issue5924)
Meirambek Omyrzak <meirambek77@gmail.com>
parents:
37407
diff
changeset
|
87 checked 3 changesets with 3 changes to 1 files |
37407
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
88 |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
89 Compare repos: |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
90 |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
91 $ hg -R repo-c incoming repo-a |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
92 comparing with repo-a |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
93 searching for changes |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
94 no changes found |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
95 [1] |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
96 |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
97 $ hg -R repo-a incoming repo-c |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
98 comparing with repo-c |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
99 searching for changes |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
100 no changes found |
567bddcb4271
tests: extract dumprevlog tests to own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
101 [1] |