annotate tests/test-sparse-merges.t @ 39196:8c6775e812d8 stable

merge: do not delete untracked files silently (issue5962) 37450a122128, 2a774cae3a03, and 656ac240f392 weren't enough to prevent data loss. No unknown "files" weren't deleted before 7a8a16f8ea22, "context: also consider path conflicts when clearing unknown files."
author Yuya Nishihara <yuya@tcha.org>
date Sun, 19 Aug 2018 13:27:02 +0900
parents d49e490a9e85
children f785073f792c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
33289
abd7dedbaa36 sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1 test merging things outside of the sparse checkout
abd7dedbaa36 sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
2
abd7dedbaa36 sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
3 $ hg init myrepo
abd7dedbaa36 sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
4 $ cd myrepo
abd7dedbaa36 sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
5 $ cat > .hg/hgrc <<EOF
abd7dedbaa36 sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
6 > [extensions]
abd7dedbaa36 sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
7 > sparse=
abd7dedbaa36 sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
8 > EOF
abd7dedbaa36 sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
9
abd7dedbaa36 sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
10 $ echo foo > foo
abd7dedbaa36 sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
11 $ echo bar > bar
abd7dedbaa36 sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
12 $ hg add foo bar
abd7dedbaa36 sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
13 $ hg commit -m initial
abd7dedbaa36 sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
14
abd7dedbaa36 sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
15 $ hg branch feature
abd7dedbaa36 sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
16 marked working directory as branch feature
abd7dedbaa36 sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
17 (branches are permanent and global, did you want a bookmark?)
abd7dedbaa36 sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
18 $ echo bar2 >> bar
abd7dedbaa36 sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
19 $ hg commit -m 'feature - bar2'
abd7dedbaa36 sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
20
abd7dedbaa36 sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
21 $ hg update -q default
33293
c9cbf4de27ba sparse: rename command to debugsparse
Gregory Szorc <gregory.szorc@gmail.com>
parents: 33289
diff changeset
22 $ hg debugsparse --exclude 'bar**'
33289
abd7dedbaa36 sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
23
abd7dedbaa36 sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
24 $ hg merge feature
abd7dedbaa36 sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
25 temporarily included 1 file(s) in the sparse checkout for merging
abd7dedbaa36 sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
26 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
abd7dedbaa36 sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
27 (branch merge, don't forget to commit)
abd7dedbaa36 sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
28
abd7dedbaa36 sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
29 Verify bar was merged temporarily
abd7dedbaa36 sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
30
abd7dedbaa36 sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
31 $ ls
abd7dedbaa36 sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
32 bar
abd7dedbaa36 sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
33 foo
abd7dedbaa36 sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
34 $ hg status
abd7dedbaa36 sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
35 M bar
abd7dedbaa36 sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
36
abd7dedbaa36 sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
37 Verify bar disappears automatically when the working copy becomes clean
abd7dedbaa36 sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
38
abd7dedbaa36 sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
39 $ hg commit -m "merged"
abd7dedbaa36 sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
40 cleaned up 1 temporarily added file(s) from the sparse checkout
abd7dedbaa36 sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
41 $ hg status
abd7dedbaa36 sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
42 $ ls
abd7dedbaa36 sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
43 foo
abd7dedbaa36 sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
44
abd7dedbaa36 sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
45 $ hg cat -r . bar
abd7dedbaa36 sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
46 bar
abd7dedbaa36 sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
47 bar2
abd7dedbaa36 sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
48
abd7dedbaa36 sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
49 Test merging things outside of the sparse checkout that are not in the working
abd7dedbaa36 sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
50 copy
abd7dedbaa36 sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
51
abd7dedbaa36 sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
52 $ hg strip -q -r . --config extensions.strip=
abd7dedbaa36 sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
53 $ hg up -q feature
abd7dedbaa36 sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
54 $ touch branchonly
abd7dedbaa36 sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
55 $ hg ci -Aqm 'add branchonly'
abd7dedbaa36 sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
56
abd7dedbaa36 sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
57 $ hg up -q default
33293
c9cbf4de27ba sparse: rename command to debugsparse
Gregory Szorc <gregory.szorc@gmail.com>
parents: 33289
diff changeset
58 $ hg debugsparse -X branchonly
33289
abd7dedbaa36 sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
59 $ hg merge feature
abd7dedbaa36 sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
60 temporarily included 2 file(s) in the sparse checkout for merging
abd7dedbaa36 sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
61 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
abd7dedbaa36 sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
62 (branch merge, don't forget to commit)
38756
91c405f84cf7 sparse: add test showing `hg merge` is broken while using sparse extension
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 33293
diff changeset
63
91c405f84cf7 sparse: add test showing `hg merge` is broken while using sparse extension
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 33293
diff changeset
64 $ cd ..
91c405f84cf7 sparse: add test showing `hg merge` is broken while using sparse extension
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 33293
diff changeset
65
91c405f84cf7 sparse: add test showing `hg merge` is broken while using sparse extension
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 33293
diff changeset
66 Tests merging a file which is modified in one branch and deleted in another and
91c405f84cf7 sparse: add test showing `hg merge` is broken while using sparse extension
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 33293
diff changeset
67 file is excluded from sparse checkout
91c405f84cf7 sparse: add test showing `hg merge` is broken while using sparse extension
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 33293
diff changeset
68
91c405f84cf7 sparse: add test showing `hg merge` is broken while using sparse extension
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 33293
diff changeset
69 $ hg init ytest
91c405f84cf7 sparse: add test showing `hg merge` is broken while using sparse extension
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 33293
diff changeset
70 $ cd ytest
91c405f84cf7 sparse: add test showing `hg merge` is broken while using sparse extension
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 33293
diff changeset
71 $ echo "syntax: glob" >> .hgignore
91c405f84cf7 sparse: add test showing `hg merge` is broken while using sparse extension
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 33293
diff changeset
72 $ echo "*.orig" >> .hgignore
91c405f84cf7 sparse: add test showing `hg merge` is broken while using sparse extension
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 33293
diff changeset
73 $ hg ci -Aqm "added .hgignore"
91c405f84cf7 sparse: add test showing `hg merge` is broken while using sparse extension
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 33293
diff changeset
74 $ for ch in a d; do echo foo > $ch; hg ci -Aqm "added "$ch; done;
91c405f84cf7 sparse: add test showing `hg merge` is broken while using sparse extension
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 33293
diff changeset
75 $ cat >> .hg/hgrc <<EOF
91c405f84cf7 sparse: add test showing `hg merge` is broken while using sparse extension
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 33293
diff changeset
76 > [alias]
91c405f84cf7 sparse: add test showing `hg merge` is broken while using sparse extension
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 33293
diff changeset
77 > glog = log -GT "{rev}:{node|short} {desc}"
91c405f84cf7 sparse: add test showing `hg merge` is broken while using sparse extension
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 33293
diff changeset
78 > [extensions]
91c405f84cf7 sparse: add test showing `hg merge` is broken while using sparse extension
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 33293
diff changeset
79 > sparse =
91c405f84cf7 sparse: add test showing `hg merge` is broken while using sparse extension
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 33293
diff changeset
80 > EOF
91c405f84cf7 sparse: add test showing `hg merge` is broken while using sparse extension
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 33293
diff changeset
81
91c405f84cf7 sparse: add test showing `hg merge` is broken while using sparse extension
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 33293
diff changeset
82 $ hg glog
91c405f84cf7 sparse: add test showing `hg merge` is broken while using sparse extension
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 33293
diff changeset
83 @ 2:f29feff37cfc added d
91c405f84cf7 sparse: add test showing `hg merge` is broken while using sparse extension
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 33293
diff changeset
84 |
91c405f84cf7 sparse: add test showing `hg merge` is broken while using sparse extension
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 33293
diff changeset
85 o 1:617125d27d6b added a
91c405f84cf7 sparse: add test showing `hg merge` is broken while using sparse extension
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 33293
diff changeset
86 |
91c405f84cf7 sparse: add test showing `hg merge` is broken while using sparse extension
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 33293
diff changeset
87 o 0:53f3774ed939 added .hgignore
91c405f84cf7 sparse: add test showing `hg merge` is broken while using sparse extension
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 33293
diff changeset
88
91c405f84cf7 sparse: add test showing `hg merge` is broken while using sparse extension
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 33293
diff changeset
89 $ hg rm d
91c405f84cf7 sparse: add test showing `hg merge` is broken while using sparse extension
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 33293
diff changeset
90 $ hg ci -m "removed d"
91c405f84cf7 sparse: add test showing `hg merge` is broken while using sparse extension
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 33293
diff changeset
91
91c405f84cf7 sparse: add test showing `hg merge` is broken while using sparse extension
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 33293
diff changeset
92 $ hg up '.^'
91c405f84cf7 sparse: add test showing `hg merge` is broken while using sparse extension
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 33293
diff changeset
93 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
91c405f84cf7 sparse: add test showing `hg merge` is broken while using sparse extension
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 33293
diff changeset
94 $ hg debugsparse --reset
91c405f84cf7 sparse: add test showing `hg merge` is broken while using sparse extension
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 33293
diff changeset
95 $ echo bar >> d
91c405f84cf7 sparse: add test showing `hg merge` is broken while using sparse extension
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 33293
diff changeset
96 $ hg ci -Am "added bar to d"
91c405f84cf7 sparse: add test showing `hg merge` is broken while using sparse extension
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 33293
diff changeset
97 created new head
91c405f84cf7 sparse: add test showing `hg merge` is broken while using sparse extension
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 33293
diff changeset
98
91c405f84cf7 sparse: add test showing `hg merge` is broken while using sparse extension
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 33293
diff changeset
99 $ hg glog
91c405f84cf7 sparse: add test showing `hg merge` is broken while using sparse extension
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 33293
diff changeset
100 @ 4:6527874a90e4 added bar to d
91c405f84cf7 sparse: add test showing `hg merge` is broken while using sparse extension
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 33293
diff changeset
101 |
91c405f84cf7 sparse: add test showing `hg merge` is broken while using sparse extension
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 33293
diff changeset
102 | o 3:372c8558de45 removed d
91c405f84cf7 sparse: add test showing `hg merge` is broken while using sparse extension
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 33293
diff changeset
103 |/
91c405f84cf7 sparse: add test showing `hg merge` is broken while using sparse extension
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 33293
diff changeset
104 o 2:f29feff37cfc added d
91c405f84cf7 sparse: add test showing `hg merge` is broken while using sparse extension
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 33293
diff changeset
105 |
91c405f84cf7 sparse: add test showing `hg merge` is broken while using sparse extension
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 33293
diff changeset
106 o 1:617125d27d6b added a
91c405f84cf7 sparse: add test showing `hg merge` is broken while using sparse extension
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 33293
diff changeset
107 |
91c405f84cf7 sparse: add test showing `hg merge` is broken while using sparse extension
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 33293
diff changeset
108 o 0:53f3774ed939 added .hgignore
91c405f84cf7 sparse: add test showing `hg merge` is broken while using sparse extension
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 33293
diff changeset
109
91c405f84cf7 sparse: add test showing `hg merge` is broken while using sparse extension
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 33293
diff changeset
110 $ hg debugsparse --exclude "d"
91c405f84cf7 sparse: add test showing `hg merge` is broken while using sparse extension
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 33293
diff changeset
111 $ ls
91c405f84cf7 sparse: add test showing `hg merge` is broken while using sparse extension
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 33293
diff changeset
112 a
91c405f84cf7 sparse: add test showing `hg merge` is broken while using sparse extension
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 33293
diff changeset
113
91c405f84cf7 sparse: add test showing `hg merge` is broken while using sparse extension
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 33293
diff changeset
114 $ hg merge
38757
d49e490a9e85 merge: do the trivial resolution after updating sparse checkout
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 38756
diff changeset
115 temporarily included 1 file(s) in the sparse checkout for merging
d49e490a9e85 merge: do the trivial resolution after updating sparse checkout
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 38756
diff changeset
116 local [working copy] changed d which other [merge rev] deleted
d49e490a9e85 merge: do the trivial resolution after updating sparse checkout
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 38756
diff changeset
117 use (c)hanged version, (d)elete, or leave (u)nresolved? u
d49e490a9e85 merge: do the trivial resolution after updating sparse checkout
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 38756
diff changeset
118 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
d49e490a9e85 merge: do the trivial resolution after updating sparse checkout
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 38756
diff changeset
119 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
d49e490a9e85 merge: do the trivial resolution after updating sparse checkout
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 38756
diff changeset
120 [1]