comparison tests/test-narrow-merge.t @ 36079:a2a6e724d61a

narrow: import experimental extension from narrowhg revision cb51d673e9c5 Adjustments: * renamed src to hgext/narrow * marked extension experimental * added correct copyright header where it was missing * updated hgrc extension enable line in library.sh * renamed library.sh to narrow-library.sh * dropped all files from repo root as they're not interesting * dropped test-pyflakes.t, test-check-code.t and test-check-py3-compat.t * renamed remaining tests to all be test-narrow-* when they didn't already * fixed test-narrow-expanddirstate.t to refer to narrow and not narrowhg * fixed tests that wanted `update -C .` instead of `merge --abort` * corrected a two-space indent in narrowspec.py * added a missing _() in narrowcommands.py * fixed imports to pass the import checker * narrow only adds its --include and --exclude to clone if sparse isn't enabled to avoid breaking test-duplicateoptions.py. This is a kludge, and we'll need to come up with a better solution in the future. These were more or less the minimum to import something that would pass tests and not create a bunch of files we'll never use. Changes I intend to make as followups: * rework the test-narrow-*-tree.t tests to use the new testcases functionality in run-tests.py * remove lots of monkeypatches of core things Differential Revision: https://phab.mercurial-scm.org/D1974
author Augie Fackler <augie@google.com>
date Mon, 29 Jan 2018 16:19:33 -0500
parents
children dc01484606da
comparison
equal deleted inserted replaced
36078:7f68235f23ff 36079:a2a6e724d61a
1
2 $ . "$TESTDIR/narrow-library.sh"
3
4 create full repo
5
6 $ hg init master
7 $ cd master
8 $ cat >> .hg/hgrc <<EOF
9 > [narrow]
10 > serveellipses=True
11 > EOF
12
13 $ mkdir inside
14 $ echo inside1 > inside/f1
15 $ echo inside2 > inside/f2
16 $ mkdir outside
17 $ echo outside1 > outside/f1
18 $ echo outside2 > outside/f2
19 $ hg ci -Aqm 'initial'
20
21 $ echo modified > inside/f1
22 $ hg ci -qm 'modify inside/f1'
23
24 $ hg update -q 0
25 $ echo modified > inside/f2
26 $ hg ci -qm 'modify inside/f2'
27
28 $ hg update -q 0
29 $ echo modified2 > inside/f1
30 $ hg ci -qm 'conflicting inside/f1'
31
32 $ hg update -q 0
33 $ echo modified > outside/f1
34 $ hg ci -qm 'modify outside/f1'
35
36 $ hg update -q 0
37 $ echo modified2 > outside/f1
38 $ hg ci -qm 'conflicting outside/f1'
39
40 $ cd ..
41
42 $ hg clone --narrow ssh://user@dummy/master narrow --include inside
43 requesting all changes
44 adding changesets
45 adding manifests
46 adding file changes
47 added 6 changesets with 5 changes to 2 files (+4 heads)
48 new changesets *:* (glob)
49 updating to branch default
50 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
51 $ cd narrow
52
53 $ hg update -q 0
54
55 Can merge in when no files outside narrow spec are involved
56
57 $ hg update -q 'desc("modify inside/f1")'
58 $ hg merge 'desc("modify inside/f2")'
59 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
60 (branch merge, don't forget to commit)
61 $ hg commit -m 'merge inside changes'
62
63 Can merge conflicting changes inside narrow spec
64
65 $ hg update -q 'desc("modify inside/f1")'
66 $ hg merge 'desc("conflicting inside/f1")' 2>&1 | egrep -v '(warning:|incomplete!)'
67 merging inside/f1
68 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
69 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
70 $ echo modified3 > inside/f1
71 $ hg resolve -m
72 (no more unresolved files)
73 $ hg commit -m 'merge inside/f1'
74
75 TODO: Can merge non-conflicting changes outside narrow spec
76
77 $ hg update -q 'desc("modify inside/f1")'
78 $ hg merge 'desc("modify outside/f1")'
79 abort: merge affects file 'outside/f1' outside narrow, which is not yet supported
80 (merging in the other direction may work)
81 [255]
82
83 $ hg update -q 'desc("modify outside/f1")'
84 $ hg merge 'desc("modify inside/f1")'
85 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
86 (branch merge, don't forget to commit)
87 $ hg ci -m 'merge from inside to outside'
88
89 Refuses merge of conflicting outside changes
90
91 $ hg update -q 'desc("modify outside/f1")'
92 $ hg merge 'desc("conflicting outside/f1")'
93 abort: conflict in file 'outside/f1' is outside narrow clone
94 [255]