Mercurial > hg
comparison tests/test-merge-subrepos.t @ 33196:439b4d005b4a
tests: demonstrate inconsistencies with dirty state in various commands
Not only is the output of these commands inconsistent with respect to each
other when a file is deleted, they are internally inconsistent depending upon
whether the deleted file is in the top level repo or a subrepo. It seemed
easier to show the problems, rather than describe them. The original goal was
to fix the summary command with respect to deleted files. I haven't fixed any
of the other issues yet, in case anybody believes the current subrepo behavior
is correct.
I think a natural understanding of clean/dirty is that they are two opposite
values of a single binary repo state. If `hg update --clean -r .` changes a
file, then naturally that repo was dirty, and `hg update --check` should have
blocked it. Deleted files are special, in that they don't block a commit. But
they make the filesystem content not the same as a clean checkout.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Wed, 28 Jun 2017 21:30:46 -0400 |
parents | 0f64af33fb63 |
children | 583aa1e3658b |
comparison
equal
deleted
inserted
replaced
33195:5d8942dbe49e | 33196:439b4d005b4a |
---|---|
21 Should fail, since there are added files to subrepo: | 21 Should fail, since there are added files to subrepo: |
22 | 22 |
23 $ hg merge | 23 $ hg merge |
24 abort: uncommitted changes in subrepository 'subrepo' | 24 abort: uncommitted changes in subrepository 'subrepo' |
25 [255] | 25 [255] |
26 | |
27 Deleted files trigger a '+' marker in top level repos. Deleted files are also | |
28 noticed by `update --check` in the top level repo. | |
29 | |
30 $ hg ci -Sqm 'add b' | |
31 $ rm a | |
32 $ hg id | |
33 cb66ec850af7+ tip | |
34 $ hg sum | |
35 parent: 3:cb66ec850af7 tip | |
36 add b | |
37 branch: default | |
38 commit: 1 deleted (clean) | |
39 update: 1 new changesets, 2 branch heads (merge) | |
40 phases: 4 draft | |
41 | |
42 $ hg up --check -r '.^' | |
43 abort: uncommitted changes | |
44 [255] | |
45 $ hg st -S | |
46 ! a | |
47 $ hg up -Cq . | |
48 | |
49 Test that dirty is consistent through subrepos | |
50 | |
51 $ rm subrepo/b | |
52 | |
53 TODO: a deleted subrepo file should be flagged as dirty, like the top level repo | |
54 | |
55 $ hg id | |
56 cb66ec850af7 tip | |
57 | |
58 TODO: a deleted file should be listed as such, like the top level repo | |
59 | |
60 $ hg sum | |
61 parent: 3:cb66ec850af7 tip | |
62 add b | |
63 branch: default | |
64 commit: (clean) | |
65 update: 1 new changesets, 2 branch heads (merge) | |
66 phases: 4 draft | |
67 | |
68 Modified subrepo files are noticed by `update --check` and `summary` | |
69 | |
70 $ echo mod > subrepo/b | |
71 $ hg st -S | |
72 M subrepo/b | |
73 | |
74 $ hg up -r '.^' --check | |
75 abort: uncommitted changes in subrepository 'subrepo' | |
76 [255] | |
77 | |
78 $ hg sum | |
79 parent: 3:cb66ec850af7 tip | |
80 add b | |
81 branch: default | |
82 commit: 1 subrepos | |
83 update: 1 new changesets, 2 branch heads (merge) | |
84 phases: 4 draft | |
85 | |
86 TODO: why is -R needed here? If it's because the subrepo is treated as a | |
87 discrete unit, then this should probably warn or something. | |
88 $ hg revert -R subrepo --no-backup subrepo/b -r . | |
89 | |
90 $ rm subrepo/b | |
91 $ hg st -S | |
92 ! subrepo/b | |
93 | |
94 TODO: --check should notice a subrepo with a missing file. It already notices | |
95 a modified file. | |
96 | |
97 $ hg up -r '.^' --check | |
98 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
99 | |
100 TODO: update without --clean shouldn't restore a deleted subrepo file, since it | |
101 doesn't restore a deleted top level repo file. | |
102 $ hg st -S | |
103 | |
104 $ hg bookmark -r tip @other | |
105 $ echo xyz > subrepo/c | |
106 $ hg ci -SAm 'add c' | |
107 adding subrepo/c | |
108 committing subrepository subrepo | |
109 created new head | |
110 $ rm subrepo/c | |
111 | |
112 Merge sees deleted subrepo files as an uncommitted change | |
113 | |
114 $ hg merge @other | |
115 subrepository subrepo diverged (local revision: 2b4750dcc93f, remote revision: cde40f86152f) | |
116 (M)erge, keep (l)ocal [working copy] or keep (r)emote [merge rev]? m | |
117 abort: uncommitted changes (in subrepo subrepo) | |
118 (use 'hg status' to list changes) | |
119 [255] |