Show More
@@ -0,0 +1,111 b'' | |||||
|
1 | =================================================================== | |||
|
2 | Test merge behavior with narrow for item outside of the narrow spec | |||
|
3 | =================================================================== | |||
|
4 | ||||
|
5 | This test currently check for simple "outside of narrow" merge case. I suspect | |||
|
6 | there might be more corner case that need testing, so extending this tests, or | |||
|
7 | replacing it by a more "generative" version, comparing behavior with and without narow. | |||
|
8 | ||||
|
9 | This the feature is currently working with flat manifest only. This is the only | |||
|
10 | case tested. Consider using test-case if tree start supporting this case of | |||
|
11 | merge. | |||
|
12 | ||||
|
13 | Create some initial setup | |||
|
14 | ||||
|
15 | $ . "$TESTDIR/narrow-library.sh" | |||
|
16 | ||||
|
17 | $ hg init server | |||
|
18 | $ echo root > server/root | |||
|
19 | $ mkdir server/inside | |||
|
20 | $ mkdir server/outside | |||
|
21 | $ echo babar > server/inside/inside-change | |||
|
22 | $ echo pom > server/outside/outside-changing | |||
|
23 | $ echo arthur > server/outside/outside-removed | |||
|
24 | $ hg -R server add server/ | |||
|
25 | adding server/inside/inside-change | |||
|
26 | adding server/outside/outside-changing | |||
|
27 | adding server/outside/outside-removed | |||
|
28 | adding server/root | |||
|
29 | $ hg -R server commit -m root | |||
|
30 | ||||
|
31 | ||||
|
32 | ||||
|
33 | $ hg clone ssh://user@dummy/server client --narrow --include inside | |||
|
34 | requesting all changes | |||
|
35 | adding changesets | |||
|
36 | adding manifests | |||
|
37 | adding file changes | |||
|
38 | added 1 changesets with 1 changes to 1 files | |||
|
39 | new changesets a0c415d360e5 | |||
|
40 | updating to branch default | |||
|
41 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
42 | ||||
|
43 | "trivial" change outside of narrow spec on the server | |||
|
44 | ||||
|
45 | $ echo zephir > server/outside/outside-added | |||
|
46 | $ hg -R server add server/outside/outside-added | |||
|
47 | $ echo flore > server/outside/outside-changing | |||
|
48 | $ hg -R server remove server/outside/outside-removed | |||
|
49 | $ hg -R server commit -m "outside change" | |||
|
50 | ||||
|
51 | Merge them with some unrelated local change | |||
|
52 | ||||
|
53 | $ echo celeste > client/inside/inside-change | |||
|
54 | $ hg -R client commit -m "inside change" | |||
|
55 | $ hg -R client pull | |||
|
56 | pulling from ssh://user@dummy/server | |||
|
57 | searching for changes | |||
|
58 | adding changesets | |||
|
59 | adding manifests | |||
|
60 | adding file changes | |||
|
61 | added 1 changesets with 0 changes to 0 files (+1 heads) | |||
|
62 | new changesets f9ec5453023e | |||
|
63 | (run 'hg heads' to see heads, 'hg merge' to merge) | |||
|
64 | $ hg -R client merge | |||
|
65 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
66 | (branch merge, don't forget to commit) | |||
|
67 | $ hg -R client ci -m 'merge changes' | |||
|
68 | $ hg -R client push -r . | |||
|
69 | pushing to ssh://user@dummy/server | |||
|
70 | searching for changes | |||
|
71 | remote: adding changesets | |||
|
72 | remote: adding manifests | |||
|
73 | remote: adding file changes | |||
|
74 | remote: added 2 changesets with 1 changes to 1 files | |||
|
75 | ||||
|
76 | Checking result | |||
|
77 | --------------- | |||
|
78 | ||||
|
79 | general sentry of all output | |||
|
80 | ||||
|
81 | $ hg --repository server manifest --debug --rev 0 | |||
|
82 | 360afd990eeff79e4a7f9f3ded5ecd7bc2fd3b59 644 inside/inside-change | |||
|
83 | 7db95ce5cd8e734ad12e3f5f37779a08070a1399 644 outside/outside-changing | |||
|
84 | 1591f6db41a30b68bd94ddccf4a4ce4f4fbe2a44 644 outside/outside-removed | |||
|
85 | 50ecbc31c0e82dd60c2747c434d1f11b85c0e178 644 root | |||
|
86 | $ hg --repository server manifest --debug --rev 1 | |||
|
87 | 360afd990eeff79e4a7f9f3ded5ecd7bc2fd3b59 644 inside/inside-change | |||
|
88 | 486c008d6dddcaeb5e5f99556a121800cdcfb149 644 outside/outside-added | |||
|
89 | 153d7af5e4f53f44475bc0ff2b806c86f019eda4 644 outside/outside-changing | |||
|
90 | 50ecbc31c0e82dd60c2747c434d1f11b85c0e178 644 root | |||
|
91 | ||||
|
92 | $ hg --repository server manifest --debug --rev 2 | |||
|
93 | 1b3ab69c6c847abc8fd25537241fedcd4d188668 644 inside/inside-change | |||
|
94 | 7db95ce5cd8e734ad12e3f5f37779a08070a1399 644 outside/outside-changing | |||
|
95 | 1591f6db41a30b68bd94ddccf4a4ce4f4fbe2a44 644 outside/outside-removed | |||
|
96 | 50ecbc31c0e82dd60c2747c434d1f11b85c0e178 644 root | |||
|
97 | $ hg --repository server manifest --debug --rev 3 | |||
|
98 | 1b3ab69c6c847abc8fd25537241fedcd4d188668 644 inside/inside-change | |||
|
99 | 486c008d6dddcaeb5e5f99556a121800cdcfb149 644 outside/outside-added | |||
|
100 | 153d7af5e4f53f44475bc0ff2b806c86f019eda4 644 outside/outside-changing | |||
|
101 | 50ecbc31c0e82dd60c2747c434d1f11b85c0e178 644 root | |||
|
102 | ||||
|
103 | The file changed outside should be changed by the merge | |||
|
104 | ||||
|
105 | $ hg --repository server manifest --debug --rev 'desc("inside change")' | grep outside-changing | |||
|
106 | 7db95ce5cd8e734ad12e3f5f37779a08070a1399 644 outside/outside-changing | |||
|
107 | ||||
|
108 | $ hg --repository server manifest --debug --rev 'desc("outside change")' | grep outside-changing | |||
|
109 | 153d7af5e4f53f44475bc0ff2b806c86f019eda4 644 outside/outside-changing | |||
|
110 | $ hg --repository server manifest --debug --rev 'desc("merge")' | grep outside-changing | |||
|
111 | 153d7af5e4f53f44475bc0ff2b806c86f019eda4 644 outside/outside-changing |
@@ -211,7 +211,16 b' def _process_files(tr, ctx, ms, files, n' | |||||
211 | repo.ui.note(uipathfn(f) + b"\n") |
|
211 | repo.ui.note(uipathfn(f) + b"\n") | |
212 | if f in narrow_files: |
|
212 | if f in narrow_files: | |
213 | narrow_action = narrow_files.get(f) |
|
213 | narrow_action = narrow_files.get(f) | |
214 |
if narrow_action == mergestate.CHANGE_ |
|
214 | if narrow_action == mergestate.CHANGE_REMOVED: | |
|
215 | files.mark_removed(f) | |||
|
216 | removed.append(f) | |||
|
217 | elif narrow_action == mergestate.CHANGE_ADDED: | |||
|
218 | files.mark_added(f) | |||
|
219 | added.append(f) | |||
|
220 | m[f] = m2[f] | |||
|
221 | flags = m2ctx.find(f)[1] or b'' | |||
|
222 | m.setflag(f, flags) | |||
|
223 | elif narrow_action == mergestate.CHANGE_MODIFIED: | |||
215 | files.mark_touched(f) |
|
224 | files.mark_touched(f) | |
216 | added.append(f) |
|
225 | added.append(f) | |
217 | m[f] = m2[f] |
|
226 | m[f] = m2[f] |
@@ -519,10 +519,7 b' def _filternarrowactions(narrowmatch, br' | |||||
519 | elif action[0].no_op: |
|
519 | elif action[0].no_op: | |
520 | mresult.removefile(f) # merge does not affect file |
|
520 | mresult.removefile(f) # merge does not affect file | |
521 | elif action[0].narrow_safe: |
|
521 | elif action[0].narrow_safe: | |
522 | if ( |
|
522 | if not f.endswith(b'/'): | |
523 | not f.endswith(b'/') |
|
|||
524 | and action[0].changes == mergestatemod.CHANGE_MODIFIED |
|
|||
525 | ): |
|
|||
526 | mresult.removefile(f) # merge won't affect on-disk files |
|
523 | mresult.removefile(f) # merge won't affect on-disk files | |
527 |
|
524 | |||
528 | mresult.addcommitinfo( |
|
525 | mresult.addcommitinfo( |
General Comments 0
You need to be logged in to leave comments.
Login now